apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: databases.postgresql.baiju.dev
  annotations:
    service.binding/dbName: 'path={.spec.dbName}'
    service.binding/db.host: 'path={.status.dbConfigMap},objectType=ConfigMap'
    service.binding/db.name: 'path={.status.dbConfigMap},objectType=ConfigMap'
    service.binding/db.password: 'path={.status.dbConfigMap},objectType=ConfigMap'
    service.binding/db.port: 'path={.status.dbConfigMap},objectType=ConfigMap'
    service.binding/db.user: 'path={.status.dbConfigMap},objectType=ConfigMap'
    service.binding/dbConnectionIP: 'path={.status.dbConnectionIP}'
    service.binding/dbConnectionPort: 'path={.status.dbConnectionPort}'
    service.binding/user: 'path={.status.dbCredentials},objectType=Secret'
    service.binding/password: 'path={.status.dbCredentials},objectType=Secret'
spec:
  group: postgresql.baiju.dev
  names:
    kind: Database
    listKind: DatabaseList
    plural: databases
    singular: database
    shortNames:
      - db
  scope: Namespaced
  versions:
  - name: v1alpha1
    schema:
      openAPIV3Schema:
        description: Database is the Schema for the databases API
        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://git.k8s.io/community/contributors/devel/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://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
            type: string
          metadata:
            type: object
          spec:
            description: DatabaseSpec defines the desired state of Database
            properties:
              dbName:
                type: string
              image:
                description: Location of the PostgreSQL container image. e.g., docker.io/postgres
                type: string
              imageName:
                description: Name of the PostgreSQL container image. e.g., postgres
                type: string
            required:
            - dbName
            - image
            - imageName
            type: object
          status:
            description: DatabaseStatus defines the observed state of Database
            properties:
              dbConfigMap:
                type: string
              dbConnectionIP:
                type: string
              dbConnectionPort:
                format: int64
                type: integer
              dbCredentials:
                description: 'INSERT ADDITIONAL STATUS FIELD - define observed state
                  of cluster Important: Run "operator-sdk generate k8s" to regenerate
                  code after modifying this file Add custom validation using kubebuilder
                  tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html'
                type: string
              dbName:
                type: string
            required:
            - dbConfigMap
            - dbConnectionIP
            - dbConnectionPort
            - dbCredentials
            - dbName
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
