apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: interconnects.interconnectedcloud.github.io
spec:
  group: interconnectedcloud.github.io
  names:
    kind: Interconnect
    listKind: InterconnectList
    plural: interconnects
    singular: interconnect
  scope: Namespaced
  versions:
    - name: v1alpha1
      served: true
      storage: true
      subresources:
        status: {}
      schema:
        # openAPIV3Schema is the schema for validating custom objects.
        openAPIV3Schema:
          type: object
          required:
            - spec
          properties:
            spec:
              properties:
                deploymentPlan:
                  type: object
                  properties:
                    image:
                      type: string
                      description: The image used for the interconnect deployment
                    size:
                      type: integer
                      minimum: 1
                      maximum: 16
                      description: The number of interconnect pods to deploy
                    role:
                      description: The interconnect deployment role
                      type: string
                      enum:
                        - edge
                        - interior
                    placement:
                      description: The interconnect placement plan
                      type: string
                      enum:
                        - Any
                        - Every
                        - AntiAffinity
                        - Node
                    resources:
                      type: object
                      properties:
                        requests:
                          type: object
                          properties:
                            cpu:
                              type: string
                            memory:
                              type: string
                        limits:
                          type: object
                          properties:
                            cpu:
                              type: string
                            memory:
                              type: string
                    issuer:
                      type: string
                      description: The externally provided credentials
                    livenessPort:
                      type: integer
                      description: The liveness probe port number
                    serviceType:
                      type: string
                      description: The type of service to create
                users:
                  type: string
                  description: The name of a secret holding user and password details
                listeners:
                  type: array
                  description: Configuration of each individual interconnect listener
                  minItems: 1
                  items:
                    type: object
                    description: interconnect listener configuration
                    properties:
                      name:
                        type: string
                        description: Listener name
                      host:
                        type: string
                        description: Host name
                      port:
                        type: integer
                        description: Port number
                      routeContainer:
                        type: boolean
                        description: Indicator for a router-broker connection
                      http:
                        type: boolean
                        description: Accept HTTP connections
                      cost:
                        type: integer
                        description: Cost metric for inter router connections
                      linkCapacity:
                        type: integer
                        description: Capacity of links within a connection
                      sslProfile:
                        type: string
                        description: Name of the ssl profile to use
                      role:
                        type: boolean
                      expose:
                        type: boolean
                      authenticatePeer:
                        type: boolean
                        description: Require incoming connections to authenticate
                      saslMechanisms:
                        type: string
                        description: List of space separate SASL mechanisms to offer
                autoLinks:
                  items:
                    properties:
                      address:
                        type: string
                      connection:
                        type: string
                      containerId:
                        type: string
                      direction:
                        type: string
                      externalAddress:
                        type: string
                      phase:
                        format: int32
                        type: integer
                      fallback:
                        type: boolean
                    required:
                      - address
                      - direction
                    type: object
                  type: array
                connectors:
                  type: array
                  description: Configuration of each individual router connnector
                  items:
                    properties:
                      cost:
                        format: int32
                        type: integer
                      linkCapacity:
                        format: int32
                        type: integer
                      host:
                        type: string
                      name:
                        type: string
                      port:
                        format: int32
                        type: integer
                      routeContainer:
                        type: boolean
                      sslProfile:
                        type: string
                      verifyHostname:
                        type: boolean
                        description: Verify hostname of server when using TLS
                    required:
                      - host
                      - port
                    type: object
                interRouterConnectors:
                  type: array
                  description: Configuration of each individual inter router connector
                  items:
                    properties:
                      cost:
                        format: int32
                        type: integer
                      linkCapacity:
                        format: int32
                        type: integer
                      host:
                        type: string
                      name:
                        type: string
                      port:
                        format: int32
                        type: integer
                      routeContainer:
                        type: boolean
                      sslProfile:
                        type: string
                      verifyHostname:
                        type: boolean
                        description: Verify hostname of server when using TLS
                    required:
                      - host
                      - port
                    type: object
                edgeConnectors:
                  type: array
                  description: Configuration of each individual edge uplink connector
                  items:
                    properties:
                      cost:
                        format: int32
                        type: integer
                      linkCapacity:
                        format: int32
                        type: integer
                      host:
                        type: string
                      name:
                        type: string
                      port:
                        format: int32
                        type: integer
                      routeContainer:
                        type: boolean
                        description: Indicator for a router-broker connection
                      sslProfile:
                        type: string
                      verifyHostname:
                        type: boolean
                        description: Verify hostname of server when using TLS
                    required:
                      - host
                      - port
                    type: object
                interRouterListeners:
                  type: array
                  description: Configuration of each individual inter router listener
                  items:
                    type: object
                    description: interconnect listener configuration
                    properties:
                      name:
                        type: string
                        description: Listener name
                      host:
                        type: string
                        description: Host name
                      port:
                        type: integer
                        description: Port number
                      routeContainer:
                        type: boolean
                        description: Indicator for a router-broker connection
                      http:
                        type: boolean
                        description: Accept HTTP connections
                      cost:
                        type: integer
                        description: Cost metric for inter router connections
                      linkCapacity:
                        type: integer
                        description: Capacity of links within a connection
                      sslProfile:
                        type: string
                        description: Name of the ssl profile to use
                      expose:
                        type: boolean
                      authenticatePeer:
                        type: boolean
                        description: Require incoming connections to authenticate
                      saslMechanisms:
                        type: string
                        description: List of space separate SASL mechanisms to offer
                edgeListeners:
                  type: array
                  description: Configuration of each individual inter edge listener
                  items:
                    type: object
                    description: interconnect listener configuration
                    properties:
                      name:
                        type: string
                        description: Listener name
                      host:
                        type: string
                        description: Host name
                      port:
                        type: integer
                        description: Port number
                      routeContainer:
                        type: boolean
                        description: Indicator for a router-broker connection
                      http:
                        type: boolean
                        description: Accept HTTP connections
                      cost:
                        type: integer
                        description: Cost metric for inter router connections
                      linkCapacity:
                        type: integer
                        description: Capacity of links within a connection
                      sslProfile:
                        type: string
                        description: Name of the ssl profile to use
                      expose:
                        type: boolean
                      authenticatePeer:
                        type: boolean
                        description: Require incoming connections to authenticate
                      saslMechanisms:
                        type: string
                        description: List of space separate SASL mechanisms to offer
                addresses:
                  type: array
                  description: Configuration of each address distribution and phasing
                  items:
                    type: object
                    description: address configuration
                    properties:
                      prefix:
                        type: string
                        description: The address prefix for the configured setting
                      pattern:
                        type: string
                        description: A wildcarded pattern for address matching
                      distribution:
                        type: string
                        description: Treatment of traffic associated with the address
                        enum:
                          - balanced
                          - closest
                          - multicast
                      waypoint:
                        type: boolean
                        description: Indicator for waypoint use
                      ingressPhase:
                        type: integer
                        minimum: 0
                        maximum: 9
                        description: Ingress phase override for the address
                      egressPhase:
                        type: integer
                        minimum: 0
                        maximum: 9
                        description: Egress phase override for the address
                      priority:
                        type: integer
                        minimum: 0
                        maximum: 9
                        description: Priority assigned to address for inter router transfer
                      enableFallback:
                        type: boolean
                        description: Indicator for treatment of undeliverable messages
                sslProfiles:
                  items:
                    properties:
                      caCert:
                        type: string
                      ciphers:
                        type: string
                      credentials:
                        type: string
                      generateCredentials:
                        type: boolean
                      generateCaCert:
                        type: boolean
                      name:
                        type: string
                      protocols:
                        type: string
                      mutualAuth:
                        type: boolean
                    type: object
                  type: array
                linkRoutes:
                  items:
                    properties:
                      addExternalPrefix:
                        type: string
                      connection:
                        type: string
                      containerId:
                        type: string
                      direction:
                        type: string
                      pattern:
                        type: string
                      prefix:
                        type: string
                      delExternalPrefix:
                        type: string
                    type: object
                  type: array
                issuer:
                  type: string
              type: object
            status:
              type: object
              required:
              - pods
              - conditions
              properties:
                revNumber:
                  type: string
                pods:
                  items:
                    type: string
                  type: array
                phase:
                  type: string
                conditions:
                  description: Conditions keeps most recent interconnect conditions
                  items:
                    properties:
                      reason:
                        type: string
                      transitionTime:
                        format: date-time
                        type: object
                      type:
                        type: string
                    required:
                    - type
                    type: object
                  type: array
