apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: servicetelemetrys.infra.watch
spec:
  group: infra.watch
  names:
    plural: servicetelemetrys
    singular: servicetelemetry
    kind: ServiceTelemetry
    listKind: ServiceTelemetryList
    shortNames:
    - stf
  scope: Namespaced
  version: v1beta1
  subresources:
    status: {}
  versions:
  - name: v1beta1
    served: true
    storage: true
  validation:
    openAPIV3Schema:
      properties:
        alerting:
          properties:
            enabled:
              description: Whether to enable alerting functionality
              type: boolean
            alertmanager:
              description: Alertmanager configuration
              properties:
                receivers:
                  properties:
                    snmpTraps:
                      properties:
                        enabled:
                          description: Deploy container to send snmp traps
                          type: boolean
                        target:
                          description: Target address for SNMP traps to send to
                          type: string
                      type: object
                  type: object
                storage:
                  properties:
                    strategy:
                      description: Storage strategy. One of 'ephemeral' or 'persistent'. Persistent storage must be made available by the platform.
                      type: string
                      enum:
                        - ephemeral
                        - persistent
                    persistent:
                      properties:
                        storageClass:
                          description: Storage class name used for Alertmanager PVC
                          type: string
                        storageSelector:
                          description: Storage selector definition for Alertmanager
                          type: string
                        pvcStorageRequest:
                          description: PVC storage requested size for Alertmanager
                          type: string
                      type: object
                  type: object
              type: object
          type: object
        highAvailability:
          description: High availability related configuration
          properties:
            enabled:
              description: Enable high availability globally for Service Telemetry
              type: boolean
          type: object
        backends:
          description: Backend storage configuration
          properties:
            metrics:
              description: Metrics related backend configuration.
              properties:
                prometheus:
                  description: Metrics storage backend Prometheus
                  properties:
                    enabled:
                      description: Enable Prometheus as a storage backend for metrics
                      type: boolean
                    scrapeInterval:
                      description: How often Prometheus should be configured to scrape this endpoint. Value in seconds.
                      type: string
                    storage:
                      description: Metrics storage configuration for Prometheus
                      properties:
                        strategy:
                          description: Storage strategy. One of 'ephemeral' or 'persistent'. Persistent storage must be made available by the platform.
                          type: string
                          enum:
                            - ephemeral
                            - persistent
                        retention:
                          description: Time duration Prometheus shall retain data for. Default
                            is '24h', and must match the regular expression `[0-9]+(ms|s|m|h|d|w|y)`
                            (milliseconds seconds minutes hours days weeks years).
                          type: string
                          pattern: '^[0-9]+(ms|s|m|h|d|w|y)$'
                        persistent:
                          description: Persistent storage configuration for Prometheus
                          properties:
                            storageClass:
                              description: Storage class name used for Prometheus PVC
                              type: string
                            storageSelector:
                              description: Storage selector definition for Prometheus
                              type: string
                            pvcStorageRequest:
                              description: PVC storage requested size for Prometheus
                              type: string
                          type: object
                      type: object
                  type: object
              type: object
            events:
              description: Events related backend configuration.
              properties:
                elasticsearch:
                  description: Events storage backend ElasticSearch
                  properties:
                    enabled:
                      description: Enable ElasticSearch as a storage backend for events
                      type: boolean
                    nodeCount:
                      description: Elasticsearch node count
                      type: string
                    storage:
                      description: Events storage configuration for ElasticSearch
                      properties:
                        strategy:
                          description: Storage strategy. One of 'ephemeral' or 'persistent'. Persistent storage must be made available by the platform.
                          type: string
                        persistent:
                          description: Persistent storage configuration for ElasticSearch
                          properties:
                            storageClass:
                              description: Storage class name used for ElasticSearch PVC
                              type: string
                            storageSelector:
                              description: Storage selector definition for ElasticSearch
                              type: string
                            pvcStorageRequest:
                              description: How much storage space to request in the PVC
                              type: string
                          type: object
                      type: object
                  type: object
              type: object
          type: object
        transports:
          description: Data transport configuration
          properties:
            qdr:
              description: QDR configuration for data transport
              properties:
                enabled:
                  description: Enable QDR data transort
                  type: boolean
                web:
                  description: QDR web configuration
                  properties:
                    enabled:
                      description: Enable web interface for QDR
                      type: boolean
                  type: object
              type: object
          type: object
        graphing:
          description: Graphing configuration
          properties:
            enabled:
              description: Whether the Service Telemetry Operator should deploy a graphing components and setup available datasources. If enabled will use default graphing components.
              type: boolean
            grafana:
              description: Grafana related configuration
              properties:
                disableSignoutMenu:
                  description: Whether to disable the Grafana signout menu
                  type: boolean
                ingressEnabled:
                  description: Enable ingress access to Grafana
                  type: boolean
                adminPassword:
                  description: Grafana admin password
                  type: string
                adminUser:
                  description: Grafana admin user
                  type: string
              type: object
          type: object
        cloudsRemoveOnMissing:
          description: If cloud object is missing from list on subsequent runs then delete the corresponding SmartGateway object. Default is 'true'.
          type: boolean
        clouds:
          description: A list of cloud objects
          items:
            properties:
              name:
                description: Name of the cloud object
                type: string
              metrics:
                description: Metrics related configuration for this cloud object.
                properties:
                  collectors:
                    description: List of available metrics collectors for this cloud object
                    items:
                      properties:
                        collectorType:
                          description: Set the collector type, value of 'ceilometer' or 'collectd'.
                          type: string
                        subscriptionAddress:
                          description: Address to subscribe on the data transport to receive telemetry.
                          type: string
                        debugEnabled:
                          description: Enable console debugging. Default is 'false'.
                          type: boolean
                      type: object
                    type: array
                type: object
              events:
                description: Events related configuration for this cloud object.
                properties:
                  collectors:
                    description: List of available events collectors for this cloud object.
                    items:
                      properties:
                        collectorType:
                          description: Set the collector type, value of 'ceilometer' or 'collectd'.
                          type: string
                          enum:
                            - ceilometer
                            - collectd
                        subscriptionAddress:
                          description: Address to subscribe on the data transport to receive notifications.
                          type: string
                        debugEnabled:
                          description: Enable console debugging. Default is 'false'.
                          type: boolean
                      type: object
                    type: array
                type: object
            type: object
          type: array
      type: object
    status:
      description: Status results of an instance of Service Telemetry
      properties:
        conditions:
          description: The resulting conditions when a Service Telemetry is instantiated
          items:
            properties:
              status:
                type: string
              type:
                type: string
              reason:
                type: string
              lastTransitionTime:
                type: string
            type: object
          type: array
        ephemeralStorageEnabled:
          description: Whether ephemeral storage is enabled and a warning should be provided
          properties:
            lastTransitionTime:
              type: string
            message:
              type: string
            status:
              type: boolean
          type: object
        type: object
      type: object
