apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: virtualservers.cis.f5.com
spec:
  group: cis.f5.com
  names:
    kind: VirtualServer
    plural: virtualservers
    shortNames:
      - vs
    singular: virtualserver
  scope: Namespaced
  versions:
    -
      name: v1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                host:
                  type: string
                  pattern: '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$'
                httpTraffic:
                  type: string
                snat:
                  type: string
                tlsProfileName:
                  type: string
                rewriteAppRoot:
                  type: string
                  pattern: '^\/([A-z0-9-_+]+\/)*([A-z0-9]+\/?)*$'
                waf:
                  type: string
                  pattern: '^\/([A-z0-9-_+]+\/)*([A-z0-9]+\/?)*$'
                pools:
                  type: array
                  items:
                    type: object
                    properties:
                      path:
                        type: string
                        pattern: '^\/([A-z0-9-_+]+\/)*([A-z0-9]+\/?)*$'
                      service:
                        type: string
                        pattern: '^([A-z0-9-_+])*([A-z0-9])$'
                      nodeMemberLabel:
                        type: string
                        pattern: '^[a-zA-Z0-9][-A-Za-z0-9_.]{0,61}[a-zA-Z0-9]=[a-zA-Z0-9][-A-Za-z0-9_.]{0,61}[a-zA-Z0-9]$'
                      servicePort:
                        type: integer
                        minimum: 1
                        maximum: 65535
                      rewrite:
                        type: string
                        pattern: '^\/([A-z0-9-_+]+\/)*([A-z0-9]+\/?)*$'
                      monitor:
                        type: object
                        properties:
                          type:
                            type: string
                            enum: [http, https]
                          send:
                            type: string
                          recv:
                            type: string
                          interval:
                            type: integer
                          timeout:
                            type: integer
                        required:
                          - type
                          - send
                          - interval
                virtualServerAddress:
                  type: string
                  pattern: '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'
                virtualServerName:
                  type: string
                  pattern: '^([A-z0-9-_+])*([A-z0-9])$'
                virtualServerHTTPPort:
                  type: integer
                  minimum: 1
                  maximum: 65535
                virtualServerHTTPSPort:
                  type: integer
                  minimum: 1
                  maximum: 65535
              required:
                - virtualServerAddress
