generated: run refactor

Kubernetes-commit: 3aa59f7f3077642592dc8a864fcef8ba98699894
This commit is contained in:
Mike Danese
2020-02-07 18:16:47 -08:00
committed by Kubernetes Publisher
parent 5be5d5753f
commit 60a0346672
95 changed files with 290 additions and 199 deletions

View File

@@ -18,6 +18,7 @@ limitations under the License.
package main
import (
"context"
"fmt"
"time"
@@ -50,7 +51,7 @@ func main() {
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{})
pods, err := clientset.CoreV1().Pods("").List(context.TODO(), metav1.ListOptions{})
if err != nil {
panic(err.Error())
}
@@ -59,7 +60,7 @@ func main() {
// Examples for error handling:
// - 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{})
_, err = clientset.CoreV1().Pods("default").Get(context.TODO(), "example-xxxxx", metav1.GetOptions{})
if errors.IsNotFound(err) {
fmt.Printf("Pod example-xxxxx not found in default namespace\n")
} else if statusError, isStatus := err.(*errors.StatusError); isStatus {