apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: loaddistributionpolicies.appgw.ingress.azure.io
spec:
  group: appgw.ingress.azure.io
  scope: Namespaced
  names:
    kind: LoadDistributionPolicy
    plural: loaddistributionpolicies
    singular: loaddistributionpolicy
    shortNames:
      - agldp
  versions:
    - name: v1beta1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                targets:
                  minItems: 1
                  description: "An array of services that contains information for how the service should be used for load balancing in Application Gateway"
                  type: array
                  items:
                    type: object
                    properties:
                      backend:
                        type: object
                        properties:
                          service:
                            description: "Service references a Service as a Backend."
                            type: object
                            properties:
                              name:
                                type: string
                                description: "Name is the referenced service. The service must exist in the same namespace as the Ingress object."
                              port:
                                type: object
                                description: "Port of the referenced service. A port name or port number"
                                properties:
                                  number:
                                    type: integer
                                  name:
                                    type: string
                      weight:
                        description: "Weight specifies the proportion of HTTP requests forwarded to the backend."
                        type: integer
                        default: 1
                        minimum: 0
                        maximum: 1000
                      role:
                        description: "Specifies whether a server should be active or passive. Passive backends will receive HTTP requests only when all active backends are marked unhealthy by the Application Gateway's heath probe."
                        type: string
                        default: "active"
                        pattern: "^active$|^passive$"