apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: globaldeploymentpolicies.amko.vmware.com
spec:
  conversion:
    strategy: None
  group: amko.vmware.com
  names:
    kind: GlobalDeploymentPolicy
    listKind: GlobalDeploymentPolicyList
    plural: globaldeploymentpolicies
    shortNames:
    - gdp
    singular: globaldeploymentpolicy
  scope: Namespaced
  versions:
  - name: v1alpha2
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            properties:
              matchClusters:
                type: array
                items:
                  type: object
                  properties:
                    cluster:
                      type: string
                    syncVipOnly:
                      type: boolean
              matchRules:
                type: object
                properties:
                  appSelector:
                    type: object
                    properties:
                      label:
                        additionalProperties:
                          type: string
                        type: object
                  namespaceSelector:
                    type: object
                    properties:
                      label:
                        additionalProperties:
                          type: string
                        type: object
              # gslbAlgorithm:
              #   type: string
              #   enum:
              healthMonitorRefs:
                type: array
                items:
                  type: string
              healthMonitorTemplate:
                type: string
              ttl:
                type: integer
                minimum: 0
                maximum: 86400
              sitePersistenceRef:
                type: string
              poolAlgorithmSettings:
                description: "Algorithm settings to be specified for Gslb Service pool"
                type: object
                properties:
                  lbAlgorithm:
                    description: Name of the algorithm to be used
                    enum:
                    - GSLB_ALGORITHM_CONSISTENT_HASH
                    - GSLB_ALGORITHM_GEO
                    - GSLB_ALGORITHM_ROUND_ROBIN
                    - GSLB_ALGORITHM_TOPOLOGY
                    type: string
                  hashMask:
                    description: Mask required for Consistent Hash
                    type: integer
                    maximum: 31
                    minimum: 1
                  geoFallback:
                    description: Fallback algorithm to be specified for Geo based algorithm
                    type: object
                    properties:
                      lbAlgorithm:
                        description: Algorithm name for fallback
                        type: string
                        enum:
                        - GSLB_ALGORITHM_ROUND_ROBIN
                        - GSLB_ALGORITHM_CONSISTENT_HASH
                      hashMask:
                        description: Hash mask for ConsistentHash as the fallback algorithm
                        type: integer
                        maximum: 31
                        minimum: 1
              trafficSplit:
                items:
                  type: object
                  properties:
                    cluster:
                      type: string
                    weight:
                      type: integer
                      minimum : 1
                      maximum: 20
                    priority:
                      description: "Based on the given priority, this member will be grouped in a pool"
                      type: integer
                      minimum: 0
                      maximum: 100
                      default: 10
                type: array
          status:
            type: "object"
            properties:
              errorStatus:
                type: "string"
        required:
        - spec
    served: true
    storage: true
