apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: clusterdatabasehosts.hdo.smartive.ch
spec:
  group: hdo.smartive.ch
  names:
    kind: ClusterDatabaseHost
    listKind: ClusterDatabaseHostList
    plural: clusterdatabasehosts
    singular: clusterdatabasehost
  scope: Cluster
  versions:
  - additionalPrinterColumns:
    - description: >-
        Determines the state if the host can be connected to.

        If the connection-check returns an error, an event

        is created with the error message.
      jsonPath: .status.connected
      name: Connected
      priority: 0
      type: boolean
    - description: The hostname of the database.
      jsonPath: .spec.host
      name: Host
      priority: 0
      type: string
    name: v2
    schema:
      openAPIV3Schema:
        properties:
          status:
            properties:
              connected:
                description: >-
                  Determines the state if the host can be connected to.

                  If the connection-check returns an error, an event

                  is created with the error message.
                type: boolean
              lastConnectionCheck:
                description: >-
                  To reduce event creation, the last connection check (timestamp)

                  is stored in this status field.
                format: date-time
                nullable: true
                type: string
            type: object
          spec:
            properties:
              type:
                description: >-
                  Determines the type of the database host.

                  Can be one of: "Postgres", "MySql".
                enum:
                - MySql
                - Postgres
                type: string
              host:
                description: The hostname of the database.
                type: string
              port:
                description: Port of the connection to the database host.
                format: int32
                type: integer
              sslMode:
                description: >-
                  The SSL mode for the connection. Defaults to Disabled.

                  Can be one of "Disabled" and "Required".
                enum:
                - Disabled
                - Required
                type: string
              credentialsSecret:
                description: A reference to a secret that contains a username and a password to connect to the database host.
                properties:
                  name:
                    type: string
                  namespace:
                    type: string
                type: object
              usernameKey:
                description: >-
                  The name of the secret data key that contains

                  the username for the connection (defaults to "username").
                type: string
              passwordKey:
                description: >-
                  The name of the secret data key that contains

                  the password for the connection (defaults to "password").
                type: string
            required:
            - type
            - host
            - port
            - credentialsSecret
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
