Skip to content

Instantly share code, notes, and snippets.

@yifan-gu
Created March 24, 2017 23:30
Show Gist options
  • Select an option

  • Save yifan-gu/6b073baa795fa2904282cd4bc842880d to your computer and use it in GitHub Desktop.

Select an option

Save yifan-gu/6b073baa795fa2904282cd4bc842880d to your computer and use it in GitHub Desktop.
test deployement scaledown
package main
import (
"fmt"
"os"
"github.com/coreos-inc/operator-client/pkg/client"
)
// Before running the program, run: kubectl run foo --image=nginx --labels='app=foo'
func main() {
kubeconfig := os.Getenv("KUBECONFIG")
c := client.NewClient(kubeconfig)
l, err := c.ListPodsWithLabels("default", map[string]string{"app": "foo"})
if err != nil {
fmt.Println(err)
return
}
for _, ll := range l.Items {
fmt.Println(ll)
}
if err = c.DeleteDeployment("default", "foo", true); err != nil {
fmt.Println(err)
return
}
fmt.Println("done delete")
l, err = c.ListPodsWithLabels("default", map[string]string{"app": "foo"})
if err != nil {
fmt.Println(err)
return
}
for _, ll := range l.Items {
fmt.Println(ll)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment