Skip to content

Instantly share code, notes, and snippets.

@samj1912
Last active August 4, 2021 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samj1912/6c8ec518c77d3e05330392fd65cd2314 to your computer and use it in GitHub Desktop.
Save samj1912/6c8ec518c77d3e05330392fd65cd2314 to your computer and use it in GitHub Desktop.
---
apiVersion: v1
data:
key: dmFsdWU=
kind: Secret
metadata:
name: secret-name
namespace: other-namespace
type: Opaque
---
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: sync-svc-account
spec:
rules:
- name: sync-secret
match:
resources:
kinds:
- Namespace
selector:
matchLabels:
"key": "value"
generate:
kind: Secret
name: secret-name
namespace: "{{request.object.metadata.name}}"
synchronize: true
clone:
namespace: other-namespace
name: secret-name
- name: sync-svc-account
match:
resources:
kinds:
- Namespace
selector:
matchLabels:
"key": "value"
generate:
synchronize: true
kind: ServiceAccount
name: account-name
namespace: "{{request.object.metadata.name}}"
data:
secrets:
- name: secret-name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment