apiVersion: policy.open-cluster-management.io/v1
kind: Policy
metadata:
  name: policy-iampolicy-[TIME]
  namespace: default
  annotations:
    policy.open-cluster-management.io/standards: NIST-CSF
    policy.open-cluster-management.io/categories: PR.AC Identity Management Authentication and Access Control
    policy.open-cluster-management.io/controls: PR.AC-4 Access Control
spec:
  complianceType: musthave
  remediationAction: inform
  disabled: false
  namespaces:
    exclude: ["kube-*"]
    include: ["default"]
  policy-templates:
    - objectDefinition:
        apiVersion: policy.open-cluster-management.io/v1
        kind: IamPolicy # limit clusteradminrole and report violation
        metadata:
          name: policy-iampolicy-test-[TIME]
        spec:
          severity: medium
          namespaceSelector:
            include: ["*"]
            exclude: ["kube-*", "openshift-*"]
          remediationAction: inform
          maxClusterRoleBindingUsers: 9
---
apiVersion: policy.open-cluster-management.io/v1
kind: PlacementBinding
metadata:
  name: binding-policy-iampolicy-[TIME]
  namespace: default
placementRef:
  name: placement-policy-iampolicy-[TIME]
  kind: PlacementRule
  apiGroup: apps.open-cluster-management.io
subjects:
- name: policy-iampolicy-[TIME]
  kind: Policy
  apiGroup: policy.open-cluster-management.io
---
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
  name: placement-policy-iampolicy-[TIME]
  namespace: default
spec:
  clusterConditions:
  - status: "True"
    type: ManagedClusterConditionAvailable
  clusterSelector:
    matchExpressions:
      []
