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.PT Protective Technology
    policy.open-cluster-management.io/controls: PR.PT-3 Least Functionality
spec:
  remediationAction: inform
  disabled: false
  policy-templates:
  - objectDefinition:
      apiVersion: policy.open-cluster-management.io/v1
      kind: ConfigurationPolicy
      metadata:
        name: [TEST_POLICY_NAME]-sample-restricted-scc
      spec:
        remediationAction: inform # will be overridden by remediationAction in parent policy
        severity: high
        namespaceSelector:
          exclude: ["kube-*"]
          include: ["default"]
        object-templates:
          - complianceType: musthave
            objectDefinition:
              apiVersion: security.openshift.io/v1
              kind: SecurityContextConstraints # restricted scc
              metadata:
                annotations:
                  kubernetes.io/description: restricted denies access to all host features and requires pods to be run with a UID, and SELinux context that are allocated to the namespace.  This is the most restrictive SCC and it is used by default for authenticated users.
                name: sample-restricted-scc
              allowHostDirVolumePlugin: false
              allowHostIPC: false
              allowHostNetwork: false
              allowHostPID: false
              allowHostPorts: false
              allowPrivilegeEscalation: true
              allowPrivilegedContainer: false
              allowedCapabilities: []
              defaultAddCapabilities: []
              fsGroup:
                type: MustRunAs
              groups:
              - system:authenticated
              priority: 10
              readOnlyRootFilesystem: false
              requiredDropCapabilities:
              - KILL
              - MKNOD
              - SETUID
              - SETGID
              runAsUser:
                type: MustRunAsRange
              seLinuxContext:
                type: MustRunAs
              supplementalGroups:
                type: RunAsAny
              users: []
              volumes:
              - configMap
              - downwardAPI
              - emptyDir
              - persistentVolumeClaim
              - projected
              - secret
---
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
