---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: rails-apps.jgaskins.dev
spec:
  group: jgaskins.dev
  versions:
    - name: v1beta1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                image:
                  type: string
                image_pull_policy:
                  type: string
                  default: "IfNotPresent"
                env:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                      value:
                        type: string
                        nullable: true
                      valueFrom:
                        type: object
                        nullable: true
                        properties:
                          configMapKeyRef:
                            type: object
                            nullable: true
                            properties:
                              name:
                                type: string
                              key:
                                type: string
                          secretKeyRef:
                            type: object
                            nullable: true
                            properties:
                              name:
                                type: string
                              key:
                                type: string
                entrypoints:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                      command:
                        type: array
                        items:
                          type: string
                      domain:
                        type: string
                        nullable: true
                      port:
                        type: integer
                        nullable: true
                      replicas:
                        type: integer
                        default: 1
                    required:
                      - name
                      - command
                before_update:
                  type: object
                  properties:
                    command:
                      type: array
                      items:
                        type: string
                before_create:
                  type: object
                  properties:
                    command:
                      type: array
                      items:
                        type: string

              required:
                - image
                - env
                - entrypoints
  scope: Namespaced
  names:
    plural: rails-apps
    singular: rails-app
    kind: RailsApp
    shortNames: []
