# Copyright Contributors to the Open Cluster Management project

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: policies.policy.open-cluster-management.io
spec:
  conversion:
    strategy: None
  group: policy.open-cluster-management.io
  names:
    kind: Policy
    listKind: PolicyList
    plural: policies
    shortNames:
    - plc
    singular: policy
  scope: Namespaced
  versions:
  - name: v1
    schema:
      openAPIV3Schema:
        description: Policy is the Schema for the policies API
        properties:
          apiVersion:
            description: 'APIVersion defines the versioned schema of this representation
              of an object. Servers should convert recognized schemas to the latest
              internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
            type: string
          kind:
            description: 'Kind is a string value representing the REST resource this
              object represents. Servers may infer this from the endpoint the client
              submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
            type: string
          metadata:
            type: object
          spec:
            description: PolicySpec defines the desired state of Policy
            properties:
              disabled:
                type: boolean
              policy-templates:
                items:
                  description: PolicyTemplate template for custom security policy
                  properties:
                    objectDefinition:
                      type: object
                      x-kubernetes-preserve-unknown-fields: true
                  type: object
                type: array
              remediationAction:
                description: RemediationAction describes weather to enforce or inform
                type: string
            required:
            - disabled
            type: object
          status:
            description: PolicyStatus defines the observed state of Policy
            properties:
              compliant:
                description: ComplianceState shows the state of enforcement
                enum:
                - Compliant
                - NonCompliant
                type: string
              details:
                items:
                  description: DetailsPerTemplate defines compliance details and history
                  properties:
                    compliant:
                      description: ComplianceState shows the state of enforcement
                      type: string
                    history:
                      items:
                        description: ComplianceHistory defines compliance details
                          history
                        properties:
                          eventName:
                            type: string
                          lastTimestamp:
                            format: date-time
                            type: string
                          message:
                            type: string
                        type: object
                      type: array
                    templateMeta:
                      type: object
                  type: object
                type: array
              placement:
                items:
                  description: Placement defines the placement results
                  properties:
                    decisions:
                      items:
                        description: PlacementDecision defines the decision made by
                          controller
                        properties:
                          clusterName:
                            type: string
                          clusterNamespace:
                            type: string
                        type: object
                      type: array
                    placementBinding:
                      type: string
                    placementRule:
                      type: string
                  type: object
                type: array
              status:
                items:
                  description: CompliancePerClusterStatus defines compliance per cluster
                    status
                  properties:
                    clustername:
                      type: string
                    clusternamespace:
                      type: string
                    compliant:
                      description: ComplianceState shows the state of enforcement
                      type: string
                  type: object
                type: array
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
status:
  acceptedNames:
    kind: ""
    plural: ""
  conditions: []
  storedVersions: []
