apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: copy-headscale-config-to-webui
spec:
  rules:
    - name: Clone Headscale Config to WebUI
      match:
        resources:
          kinds:
            - Deployment
          selector:
            matchLabels:
              app: headscale-webui
      generate:
        kind: ConfigMap
        apiVersion: v1
        name: headscale-etc-copy
        namespace: headscale-webui
        synchronize: true
        clone:
          namespace: headscale
          name: headscale-etc
