apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  # 名字必需与下面的 spec 字段匹配，并且格式为 '<名称的复数形式>.<组名>'
  name: apintoglobalsettings.apinto.com
spec:
  # 组名称，用于 REST API: /apis/<组>/<版本>
  group: apinto.com
  # 可以是 Namespaced 或 Cluster
  scope: Namespaced
  names:
    plural: apintoglobalsettings
    singular: apintoglobalsetting
    kind: ApintoGlobalSetting
    shortNames:
      - ags
  # 列举此 CustomResourceDefinition 所支持的版本
  versions:
    - name: v1beta
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                plugins:
                  type: array
                  items:
                    type: object
                    required: ["id","name","type","status"]
                    properties:
                      id:
                        type: string
                        minLength: 1
                      name:
                        type: string
                        minLength: 1
                      "type":
                        type: string
                        enum: ["service","router","upstream"]
                      status:
                        type: string
                        default: disable
                        enum: ["disable","enable","global"]
                      config:
                        type: object
                        x-kubernetes-preserve-unknown-fields: true