apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: kafkaconnections.rhoas.redhat.com
  annotations:
    service.binding/bootstrapServers: 'path={.status.bootstrapServerHost}'
    ## SASL PLAIN credentials
    service.binding/user: >-
      path={.status.serviceAccountSecretName},objectType=Secret,sourceKey=client-id
    service.binding/password: >-
      path={.status.serviceAccountSecretName},objectType=Secret,sourceKey=client-secret
    ## SASL OAUTH BEARER credentials
    service.binding/clientId: >-
           path={.status.serviceAccountSecretName},objectType=Secret,sourceKey=client-id
    service.binding/clientSecret: >-
      path={.status.serviceAccountSecretName},objectType=Secret,sourceKey=client-secret
    ## Additional binding metadata required for Quarkus
    service.binding/saslMechanism: 'path={.status.metadata.saslMechanism}'
    service.binding/securityProtocol: 'path={.status.metadata.securityProtocol}'
    service.binding/type: 'path={.status.metadata.type}'
    service.binding/provider: 'path={.status.metadata.provider}'
spec:
  group: rhoas.redhat.com
  names:
    kind: KafkaConnection
    plural: kafkaconnections
    shortNames:
    - akc
    singular: kafkaconnection
  scope: Namespaced
  versions:
  - name: v1alpha1
    served: true
    storage: true
    subresources:
      status: {}
    schema:
      openAPIV3Schema:
        properties:
          spec:
            properties:
              accessTokenSecretName:
                type: string
              kafkaId:
                type: string
              credentials:
                properties:
                  serviceAccountSecretName:
                    type: string
                type: object
            type: object
            ## temporary required to workaround lack of scheduling issue with the operator SDK
            x-kubernetes-preserve-unknown-fields: true
          status:
            properties:
              message:
                nullable: true
                type: string
              metadata:
                nullable: true
                type: object
                x-kubernetes-preserve-unknown-fields: true
              updated:
                nullable: true
                type: string
              bootstrapServerHost:
                nullable: true
                type: string
              serviceAccountSecretName:
                nullable: true
                type: string
              conditions:
                type: array
                items:
                  type: object
                  properties:
                    type:
                      type: string
                    reason:
                      type: string
                    message:
                      type: string
                    status:
                      type: string
                    lastTransitionTime:
                      type: string
                    lastTransitionGeneration:
                      type: integer          
                      format: int64
                      nullable: true                                   
            type: object
        type: object
