apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: deckhousereleases.deckhouse.io
  labels:
    heritage: deckhouse
    module: deckhouse
spec:
  group: deckhouse.io
  scope: Cluster
  names:
    plural: deckhousereleases
    singular: deckhouserelease
    kind: DeckhouseRelease
  preserveUnknownFields: false
  versions:
    - name: v1alpha1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          description: |
            Defines the configuration for Deckhouse release.
          required:
            - spec
          properties:
            approved:
              type: boolean
              default: false
              description: |
                Flag for the manual deployment readiness.

                Ignored if the module's update mode is set to `Auto` (`update.mode: Auto`).
            spec:
              type: object
              required:
                - version
              properties:
                version:
                  type: string
                  description: Deckhouse version.
                  example: 'v1.24.20'
            status:
              type: object
              properties:
                phase:
                  type: string
                  enum:
                    - Pending
                    - Deployed
                    - Outdated
                  description: Current status of the release.
                transitionTime:
                  type: string
                  description: Time of release status change.
                approved:
                  type: boolean
                  description: |
                    The status of the release's readiness for deployment. Always true for automatic updates (`update.mode: Auto`).
      subresources:
        status: {}
      additionalPrinterColumns:
        - name: approved
          jsonPath: .status.approved
          type: boolean
          description: 'Is the release approved for deployment.'
        - name: phase
          jsonPath: .status.phase
          type: string
          description: 'Current release status.'
        - name: transitionTime
          jsonPath: .status.transitionTime
          type: date
          format: date-time
          description: 'When the release status was changed.'
