1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-15 17:51:20 +00:00

Merge pull request #814 from nirmata/bugfix/797_update_docs_example_for_mutate

Fixes #797 - update example for mutate patch policy
This commit is contained in:
Shravan Shetty 2020-04-20 18:52:32 +05:30 committed by GitHub
commit 9d88e73204
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,28 +20,31 @@ A JSON Patch rule provides an alternate way to mutate resources.
With Kyverno, the add and replace have the same behavior i.e. both operations will add or replace the target element.
This patch adds an init container to all deployments.
This patch policy adds, or replaces, entries in a `ConfigMap` with the name `config-game` in any namespace.
````yaml
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: policy-v1
spec:
apiVersion : kyverno.io/v1
kind : ClusterPolicy
metadata :
name : policy-generate-cm
spec :
rules:
- name: "add-init-secrets"
- name: pCM1
match:
resources:
kinds:
- Deployment
name: "config-game"
kinds :
- ConfigMap
mutate:
overlay:
spec:
template:
spec:
initContainers:
- name: init-secrets
image: nirmata.io/kube-vault-client:v2
patches:
- path: "/data/ship.properties"
op: add
value: |
type=starship
owner=utany.corp
- path : "/data/newKey1"
op : add
value : newValue1
````
Here is the example of a patch that removes a label from the secret: