Skip to content

Instantly share code, notes, and snippets.

@samuell
Created February 11, 2017 08:43
Show Gist options
  • Save samuell/f987c82a34275e51e48c33e9aac6abad to your computer and use it in GitHub Desktop.
Save samuell/f987c82a34275e51e48c33e9aac6abad to your computer and use it in GitHub Desktop.
package main
import (
"flag"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
)
var (
kubeconfig = flag.String("kubeconfig", "/home/samuel/.kube/config", "absolute path to the kubeconfig file")
)
func main() {
flag.Parse()
config, err := clientcmd.BuildConfigFromFlags("", *kubeconfig)
check(err)
clientset, err := kubernetes.NewForConfig(config)
check(err)
clientset.Jobs(clientset.Namespaces().Get("default"))
}
func check(err error) {
if err != nil {
panic(err)
}
}
@samuell
Copy link
Author

samuell commented Feb 11, 2017

$ go run k8sexp.go 
# command-line-arguments
./k8sexp.go:22: ambiguous selector clientset.Jobs

@beldpro-ci
Copy link

hey @samuell, did you get it working?

@karunchennuri
Copy link

You should try
clientset.BatchV1Client.Jobs("").Get(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment