apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: grafanaadditionaldatasources.deckhouse.io
  labels:
    heritage: deckhouse
    module: prometheus
    app: prometheus
spec:
  group: deckhouse.io
  scope: Cluster
  names:
    plural: grafanaadditionaldatasources
    singular: grafanaadditionaldatasource
    kind: GrafanaAdditionalDatasource
  preserveUnknownFields: false
  versions:
    - name: v1alpha1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          description: |
            The resource for connecting additional datasources to Grafana.

            The resource parameters are described in details in the [Grafana documentation](https://grafana.com/docs/grafana/latest/administration/provisioning/#example-datasource-config-file).
          required:
            - spec
          properties:
            spec:
              type: object
              required:
                - type
                - access
              properties:
                type:
                  type: string
                  description: Datasource type.
                access:
                  type: string
                  description: Access mode.
                  enum: ["proxy", "direct"]
                url:
                  type: string
                  description: Datasource URL.
                  example: http://localhost:8080
                user:
                  type: string
                  description: Database username.
                database:
                  type: string
                  description: Database name (if used).
                withCredentials:
                  type: boolean
                  description: Enable/disable with credentials headers
                basicAuth:
                  type: boolean
                  description: Enable/disable basic auth.
                basicAuthUser:
                  type: string
                  description: Basic auth username.
                jsonData:
                  type: object
                  x-kubernetes-preserve-unknown-fields: true
                  description: Fields to be converted to JSON and stored in jsonData.
                secureJsonData:
                  type: object
                  x-kubernetes-preserve-unknown-fields: true
                  description: JSON-data object to be saved encrypted.
    - name: v1
      served: true
      storage: false
      schema:
        openAPIV3Schema:
          type: object
          description: |
            The resource for connecting additional datasources to Grafana.

            The resource parameters are described in details in the [Grafana documentation](https://grafana.com/docs/grafana/latest/administration/provisioning/#example-datasource-config-file).
          required:
            - spec
          properties:
            spec:
              type: object
              required:
                - type
                - access
              properties:
                type:
                  type: string
                  description: Datasource type.
                access:
                  type: string
                  description: Access mode.
                  enum: [ "Proxy", "Direct" ]
                url:
                  type: string
                  description: Datasource URL.
                  example: http://localhost:8080
                user:
                  type: string
                  description: Database username.
                database:
                  type: string
                  description: Database name (if used).
                withCredentials:
                  type: boolean
                  description: Enable/disable with credentials headers
                basicAuth:
                  type: boolean
                  description: Enable/disable basic auth.
                basicAuthUser:
                  type: string
                  description: Basic auth username.
                jsonData:
                  type: object
                  x-kubernetes-preserve-unknown-fields: true
                  description: Fields to be converted to JSON and stored in jsonData.
                secureJsonData:
                  type: object
                  x-kubernetes-preserve-unknown-fields: true
                  description: JSON-data object to be saved encrypted.
