apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: databases.startup.example
  labels:
    core.kbind.io/exported: "true"
spec:
  group: startup.example
  names:
    plural: databases
    singular: database
    kind: Database
    listKind: DatabaseList
  scope: Namespaced
  versions:
    - name: v1
      served: true
      storage: true
      subresources:
        status: {}
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              required: [plan, storageGB]
              properties:
                plan:
                  type: string
                  enum: [starter, growth]
                storageGB:
                  type: integer
                  minimum: 1
            status:
              type: object
              properties:
                phase:
                  type: string
      additionalPrinterColumns:
        - name: Plan
          type: string
          jsonPath: .spec.plan
        - name: StorageGB
          type: integer
          jsonPath: .spec.storageGB
        - name: Phase
          type: string
          jsonPath: .status.phase
---
# Static demo values. No database server is provisioned by this example.
apiVersion: v1
kind: Secret
metadata:
  name: checkout-db-credentials
  namespace: default
  labels:
    databases.startup.example/related: checkout-db
type: Opaque
stringData:
  host: checkout-db.internal.example
  username: checkout
  password: local-demo-only
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: checkout-db-settings
  namespace: default
  labels:
    databases.startup.example/related: checkout-db
data:
  max_connections: "20"
