apiVersion: policy.open-cluster-management.io/v1
kind: Policy
metadata:
  name: [TEST_POLICY_NAME]
  namespace: default
  annotations:
    policy.open-cluster-management.io/standards: NIST-CSF
    policy.open-cluster-management.io/categories: PR.IP Information Protection Processes and Procedures
    policy.open-cluster-management.io/controls: PR.IP-1 Baseline Configuration
spec:
  remediationAction: inform
  disabled: false
  policy-templates:
  - objectDefinition:
      apiVersion: policy.open-cluster-management.io/v1
      kind: ConfigurationPolicy
      metadata:
        name: [TEST_POLICY_NAME]-mem-limit-range
      spec:
        remediationAction: inform # will be overridden by remediationAction in parent policy
        severity: medium
        namespaceSelector:
          exclude: ["kube-*"]
          include: ["default"]
        object-templates:
          - complianceType: musthave
            objectDefinition:
              apiVersion: v1
              kind: LimitRange # limit memory usage
              metadata:
                name: mem-limit-range
              spec:
                limits:
                - default:
                    memory: 512Mi
                  defaultRequest:
                    memory: 256Mi
                  type: Container
---
apiVersion: policy.open-cluster-management.io/v1
kind: PlacementBinding
metadata:
  name: binding-[TEST_POLICY_NAME]
  namespace: default
placementRef:
  name: placement-[TEST_POLICY_NAME]
  kind: PlacementRule
  apiGroup: apps.open-cluster-management.io
subjects:
- name: [TEST_POLICY_NAME]
  kind: Policy
  apiGroup: policy.open-cluster-management.io
---
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
  name: placement-[TEST_POLICY_NAME]
  namespace: default
spec:
  clusterConditions:
  - status: "True"
    type: ManagedClusterConditionAvailable
  clusterSelector:
    matchExpressions:
      []  # selects all clusters if not specified
