---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: websites.spaship.io
  labels:
    spaship: operator
spec:
  group: spaship.io
  scope: Namespaced
  names:
    kind: Website
    singular: website
    plural: websites
  versions:
    - name: v1
      served: true
      storage: true
      subresources:
        status: {}
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                gitUrl:
                  type: string
                branch:
                  type: string
                dir:
                  type: string
                  default: .
                sslVerify:
                  type: boolean
                  default: true
                previews:
                  type: boolean
                  default: false
                gitApiToken:
                  type: string
                secretToken:
                  type: string
                displayName:
                  type: string
                envs:
                  type: object
                  properties:
                    included:
                      type: array
                      items:
                        type: string
                    excluded:
                      type: array
                      items:
                        type: string
              required:
                - gitUrl
                - secretToken
            status:
              type: object
              properties:
                status:
                  type: string
                  default: "Pending"
                envs:
                  type: array
                  items:
                    type: string
                message:
                  type: string
                updated:
                  type: string
      additionalPrinterColumns:
        - name: Git URL
          type: string
          description: Website Git URL
          jsonPath: .spec.gitUrl
        - name: Branch
          type: string
          description: Git branch
          jsonPath: .spec.branch
        - name: Dir
          type: string
          description: Sub directory within git repo
          jsonPath: .spec.dir
        - name: SSL Verify
          type: string
          description: Performs SSL verification
          jsonPath: .spec.sslVerify
        - name: Environments
          type: string
          description: Environments with info about ready containers
          jsonPath: .status.envs
        - name: Status
          type: string
          description: Status
          jsonPath: .status.status
        - name: Updated
          type: string
          description: Last Website Update
          jsonPath: .status.updated
        - name: Message
          type: string
          description: Status message
          jsonPath: .status.message
