diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index cd65ee97..dfdbcfe5 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -344,7 +344,7 @@ }, { "ImportPath": "k8s.io/api", - "Rev": "eac758366a00" + "Rev": "d58b53da08f5" }, { "ImportPath": "k8s.io/apimachinery", diff --git a/examples/in-cluster-client-configuration/main.go b/examples/in-cluster-client-configuration/main.go index fd107844..c93d4041 100644 --- a/examples/in-cluster-client-configuration/main.go +++ b/examples/in-cluster-client-configuration/main.go @@ -48,6 +48,8 @@ func main() { panic(err.Error()) } for { + // get pods in all the namespaces by omitting namespace + // Or specify namespace to get pods in particular namespace pods, err := clientset.CoreV1().Pods("").List(metav1.ListOptions{}) if err != nil { panic(err.Error()) @@ -55,17 +57,17 @@ func main() { fmt.Printf("There are %d pods in the cluster\n", len(pods.Items)) // Examples for error handling: - // - Use helper functions like e.g. errors.IsNotFound() + // - Use helper functions e.g. errors.IsNotFound() // - And/or cast to StatusError and use its properties like e.g. ErrStatus.Message _, err = clientset.CoreV1().Pods("default").Get("example-xxxxx", metav1.GetOptions{}) if errors.IsNotFound(err) { - fmt.Printf("Pod not found\n") + fmt.Printf("Pod example-xxxxx not found in default namespace\n") } else if statusError, isStatus := err.(*errors.StatusError); isStatus { fmt.Printf("Error getting pod %v\n", statusError.ErrStatus.Message) } else if err != nil { panic(err.Error()) } else { - fmt.Printf("Found pod\n") + fmt.Printf("Found example-xxxxx pod in default namespace\n") } time.Sleep(10 * time.Second) diff --git a/go.mod b/go.mod index 2890638b..dd75075b 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 golang.org/x/time v0.0.0-20181108054448-85acf8d2951c google.golang.org/appengine v1.5.0 // indirect - k8s.io/api v0.0.0-20190923155552-eac758366a00 + k8s.io/api v0.0.0-20190925180651-d58b53da08f5 k8s.io/apimachinery v0.0.0-20190923155427-ec87dd743e08 k8s.io/klog v1.0.0 k8s.io/utils v0.0.0-20190801114015-581e00157fb1 @@ -41,6 +41,6 @@ replace ( golang.org/x/sys => golang.org/x/sys v0.0.0-20190209173611-3b5209105503 golang.org/x/text => golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db golang.org/x/time => golang.org/x/time v0.0.0-20161028155119-f51c12702a4d - k8s.io/api => k8s.io/api v0.0.0-20190923155552-eac758366a00 + k8s.io/api => k8s.io/api v0.0.0-20190925180651-d58b53da08f5 k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190923155427-ec87dd743e08 ) diff --git a/go.sum b/go.sum index 92c49e69..bcb62215 100644 --- a/go.sum +++ b/go.sum @@ -177,7 +177,7 @@ gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.0.0-20190923155552-eac758366a00/go.mod h1:blPYY5r6fKug8SVOnjDtFAlzZzInCRL9NNls66SFhFI= +k8s.io/api v0.0.0-20190925180651-d58b53da08f5/go.mod h1:blPYY5r6fKug8SVOnjDtFAlzZzInCRL9NNls66SFhFI= k8s.io/apimachinery v0.0.0-20190923155427-ec87dd743e08/go.mod h1:grJJH0hgilA2pYoUiJcPu2EDUal95NTq1vpxxvMLSu8= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=