apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: databases.app.example.com
spec:
  group: app.example.com
  scope: Namespaced
  names:
    categories: ["all"]
    kind: Database
    shortNames: ["db"]
    singular: database
    plural: databases
  versions:
  - name:  v1alpha1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            properties:
              env:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                    value:
                      type: string
              image:
                type: string
              readOnly:
                type: boolean
              replicas:
                type: integer
              resources:
                type: object
                properties:
                  requests:
                    type: object
                    properties:
                      cpu:
                        type: string
                      memory:
                        type: string
                  limits:
                    type: object
                    properties:
                      cpu:
                        type: string
                      memory:
                        type: string
              role:
                type: string
              tls:
                type: boolean
              tolerations:
                type: array
                items:
                  type: object
                  properties:
                    effect:
                      type: string
                    key:
                      type: string
                    operator:
                      type: string
                    tolerationSeconds:
                      type: integer
                    value:
                      type: string
    subresources:
      status: {}
      scale:
        specReplicasPath: .spec.replicas
        statusReplicasPath: .status.replicas
        labelSelectorPath: .status.labelSelector
    additionalPrinterColumns:
    - name: role
      type: string
      jsonPath: .spec.role
    - name: readOnly
      type: boolean
      jsonPath: .spec.readOnly
