MCPcopy
hub / github.com/kubernetes-sigs/controller-runtime / ExampleNew

Function ExampleNew

pkg/client/example_test.go:43–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41)
42
43func ExampleNew() {
44 cl, err := client.New(config.GetConfigOrDie(), client.Options{})
45 if err != nil {
46 fmt.Println("failed to create client")
47 os.Exit(1)
48 }
49
50 podList := &corev1.PodList{}
51
52 err = cl.List(context.Background(), podList, client.InNamespace("default"))
53 if err != nil {
54 fmt.Printf("failed to list pods in namespace default: %v\n", err)
55 os.Exit(1)
56 }
57}
58
59func ExampleNew_suppress_warnings() {
60 cfg := config.GetConfigOrDie()

Callers

nothing calls this directly

Calls 4

NewFunction · 0.92
GetConfigOrDieFunction · 0.92
InNamespaceTypeAlias · 0.92
ListMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…