apiVersion: policy.open-cluster-management.io/v1
kind: Policy
metadata:
  name: case9-test-policy
spec:
  remediationAction: inform
  disabled: false
  policy-templates:
    - objectDefinition:
        apiVersion: policy.open-cluster-management.io/v1
        kind: ConfigurationPolicy
        metadata:
          name: case9-test-configpolicy
        spec:
          remediationAction: inform
          namespaceSelector:
            exclude: ["kube-*"]
            include: ["default"]
          object-templates:
            - complianceType: musthave
              objectDefinition:
                kind: ConfigMap
                apiVersion: v1
                metadata:
                  name: case9-test-configmap
                  namespace: test
                data:
                  # Configuration values can be set as key-value properties
                  Clustername: '{{hub .ManagedClusterName hub}}'
                  Clusterid: '{{ fromClusterClaim id.openshift.io }}'
                  Vlanid: |
                    '{{hub printf "%s-vlanid" .ManagedClusterName | fromConfigMap "policy-propagator-test" "case9-config"  | toInt hub}}'
                  indent-test: |
                    {{hub fromConfigMap "policy-propagator-test" "case9-config2" "saying" | base64dec | indent 4 hub}}
                  autoindent-test: |
                    {{hub fromConfigMap "policy-propagator-test" "case9-config2" "saying" | base64dec | autoindent hub}}
---
apiVersion: policy.open-cluster-management.io/v1
kind: PlacementBinding
metadata:
  name: case9-test-policy-pb
placementRef:
  apiGroup: apps.open-cluster-management.io
  kind: PlacementRule
  name: case9-test-policy-plr
subjects:
- apiGroup: policy.open-cluster-management.io
  kind: Policy
  name: case9-test-policy
---
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
  name: case9-test-policy-plr
spec:
  clusterConditions:
  - status: "True"
    type: ManagedClusterConditionAvailable
  clusterSelector:
    matchExpressions:
      []
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: case9-config
data:
  managed1-vlanid: "123"
  managed2-vlanid: "456"
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: case9-config2
data:
  saying: RG8uCk9yIGRvIG5vdC4KVGhlcmUgaXMgbm8gdHJ5Lgo=
