---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: licenses.moon.aerokube.com
spec:
  group: moon.aerokube.com
  names:
    kind: License
    listKind: LicenseList
    plural: licenses
    singular: license
  scope: Cluster
  versions:
  - name: v1
    schema:
      openAPIV3Schema:
        properties:
          apiVersion:
            type: string
          kind:
            type: string
          metadata:
            type: object
          spec:
            properties:
              data:
                type: string
              namespace:
                type: string
                pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
            type: object
          status:
            properties:
              expiration:
                format: date-time
                type: string
              expires:
                type: string
              licensee:
                type: string
              sessions:
                type: integer
              signature:
                type: string
              status:
                type: string
            type: object
        required:
        - spec
        type: object
    served: true
    storage: true
    subresources:
      status: {}
    additionalPrinterColumns:
    - name: Licensee
      type: string
      jsonPath: .status.licensee
    - name: Sessions
      type: string
      jsonPath: .status.sessions
    - name: Expires
      type: string
      jsonPath: .status.expires
    - name: Status
      type: string
      jsonPath: .status.status
    - name: Namespace
      type: string
      jsonPath: .spec.namespace
