mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-03 16:16:06 +00:00
generated: run refactor
Kubernetes-commit: 3aa59f7f3077642592dc8a864fcef8ba98699894
This commit is contained in:
committed by
Kubernetes Publisher
parent
5be5d5753f
commit
60a0346672
@@ -18,6 +18,7 @@ limitations under the License.
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
@@ -60,7 +61,7 @@ func main() {
|
||||
panic(err.Error())
|
||||
}
|
||||
for {
|
||||
pods, err := clientset.CoreV1().Pods("").List(metav1.ListOptions{})
|
||||
pods, err := clientset.CoreV1().Pods("").List(context.TODO(), metav1.ListOptions{})
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
@@ -71,7 +72,7 @@ func main() {
|
||||
// - And/or cast to StatusError and use its properties like e.g. ErrStatus.Message
|
||||
namespace := "default"
|
||||
pod := "example-xxxxx"
|
||||
_, err = clientset.CoreV1().Pods(namespace).Get(pod, metav1.GetOptions{})
|
||||
_, err = clientset.CoreV1().Pods(namespace).Get(context.TODO(), pod, metav1.GetOptions{})
|
||||
if errors.IsNotFound(err) {
|
||||
fmt.Printf("Pod %s in namespace %s not found\n", pod, namespace)
|
||||
} else if statusError, isStatus := err.(*errors.StatusError); isStatus {
|
||||
|
Reference in New Issue
Block a user