Skip to content

Commit

Permalink
Kustomize ValidatingAdmissionPolicyBinding
Browse files Browse the repository at this point in the history
This is a workaround for kustomize issue where it does not prefix
`ValidatingAdmissionPolicy`'s name in `ValidatingAdmissionPolicyBinding`'s field `spec.policyName`.

Instead of using `namePrefix` in `kustomization.yaml` we use `PrefixSuffixTransformer` with
custom `fieldSpecs`.

Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
  • Loading branch information
m1kola committed Apr 23, 2024
1 parent 16d5b42 commit 42d7439
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,20 @@ namespace: operator-controller-system
# "wordpress" becomes "alices-wordpress".
# Note that it should also match with the prefix (text before '-') of the namespace
# field above.
namePrefix: operator-controller-
transformers:
# This can be replaced by namePrefix once kustomize has support for ValidatingAdmissionPolicyBinding
# https://github.com/kubernetes-sigs/kustomize/issues/5674
- |-
apiVersion: builtin
kind: PrefixSuffixTransformer
metadata:
name: prefix-all-names
prefix: operator-controller-
fieldSpecs:
- path: metadata/name
- group: admissionregistration.k8s.io
kind: ValidatingAdmissionPolicyBinding
path: spec/policyName
# Labels to add to all resources and selectors.
#labels:
Expand Down

0 comments on commit 42d7439

Please sign in to comment.