apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: smartgateways.smartgateway.infra.watch
spec:
  conversion:
    strategy: None
  group: smartgateway.infra.watch
  names:
    kind: SmartGateway
    listKind: SmartGatewayList
    plural: smartgateways
    singular: smartgateway
    shortNames:
    - sg
  scope: Namespaced
  versions:
  - name: v2
    subresources:
      status: {}
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        description: SmartGateway represents an instance of the Smart Gateway used with Service Telemetry Framework.
        type: object
        properties:
          apiVersion:
            description: 'APIVersion defines the versioned schema of this representation
              of an object. Servers should convert recognized schemas to the latest
              internal value, and may reject unrecognized values. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#resources'
            type: string
          kind:
            description: 'Kind is a string value representing the REST resource this
              object represents. Servers may infer this from the endpoint the client
              submits requests to. Cannot be updated. In CamelCase. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
            type: string
          metadata:
            type: object
          spec:
            description: 'SmartGatewaySpec is a specification of the desired behavior
              of the Smartgateway deployment. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status'
            properties:
              pluginDir:
                description: Plugin directory path.
                type: string
              logLevel:
                description: Log level for sg-core.
                type: string
              blockEventBus:
                description: Enables event bus blocking for sg-core. Defaults to false.
                type: boolean
              size:
                description: Number of Smart Gateway instances to deploy. This number should always be a value of 1.
                type: integer
              handleErrors:
                description: Tell handlers to send errors to event bus.
                type: boolean
              bridgeContainerImagePath:
                description: Registry path to bridge container image.
                type: string
              coreContainerImagePath:
                description: Registry path to the sg-core container image.
                type: string
              bridge:
                description: AMQP1 bridge configuration options
                properties:
                  enabled:
                    description: Whether to enable the bridge for connection to AMQP. Defaults to true.
                    type: boolean
                  amqpBlock:
                    description: Enables amqp blocking for sg-bridge. Defaults to false.
                    type: boolean
                  amqpUrl:
                    description: URL of the AMQP endpoint. Format of ^amqp://(([a-z]+)(:([a-z]+))*@)*([a-zA-Z_0-9.-]+)(:([0-9]+))*(.+)$. Defaults to amqp://127.0.0.1:5672/collectd/telemetry.
                    type: string
                    pattern: "^amqp://(([a-z]+)(:([a-z]+))*@)*([a-zA-Z_0-9.-]+)(:([0-9]+))*(.+)$"
                  unixSocketPath:
                    description: Connect to gateway with unix socket. Defaults to /tmp with 'smartgateway' appended as the final path, e.g. /tmp/smartgateway.
                    type: string
                  inetTarget:
                    description: Connect to gateway with inet socket. Defaults to 127.0.0.1:30000.
                    type: string
                  socketBlock:
                    description: Outgoing socket connection will block. Defaults to true.
                    type: boolean
                  ringBufferCount:
                    description: Number of message buffers between AMQP and Outgoing. Defaults to 15000.
                    type: integer
                  ringBufferSize:
                    description: Size of a message buffer between AMQP and Outgoing. Defaults to 2048.
                    type: integer
                  statsPeriod:
                    description: How often to print stats, 0 for no stats. Value is in seconds. Defaults to 60.
                    type: integer
                  containerIdPattern:
                    description: AMQP container ID (should be unique). Defaults to "sa-%x".
                    type: string
                  stopCount:
                    description: Number of AMQP mesg to rcv before exit, 0 for continous. Defaults to 0.
                    type: integer
                  verbose:
                    description: Print extra info, multiple instance increase verbosity. Defaults to true.
                    type: boolean
                type: object
              services:
                description: Services that should be created for this Smart Gateway
                items:
                  properties:
                    name:
                      description: Postfix of the service name
                      type: string
                    ports:
                      description: Ports to create for this service
                      items:
                        properties:
                          name:
                            description: Port name
                            type: string
                          port:
                            description: Port number to expose
                            type: integer
                          targetPort:
                            description: Target port for service
                            type: integer
                          protocol:
                            description: Protocol for this service
                            type: string
                        type: object
                      type: array
                  type: object
                type: array
              transports:
                description: Transports to enable.
                items:
                  properties:
                    name:
                      description: Name of the transport to load.
                      type: string
                    handlers:
                      description: List of handler plugins to load for this transport.
                      items:
                        properties:
                          name:
                            description: Name of the handler to load.
                            type: string
                          config:
                            description: Free form configuration for handler.
                            type: string
                        type: object
                      type: array
                    config:
                      description: Free form configuration for plugins.
                      type: string
                  type: object
                type: array
              applications:
                description: Applications to load.
                items:
                  properties:
                    name:
                      description: Name of the application.
                      type: string
                    config:
                      description: Free form configuration for the application.
                      type: string
                  type: object
                type: array
            type: object
          status:
            description: Status results of an instance of Smart Gateway
            properties:
              conditions:
                description: The resulting conditions when a Smart Gateway is instantiated
                items:
                  properties:
                    status:
                      type: string
                    type:
                      type: string
                    reason:
                      type: string
                    lastTransitionTime:
                      type: string
                  type: object
                type: array
            type: object
