apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: audits.security.banzaicloud.com
spec:
  group: security.banzaicloud.com
  names:
    kind: Audit
    plural: audits
    singular: audit
  scope: Cluster
  versions:
    - name: v1alpha1
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              required:
                - releaseName
                - resource
                - image
                - result
                - action
              properties:
                releaseName:
                  type: string
                resource:
                  type: string
                image:
                  type: array
                  items:
                    type: object
                    properties:
                      imageName:
                        type: string
                      imageTag:
                        type: string
                      imageDigest:
                        type: string
                      lastUpdated:
                        type: string
                result:
                  type: array
                  items:
                    type: string
                action:
                  type: string
              type: object
            status:
              properties:
                state:
                  type: string
              type: object
      served: true
      storage: true
      additionalPrinterColumns:
        -   name: ReleaseName
            type: string
            jsonPath: .spec.releaseName
            priority: 1
        -   name: Image
            type: string
            jsonPath: .spec.image[*].imageName
            priority: 2
        -   name: result
            type: string
            jsonPath: .spec.result
            priority: 3
        -   name: action
            type: string
            jsonPath: .spec.action
            priority: 4

