apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: configurationproviders.krules.airspot.dev
spec:
  group: krules.airspot.dev
  scope: Namespaced
  names:
    plural: configurationproviders
    singular: configurationprovider
    kind: ConfigurationProvider
    shortNames:
      - configprovider
      - cfgprovider
      - cfgprov
      - cfgp
  versions:
    - name: v1alpha1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            apiVersion:
              type: string
            kind:
              type: string
            metadata:
              type: object
            spec:
              type: object
              properties:
                key:
                  type: string
                appliesTo:
                  type: object
                  x-kubernetes-preserve-unknown-fields: true
                data:
                  type: object
                  x-kubernetes-preserve-unknown-fields: true
                container:
                  type: object
                  x-kubernetes-preserve-unknown-fields: true
              required:
                - key
                - appliesTo
                - data

            status:
              type: object
              properties:
#                services:
#                  type: object
#                  x-kubernetes-preserve-unknown-fields: true
#                  properties:
#                    lastTransitionTime:
#                      type: string
#                    applied:
#                      type: boolean
#                    reason:
#                      type: string
#                  required:
#                    - applied
#                    - lastTransitionTime
                applied_to:
                  type: string
          required:
            - apiVersion
            - kind
            - metadata
            - spec

      subresources:
        status: {}

      additionalPrinterColumns:
      - jsonPath: .status.applied_to
        name: APPLIES
        type: string
#      - jsonPath: .status.services[?(@.applied==false)].reason
#        name: FAILURES
#        type: string