apiVersion: xl/v2
kind: Blueprint
metadata:
  name: XL OP
  description: |
    This blueprint deploys Digital.ai Deploy operator, Digital.ai Release operator, and XL-k8s-foundation into an existing Kubernetes installation (local single-node Kubernetes, on-premises multi-node Kubernetes cluster, Google Kubernetes Engine cluster, or Amazon EKS cluster).
  author: digitalai
  version: 1.0
spec:
  parameters:
    - name: K8sSetup
      type: Select
      prompt: "Select the Kubernetes setup where the Digital.ai Devops Platform will be installed, updated or cleaned:"
      options:
        - label: Openshift
          value: Openshift
        - label: AWS EKS
          value: AWSEKS
        - label: Plain multi-node K8s cluster
          value: PlainK8s
        - label: Azure AKS
          value: AzureAKS
        - label: Google Kubernetes Engine
          value: GoogleGKE
      saveInXlvals: true
      description: "The flavour of Kubernetes to deploy or undeploy the Digital.ai Devops Platform to. Only the listed options are supported."

    - name: OsType
      type: Input
      prompt: "The type of operating system where the xl command is running:"
      value: !expr "os('_operatingsystem')"
      saveInXlvals: true
      ignoreIfSkipped: true

    - name: ProcessType
      type: Input
      overrideDefault: true
      prompt: "The type of process command is running:"
      saveInXlvals: true

    - name: UseCustomNamespace
      type: Confirm
      default: false
      saveInXlvals: true
      prompt: "Do you want to use an custom Kubernetes namespace (current default is 'digitalai'):"
      description: "Type yes to use a namespace, not 'digitalai', in your kubernetes cluster for doing an install, update or clean of the Digital.ai Devops Platform."

    - name: Namespace
      type: Input
      promptIf: !expr "UseCustomNamespace"
      prompt: "Enter the name of the Kubernetes namespace where the Digital.ai DevOps Platform will be installed, updated or cleaned:"
      default: digitalai
      saveInXlvals: true
      ignoreIfSkipped: true
      description: "Type the name of the Kubernetes namespace to install, update or clean the Digital.ai Devops Platform."
      validate: !expr "ProcessType == 'upgrade' ? (k8sResource(Namespace, 'namespace', Namespace) != '') : true"

    - name: CreateNamespace
      type: Confirm
      default: true
      saveInXlvals: true
      promptIf: !expr "k8sResource(Namespace, 'namespace', Namespace) == ''"
      prompt:  !expr "'Do you want to create custom Kubernetes namespace ' + Namespace + ', it does not exist:'"
      description: "Type yes to create a namespace in your kubernetes cluster."
      
    - name: ServerType
      type: Select
      prompt: !expr "'Product server you want to perform ' + ProcessType + ' for:'"
      options:
        - label: Digital.ai Release
          value: dai-release
        - label: Digital.ai Deploy
          value: dai-deploy
      saveInXlvals: true
      description: !expr "'Select product server you want to perform ' + ProcessType + ' for.'"

    - name: ShortServerName
      type: Input
      saveInXlvals: true
      value: !expr "ServerType == 'dai-release' ? 'xlr' : 'xld'"
      description: Short product server used for filtering in the blueprints.

    - name: GenerationDateTime
      type: Input
      saveInXlvals: true
      value: !expr "os('_datetime')"
      description: Generation date and time.

    - name: CleanBefore
      type: Confirm
      overrideDefault: true
      prompt: "Should clean occur before the apply files to cluster:"
      saveInXlvals: true
      
    - name: UpgradeType
      type: Select
      prompt: "Select the type of upgrade you want:"
      ignoreIfSkipped: true
      options:
        - label: Operator to Operator
          value: operatorToOperator
        - label: Helm to Operator
          value: helmToOperator
      promptIf: !expr "ProcessType == 'upgrade'"
      saveInXlvals: true
      description: Type of upgrade you want?

  files: []
