Skip to content

Instantly share code, notes, and snippets.

@cheyang
Forked from samuell/list_minikube_jobinfo.go
Created November 29, 2017 08:37
Show Gist options
  • Save cheyang/16b9876f63ae91f7636801a04ab6ac9c to your computer and use it in GitHub Desktop.
Save cheyang/16b9876f63ae91f7636801a04ab6ac9c to your computer and use it in GitHub Desktop.

Revisions

  1. @samuell samuell created this gist Feb 13, 2017.
    29 changes: 29 additions & 0 deletions list_minikube_jobinfo.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    package main

    import (
    "flag"
    "fmt"
    "k8s.io/client-go/kubernetes"
    "k8s.io/client-go/pkg/api/v1"
    "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)

    fmt.Println(clientset.BatchV1Client.Jobs("default").List(v1.ListOptions{}))
    }

    func check(err error) {
    if err != nil {
    panic(err)
    }
    }