dep ensure -update k8s.io/client-go (#197)
This commit is contained in:
3
vendor/k8s.io/client-go/examples/out-of-cluster-client-configuration/BUILD
generated
vendored
3
vendor/k8s.io/client-go/examples/out-of-cluster-client-configuration/BUILD
generated
vendored
@@ -8,8 +8,7 @@ load(
|
||||
|
||||
go_binary(
|
||||
name = "out-of-cluster-client-configuration",
|
||||
importpath = "k8s.io/client-go/examples/out-of-cluster-client-configuration",
|
||||
library = ":go_default_library",
|
||||
embed = [":go_default_library"],
|
||||
)
|
||||
|
||||
go_library(
|
||||
|
||||
11
vendor/k8s.io/client-go/examples/out-of-cluster-client-configuration/main.go
generated
vendored
11
vendor/k8s.io/client-go/examples/out-of-cluster-client-configuration/main.go
generated
vendored
@@ -62,15 +62,18 @@ func main() {
|
||||
// Examples for error handling:
|
||||
// - Use helper functions like 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{})
|
||||
namespace := "default"
|
||||
pod := "example-xxxxx"
|
||||
_, err = clientset.CoreV1().Pods(namespace).Get(pod, metav1.GetOptions{})
|
||||
if errors.IsNotFound(err) {
|
||||
fmt.Printf("Pod not found\n")
|
||||
fmt.Printf("Pod %s in namespace %s not found\n", pod, namespace)
|
||||
} else if statusError, isStatus := err.(*errors.StatusError); isStatus {
|
||||
fmt.Printf("Error getting pod %v\n", statusError.ErrStatus.Message)
|
||||
fmt.Printf("Error getting pod %s in namespace %s: %v\n",
|
||||
pod, namespace, statusError.ErrStatus.Message)
|
||||
} else if err != nil {
|
||||
panic(err.Error())
|
||||
} else {
|
||||
fmt.Printf("Found pod\n")
|
||||
fmt.Printf("Found pod %s in namespace %s\n", pod, namespace)
|
||||
}
|
||||
|
||||
time.Sleep(10 * time.Second)
|
||||
|
||||
Reference in New Issue
Block a user