Skip to content

Commit b9a1e2b

Browse files
authored
Add comment about patching custom resources
When running a `patch` operation on a custom resource the default strategic merge strategy can fail. Since it's difficult to identify custom resources, we leave a note to the developer that they need to be aware of this when using this example code. See: #838
1 parent 41fdbb6 commit b9a1e2b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

examples/typescript/apply/apply-example.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ export async function apply(specPath: string): Promise<k8s.KubernetesObject[]> {
3131
// block.
3232
await client.read(spec);
3333
// we got the resource, so it exists, so patch it
34+
//
35+
// Note that this could fail if the spec refers to a custom resource. For custom resources you may need to specify
36+
// a different patch merge strategy in the content-type header.
37+
//
38+
// See: https://github.com/kubernetes/kubernetes/issues/97423
3439
const response = await client.patch(spec);
3540
created.push(response.body);
3641
} catch (e) {

0 commit comments

Comments
 (0)