Skip to content

Commit cfe28fc

Browse files
Document json patches usage
Signed-off-by: alexander-demicev <alexandr.demicev@suse.com>
1 parent 537faa1 commit cfe28fc

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

docs/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,3 +754,32 @@ spec:
754754
additionalManifests:
755755
name: additional-manifests
756756
```
757+
758+
## Patching provider manifests
759+
760+
Provider manifests can be patched using JSON merge patches. This can be useful when you need to modify the provider manifests that are fetched from the repository.
761+
762+
```yaml
763+
---
764+
apiVersion: operator.cluster.x-k8s.io/v1alpha2
765+
kind: CoreProvider
766+
metadata:
767+
name: cluster-api
768+
namespace: capi-system
769+
spec:
770+
resourcePatches:
771+
- |
772+
apiVersion: v1
773+
kind: Service
774+
metadata:
775+
labels:
776+
test-label: test-value
777+
```
778+
779+
There couple rules for the patch to match a manifest:
780+
781+
- The `kind` field must match the target object.
782+
- If `apiVersion` is specified it will only be applied to matching objects.
783+
- If `metadata.name` and `metadata.namespace` not specified, the patch will be applied to all objects of the specified kind.
784+
- If `metadata.name` is specified, the patch will be applied to the object with the specified name. This is for cluster scoped objects.
785+
- If both `metadata.name` and `metadata.namespace` are specified, the patch will be applied to the object with the specified name and namespace.

0 commit comments

Comments
 (0)