apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.16.3
    helm.sh/resource-policy: keep
  name: workflows.tinkerbell.org
spec:
  group: tinkerbell.org
  names:
    categories:
      - tinkerbell
    kind: Workflow
    listKind: WorkflowList
    plural: workflows
    shortNames:
      - wf
    singular: workflow
  scope: Namespaced
  versions:
    - additionalPrinterColumns:
        - jsonPath: .spec.templateRef
          name: Template
          type: string
        - jsonPath: .status.state
          name: State
          type: string
        - jsonPath: .status.currentAction
          name: Current-Action
          type: string
        - jsonPath: .status.templateRending
          name: Template-Rendering
          type: string
      name: v1alpha1
      schema:
        openAPIV3Schema:
          description: Workflow is the Schema for the Workflows API.
          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: WorkflowSpec defines the desired state of Workflow.
              properties:
                bootOptions:
                  description: BootOptions are options that control the booting of Hardware.
                  properties:
                    bootMode:
                      description: BootMode is the type of booting that will be done.
                      enum:
                        - netboot
                        - iso
                      type: string
                    isoURL:
                      description: |-
                        ISOURL is the URL of the ISO that will be one-time booted. When this field is set, the controller will create a job.bmc.tinkerbell.org object
                        for getting the associated hardware into a CDROM booting state.
                        A HardwareRef that contains a spec.BmcRef must be provided.
                      format: url
                      type: string
                    toggleAllowNetboot:
                      description: |-
                        ToggleAllowNetboot indicates whether the controller should toggle the field in the associated hardware for allowing PXE booting.
                        This will be enabled before a Workflow is executed and disabled after the Workflow has completed successfully.
                        A HardwareRef must be provided.
                      type: boolean
                  type: object
                hardwareMap:
                  additionalProperties:
                    type: string
                  description: A mapping of template devices to hadware mac addresses.
                  type: object
                hardwareRef:
                  description: Name of the Hardware associated with this workflow.
                  type: string
                templateRef:
                  description: Name of the Template associated with this workflow.
                  type: string
              type: object
            status:
              description: WorkflowStatus defines the observed state of a Workflow.
              properties:
                bootOptions:
                  description: BootOptions holds the state of any boot options.
                  properties:
                    allowNetboot:
                      description: AllowNetboot holds the state of the the controller's interactions with the allowPXE field in a Hardware object.
                      properties:
                        toggledFalse:
                          type: boolean
                        toggledTrue:
                          type: boolean
                      type: object
                    jobs:
                      additionalProperties:
                        description: JobStatus holds the state of a specific job.bmc.tinkerbell.org object created.
                        properties:
                          complete:
                            description: Complete indicates whether the created job.bmc.tinkerbell.org has reported its conditions as complete.
                            type: boolean
                          existingJobDeleted:
                            description: |-
                              ExistingJobDeleted indicates whether any existing job.bmc.tinkerbell.org was deleted.
                              The name of each job.bmc.tinkerbell.org object created by the controller is the same, so only one can exist at a time.
                              Using the same name was chosen so that there is only ever 1 job.bmc.tinkerbell.org per Hardware/Machine.bmc.tinkerbell.org.
                              This makes clean up easier and we dont just orphan jobs every time.
                            type: boolean
                          uid:
                            description: |-
                              UID is the UID of the job.bmc.tinkerbell.org object associated with this workflow.
                              This is used to uniquely identify the job.bmc.tinkerbell.org object, as
                              all objects for a specific Hardware/Machine.bmc.tinkerbell.org are created with the same name.
                            type: string
                        type: object
                      description: Jobs holds the state of any job.bmc.tinkerbell.org objects created.
                      type: object
                  type: object
                conditions:
                  description: Conditions are the latest available observations of an object's current state.
                  items:
                    description: JobCondition describes current state of a job.
                    properties:
                      message:
                        description: Message is a human readable message indicating details about last transition.
                        type: string
                      reason:
                        description: Reason is a (brief) reason for the condition's last transition.
                        type: string
                      status:
                        description: Status of the condition, one of True, False, Unknown.
                        type: string
                      time:
                        description: Time when the condition was created.
                        format: date-time
                        type: string
                      type:
                        description: Type of job condition, Complete or Failed.
                        type: string
                    required:
                      - status
                      - type
                    type: object
                  type: array
                  x-kubernetes-list-type: atomic
                currentAction:
                  description: CurrentAction is the action that is currently in the running state.
                  type: string
                globalTimeout:
                  description: GlobalTimeout represents the max execution time.
                  format: int64
                  type: integer
                state:
                  description: State is the current overall state of the Workflow.
                  type: string
                tasks:
                  description: Tasks are the tasks to be run by the worker(s).
                  items:
                    description: Task represents a series of actions to be completed by a worker.
                    properties:
                      actions:
                        items:
                          description: Action represents a workflow action.
                          properties:
                            command:
                              items:
                                type: string
                              type: array
                            environment:
                              additionalProperties:
                                type: string
                              type: object
                            image:
                              type: string
                            message:
                              type: string
                            name:
                              type: string
                            pid:
                              type: string
                            seconds:
                              format: int64
                              type: integer
                            startedAt:
                              format: date-time
                              type: string
                            status:
                              type: string
                            timeout:
                              format: int64
                              type: integer
                            volumes:
                              items:
                                type: string
                              type: array
                          type: object
                        type: array
                      environment:
                        additionalProperties:
                          type: string
                        type: object
                      name:
                        type: string
                      volumes:
                        items:
                          type: string
                        type: array
                      worker:
                        type: string
                    required:
                      - actions
                      - name
                      - worker
                    type: object
                  type: array
                templateRending:
                  description: |-
                    TemplateRendering indicates whether the template was rendered successfully.
                    Possible values are "successful" or "failed" or "unknown".
                  type: string
              type: object
          type: object
      served: true
      storage: true
      subresources:
        status: {}
