diff --git a/docs/README.md b/docs/README.md index 1921b763..45fbc0a3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -754,3 +754,32 @@ spec: additionalManifests: name: additional-manifests ``` + +## Patching provider manifests + +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. + +```yaml +--- +apiVersion: operator.cluster.x-k8s.io/v1alpha2 +kind: CoreProvider +metadata: + name: cluster-api + namespace: capi-system +spec: + resourcePatches: + - | +apiVersion: v1 +kind: Service +metadata: +labels: + test-label: test-value +``` + +There couple rules for the patch to match a manifest: + +- The `kind` field must match the target object. +- If `apiVersion` is specified it will only be applied to matching objects. +- If `metadata.name` and `metadata.namespace` not specified, the patch will be applied to all objects of the specified kind. +- If `metadata.name` is specified, the patch will be applied to the object with the specified name. This is for cluster scoped objects. +- If both `metadata.name` and `metadata.namespace` are specified, the patch will be applied to the object with the specified name and namespace.