{{- if .Values.installCRDs }}
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    {{- with .Values.crds.annotations }}
    {{- toYaml . | nindent 4}}
    {{- end }}
    {{- if and .Values.crds.conversion.enabled .Values.webhook.certManager.enabled .Values.webhook.certManager.addInjectorAnnotations }}
    cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ include "external-secrets.fullname" . }}-webhook
    {{- end }}
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    external-secrets.io/component: controller
  name: generatorstates.generators.external-secrets.io
spec:
  group: generators.external-secrets.io
  names:
    categories:
      - external-secrets
      - external-secrets-generators
    kind: GeneratorState
    listKind: GeneratorStateList
    plural: generatorstates
    shortNames:
      - gs
    singular: generatorstate
  scope: Namespaced
  versions:
    - additionalPrinterColumns:
        - jsonPath: .spec.garbageCollectionDeadline
          name: GC Deadline
          type: string
        - jsonPath: .metadata.creationTimestamp
          name: Age
          type: date
      name: v1alpha1
      schema:
        openAPIV3Schema:
          description: GeneratorState represents the state created and managed by a generator resource.
          properties:
            apiVersion:
              description: |-
                APIVersion defines the versioned schema of this representation of an object.
                Servers should convert recognized schemas to the latest internal value, and
                may reject unrecognized values.
                More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
              type: string
            kind:
              description: |-
                Kind is a string value representing the REST resource this object represents.
                Servers may infer this from the endpoint the client submits requests to.
                Cannot be updated.
                In CamelCase.
                More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
              type: string
            metadata:
              type: object
            spec:
              description: GeneratorStateSpec defines the desired state of a generator state resource.
              properties:
                garbageCollectionDeadline:
                  description: |-
                    GarbageCollectionDeadline is the time after which the generator state
                    will be deleted.
                    It is set by the controller which creates the generator state and
                    can be set configured by the user.
                    If the garbage collection deadline is not set the generator state will not be deleted.
                  format: date-time
                  type: string
                resource:
                  description: |-
                    Resource is the generator manifest that produced the state.
                    It is a snapshot of the generator manifest at the time the state was produced.
                    This manifest will be used to delete the resource. Any configuration that is referenced
                    in the manifest should be available at the time of garbage collection. If that is not the case deletion will
                    be blocked by a finalizer.
                  x-kubernetes-preserve-unknown-fields: true
                state:
                  description: State is the state that was produced by the generator implementation.
                  x-kubernetes-preserve-unknown-fields: true
              required:
                - resource
                - state
              type: object
            status:
              description: GeneratorStateStatus defines the observed state of a generator state resource.
              properties:
                conditions:
                  items:
                    description: GeneratorStateStatusCondition represents the observed condition of a generator state.
                    properties:
                      lastTransitionTime:
                        format: date-time
                        type: string
                      message:
                        type: string
                      reason:
                        type: string
                      status:
                        type: string
                      type:
                        description: GeneratorStateConditionType represents the type of condition for a generator state.
                        type: string
                    required:
                      - status
                      - type
                    type: object
                  type: array
              type: object
          type: object
      served: true
      storage: true
      subresources: {}
{{- end }}
