Last active
November 23, 2025 11:59
-
-
Save J4NS-R/4d5cdb1f57edfe8c74e674dfa7fef695 to your computer and use it in GitHub Desktop.
Bitnami to bitnamilegacy kyverno policy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: kyverno.io/v1 | |
| kind: ClusterPolicy | |
| metadata: | |
| name: replace-bitnami-with-bitnamilegacy | |
| annotations: | |
| pod-policies.kyverno.io/autogen-controllers: none # do not modify pod controllers (deployments, sts, cronjob) | |
| spec: | |
| background: false # only on pod creation | |
| rules: | |
| - name: replace-bitnami-image | |
| match: | |
| any: | |
| - resources: | |
| kinds: | |
| - Pod | |
| mutate: | |
| foreach: | |
| - list: "request.object.spec.containers[]" | |
| patchStrategicMerge: | |
| spec: | |
| containers: | |
| - name: "{{ element.name }}" | |
| image: "{{ regex_replace_all('bitnami/', element.image, 'bitnamilegacy/') }}" | |
| - name: replace-bitnami-initcontainers | |
| match: | |
| any: | |
| - resources: | |
| kinds: | |
| - Pod | |
| preconditions: | |
| all: | |
| - key: "{{ request.object.spec.initContainers[] || `[]` | length(@) }}" | |
| operator: GreaterThanOrEquals | |
| value: 1 | |
| mutate: | |
| foreach: | |
| - list: "request.object.spec.initContainers[]" | |
| patchStrategicMerge: | |
| spec: | |
| initContainers: | |
| - name: "{{ element.name }}" | |
| image: "{{ regex_replace_all('bitnami/', element.image, 'bitnamilegacy/') }}" | |
| webhookConfiguration: | |
| failurePolicy: Ignore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment