1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-07 00:17:13 +00:00
kyverno/test/ConfigMapGenerator-SecretGenerator/policy-namespace-patch-cmgCG-sgCG.yaml

91 lines
2 KiB
YAML
Raw Normal View History

# This is a test-policy with patch, configMapGenerator with and without "copyFrom" option,
# secretGenerator with and without "copyFrom" option.
# To apply this policy you need to create secret and configMap in "default" namespace
# and then create a namespace
2019-05-21 09:27:04 -07:00
apiVersion : kubepolicy.nirmata.io/v1alpha1
kind : Policy
metadata :
name : "policy-ns-patch-cmg-sg"
spec :
rules:
2019-05-21 09:27:04 -07:00
- name: "patchNamespace2"
resource :
kinds :
- Namespace
selector:
matchLabels:
LabelForSelector : "namespace2"
2019-05-21 09:27:04 -07:00
mutate:
patches:
- path: "/metadata/labels/isMutatedByPolicy"
op: add
value: "true"
2019-05-21 09:27:04 -07:00
- name: "copyCM"
resource :
kinds :
- Namespace
selector:
matchLabels:
LabelForSelector : "namespace2"
2019-05-21 09:27:04 -07:00
generate :
- kind: ConfigMap
name : copied-cm
copyFrom :
namespace : default
name : game-config
data :
secretData: "data from cmg"
2019-05-21 09:27:04 -07:00
- name: "generateCM"
resource :
kinds :
- Namespace
selector:
matchLabels:
LabelForSelector : "namespace2"
2019-05-21 09:27:04 -07:00
generate :
- kind: ConfigMap
name : generated-cm
data :
secretData: "very sensitive data from cmg"
database: mongodb
database_uri: mongodb://localhost:27017
keys: |
image.public.key=771
rsa.public.key=42
2019-05-21 09:27:04 -07:00
- name: "generateSecret"
resource :
kinds :
- Namespace
2019-05-21 09:27:04 -07:00
name: ns2
generate :
- kind: Secret
name : generated-secrets
data :
foo : bar
app.properties : /
foo1=bar1
foo2=bar2
ui.properties : /
foo1=bar1
foo2=bar2
2019-05-21 09:27:04 -07:00
- name: "copySecret"
resource :
kinds :
- Namespace
2019-05-21 09:27:04 -07:00
name: ns2
generate :
- kind: Secret
name : copied-secrets
copyFrom :
namespace : default
name : mysecret
data :
foo : bar
secretData: "data from sg"