Patch-ception. We are confused. Please help! #4815
-
Hi, I am testing the new OCIRepository and the deployment of YAML manifest packaged in OCI. I have the following setup: 1. A Flux Kustomization for my infrastructure apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: infrastructure
namespace: flux-system
spec:
interval: 1m
sourceRef:
kind: OCIRepository
name: flux-system
path: path/to/folder/with/kustomize
prune: true
wait: true 2. A regular kustomization file apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- redis.yaml
- ... 3. A Flux kustomization for a OCI Redis deployment apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: redis
namespace: flux-system
spec:
interval: 1m
targetNamespace: redis
sourceRef:
kind: OCIRepository
name: oci-artifacts
namespace: flux-system
path: redis
prune: true
timeout: 1m
patches:
- target:
kind: HelmRelease
name: redis
namespace: redis
patch: |-
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: redis
namespace: redis
spec:
values:
commonLabels:
foo: bar # I expect this to show!
- target:
kind: HelmRelease
name: redis
namespace: redis
patch: |
- op: add
path: /metadata/labels
value:
fancy: pansy # I expect this to show! The OCI Repository points to an OCI-compliant image packaged from a repo I can't share. This deployment includes the following:
This deploys just fine, but the patches are not applied. I have no idea why, and I would expect it to work. Are there some limitations to how patches work when utilizing the new OCI support added in Flux v2.3.0. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Remove |
Beta Was this translation helpful? Give feedback.
Remove
namespace: redis
from patches. The namespace transformer is applied after all patches, so if it's not hardcoded in the base YAMLs it will not work.