apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: configs.apisix.apache.org
spec:
  conversion:
    strategy: None
  group: apisix.apache.org
  scope: Cluster
  names:
    kind: Config
    listKind: ConfigList
    plural: configs
    singular: config
  versions:
    - name: v1alpha1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            data:
              type: object
              properties:
                global_rules:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        pattern: ^[a-zA-Z0-9-.]{1,64}$
                      plugins:
                        type: object
                        additionalProperties:
                          x-kubernetes-preserve-unknown-fields: true
                    required: [ id, plugins ]
                plugins:
                  type: array
                  items:
                    type: object
                    properies:
                      name:
                        type: string
                      stream:
                        type: boolean
                        default: false
                    required: [ name ]
                consumers:
                  type: array
                  items:
                    type: object
                    properties:
                      username:
                        type: string
                        pattern: ^[a-zA-Z0-9_]+$
                        minLength: 1
                        maxLength: 32
                      plugins:
                        type: object
                        additionalProperties:
                          x-kubernetes-preserve-unknown-fields: true
                      labels:
                        type: object
                        additionalProperties:
                          x-kubernetes-preserve-unknown-fields: true
                    required: [ username ]
                plugin_metadata:
                  type: array
                  items:
                    type: object
                    additionalProperties:
                      x-kubernetes-preserve-unknown-fields: true
          required: [ data ]