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

Function ExampleClient_patch

pkg/client/example_test.go:204–212  ·  view source on GitHub ↗

This example shows how to use the client with typed and unstructured objects to patch objects.

()

Source from the content-addressed store, hash-verified

202
203// This example shows how to use the client with typed and unstructured objects to patch objects.
204func ExampleClient_patch() {
205 patch := []byte(`{"metadata":{"annotations":{"version": "v2"}}}`)
206 _ = c.Patch(context.Background(), &corev1.Pod{
207 ObjectMeta: metav1.ObjectMeta{
208 Namespace: "namespace",
209 Name: "name",
210 },
211 }, client.RawPatch(types.StrategicMergePatchType, patch))
212}
213
214// This example shows how to use the client with unstructured objects to create/patch objects using Server Side Apply,
215// "k8s.io/apimachinery/pkg/runtime".DefaultUnstructuredConverter.ToUnstructured is used to convert an object into map[string]any representation,

Callers

nothing calls this directly

Calls 2

RawPatchFunction · 0.92
PatchMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…