Install Deploy in a Custom Namespace

  • If you would like to install multiple Deploy instances on the same cluster, you need to use a custom namespace.
  • Installation of the Deploy in custom namespace is for users that don’t want to install Deploy in the default namespace: digitalai.

Note: Don’t use custom namespace name that is longer from 24 characters. The namespace name is composing the CR name when using change-namespace script, and longer CR name could cause naming of some resources that are longer from 63 characters. Consider using namespace names up to 10 characters.

A few points to consider if you install Deploy in a custom namespace:

  • multiple Deploy instances on the same cluster in different namespaces.
  • each instance of the Deploy uses custom CR name.
  • when nginx is used, different IngressClass is created for each namespace.
  • all instances in different namespaces are reusing the same CRD; so exercise caution before deleting the CRD when you remove one of the instances.
  • every instance has one Deploy operator running that is managing the instance in only one namespace.

Audience

This guide is for administrators who install and manage Digital.ai Deploy.

Before You Begin

If you are doing this process as part of installation steps, you are OK, and go to next section.

  1. The Operator zip file is downloaded from the Deploy Software Distribution site and extracted to the standalone Deploy server you would use to install Deploy on the Kubernetes cluster.
  2. Created custom namespace on the cluster.

    kubectl create namespace <name-0f-the-custom-namespace>
  3. Install the XL CLI.

    See Install the XL-CLI.

    Note: Use the version that matches your product version in the public folder.

Configuring the Custom Namespace

  • Run the XL CLI’s xl op command with the --change-namespace flag.
  • This command changes nothing on the cluster
  • This command checks the current state of CRD and CRs, for the case if they already exist on the cluster.
  • This command prepares the YAML files in the operator zip file.
xl op --change-namespace

For example, here’s is the list of questions you would be prompted with when you run the xl op command in Azure for a custom namespace called custom-namespace-1. These questions are also discussed in Upgrade Operator-based Deployments

? Select the setup mode? advanced
? Select the Kubernetes setup where the digitalai Devops Platform will be installed or uninstalled: AzureAKS [Azure AKS]
? Do you want to use Kubernetes\' current-context from ~/.kube/config? Yes
? Do you want to use a custom Kubernetes namespace (current default is 'digitalai')? Yes
? Enter the name of the existing Kubernetes namespace where the XebiaLabs DevOps Platform will be installed, updated or undeployed: custom-namespace-1
? Product server you want to deploy? daiDeploy
? Does product custom resource definition already exists on the cluster? No
? Enter path to the operator package: /xl-deploy-kubernetes-operator/deploy-operator-azure-aks
Using custom resource name dai-xld-custom-namespace-1
Everything has been updated!

Refer to the specific cloud provider documentation to gather details about the provided infrastructure.

The last two questions are specific to this process and so let us discuss them here:

? Does product custom resource definition already exists on the cluster?

  • The Deploy Operator CRD, digitalaideploys.xld.digital.ai, is reused between Deploy installations on the same cluster.
  • That name cannot change, it is defined in the Deploy’s Operator image.
  • If the CRD resource for the Deploy Operator already exists on the cluster, in that case answer Yes and creation of the Deploy operator CRD during installation will be skipped.
  • In other cases, by answering No, the Deploy Operator CRD will be created.

If not sure, you can run the kubectl get crd command to verify the list of CRDs on the cluster.

For example, answer Yes if you see the following result for the kubectl get crd command:

❯ kubectl get crd
NAME                                             CREATED AT
...
digitalaideploys.xld.digital.ai                  2022-06-14T09:05:54Z
...

? Enter path to the operator package:

  • Input the absolute path to the unpacked operator’s zip file.
  • The yaml files in the zip file should be already changed.
  • The process of changing namespace checks the ingress settings to make changes in the CR file.
  • It depends on the following CR yaml daideploy_cr.yaml paths:

    • spec.nginx-ingress-controller.install
    • spec.haproxy-ingress.install

Post change namespace steps

The following files in the Operator-based installer package are updated with the custom namespace name, for example custom-namespace-1, as you change the namespace.

File name Yaml path Value to set
digitalai-deploy/infrastructure.yaml spec[0].children[0].children[0].name custom-namespace-1
digitalai-deploy/infrastructure.yaml (not on OpenShift) spec[0].children[0].children[0].namespaceName custom-namespace-1
digitalai-deploy/infrastructure.yaml (only on OpenShift) spec[0].children[0].children[0].projectName custom-namespace-1
digitalai-deploy/environment.yaml spec[0].children[0].members[0] ~Infrastructure/k8s-infra/xld/custom-namespace-1
digitalai-deploy/kubernetes/template/cluster-role-digital-proxy-role.yaml metadata.name custom-namespace-1-xld-operator-proxy-role
digitalai-deploy/kubernetes/template/cluster-role-manager-role.yaml metadata.name custom-namespace-1-xld-operator-manager-role
digitalai-deploy/kubernetes/template/cluster-role-metrics-reader.yaml metadata.name custom-namespace-1-xld-operator-metrics-reader
digitalai-deploy/kubernetes/template/leader-election-rolebinding.yaml subjects[0].namespace custom-namespace-1
digitalai-deploy/kubernetes/template/manager-rolebinding.yaml metadata.name custom-namespace-1-xld-operator-manager-rolebinding
digitalai-deploy/kubernetes/template/manager-rolebinding.yaml roleRef.name custom-namespace-1-xld-operator-manager-role
digitalai-deploy/kubernetes/template/manager-rolebinding.yaml subjects[0].namespace custom-namespace-1
digitalai-deploy/kubernetes/template/proxy-rolebinding.yaml metadata.name custom-namespace-1-xld-operator-proxy-rolebinding
digitalai-deploy/kubernetes/template/proxy-rolebinding.yaml roleRef.name custom-namespace-1-xld-operator-proxy-role
digitalai-deploy/kubernetes/template/proxy-rolebinding.yaml subjects[0].namespace custom-namespace-1
digitalai-deploy/kubernetes/daideploy_cr.yaml metadata.name dai-xld-custom-namespace-1

Update the following files in case you use the nginx ingress (default behavior). In other words, if you have set the following parameters.

  • spec.haproxy-ingress.install = false
  • spec.nginx-ingress-controller.install = true

Note: Skip this part for OpenShift and On Premise setups. On these two providers there is already provider’s ingress setup.

File name Yaml path Value to set
digitalai-deploy/kubernetes/daideploy_cr.yaml spec.ingress.annotations.kubernetes.io/ingress.class nginx-dai-xld-custom-namespace-1
digitalai-deploy/kubernetes/daideploy_cr.yaml spec.keycloak.ingress.annotations.kubernetes.io/ingress.class nginx-dai-xld-custom-namespace-1
digitalai-deploy/kubernetes/daideploy_cr.yaml spec.nginx-ingress-controller.extraArgs.ingress-class nginx-dai-xld-custom-namespace-1
digitalai-deploy/kubernetes/daideploy_cr.yaml spec.nginx-ingress-controller.ingressClassResource.controllerClass k8s.io/ingress-nginx-dai-xld-custom-namespace-1
digitalai-deploy/kubernetes/daideploy_cr.yaml spec.nginx-ingress-controller.ingressClassResource.name nginx-dai-xld-custom-namespace-1

Update the following files in case you use the haproxy ingress. In other words, if you have set the following parameters.

  • spec.haproxy-ingress.install = true
  • spec.nginx-ingress-controller.install = false
File name Yaml path Value to set
digitalai-deploy/kubernetes/daideploy_cr.yaml spec.ingress.annotations.kubernetes.io/ingress.class haproxy-dai-xld-custom-namespace-1
digitalai-deploy/kubernetes/daideploy_cr.yaml spec.haproxy-ingress.controller.ingressClass haproxy-dai-xld-custom-namespace-1

Next Step—Proceed with the Installation

  • If you are doing this process as part of installation steps, you are finished with current step, continue with next step.
  • Once the setup is finalized you can proceed to applying the changed files to the cluster.
  • You can now run the xl apply command to deploy the setup to the cluster.