1. Deploy the choerodon-asgard helm chart on Azure Managed Openshift Service


    To deploy the Choerodon Asgard Helm chart on Azure Red Hat OpenShift (ARO), we'll need to perform a few steps with Pulumi:

    1. Create a Managed OpenShift Cluster on Azure using the azure-native provider.
    2. Install the Choerodon Asgard Helm Chart into the OpenShift cluster using the kubernetes package for Helm Chart deployment.

    We will need the azure-native package to provision the OpenShift cluster and the kubernetes package to interact with the cluster and deploy workloads using Helm.

    Here's an outline of the steps that the Pulumi program will perform:

    • Configure Azure and Kubernetes settings.
    • Provision an Azure Red Hat OpenShift cluster.
    • Configure a Kubernetes provider that targets the created OpenShift cluster.
    • Use the Helm Chart resource to deploy Choerodon Asgard into the OpenShift cluster.

    Below the explanation, you'll find the TypeScript program which performs these operations. For this to work, ensure you have @pulumi/azure-native and @pulumi/kubernetes installed in your Pulumi project. You can install them using npm:

    npm install @pulumi/azure-native @pulumi/kubernetes

    Also, ensure you've logged in to Azure with the Azure CLI and set up the Pulumi with an active stack that targets Azure.

    TypeScript Program:

    import * as pulumi from "@pulumi/pulumi"; import * as azure_native from "@pulumi/azure-native"; import * as k8s from "@pulumi/kubernetes"; // Replace these variables with your own specific values const resourceGroupName = "myResourceGroup"; // Azure Resource Group const openshiftClusterName = "myOpenshiftCluster"; // OpenShift Cluster name const location = "eastus"; // Azure Location const masterPoolName = "masterpool"; // OpenShift MasterPool name const workerPoolName = "workerpool"; // OpenShift WorkerPool name // Create an Azure Resource Group if it doesn't exist const resourceGroup = new azure_native.resources.ResourceGroup(resourceGroupName, { location, }); // Create an Azure Red Hat OpenShift Cluster const openshiftCluster = new azure_native.redhatopenshift.OpenShiftCluster(openshiftClusterName, { resourceGroupName: resourceGroupName, location: resourceGroup.location, masterProfile: { vmSize: "Standard_D8s_v3", }, workerProfiles: [{ name: workerPoolName, vmSize: "Standard_D4s_v3", count: 3, // Number of worker nodes (modify as needed) }], }); // Export the kubeconfig of the created cluster export const kubeconfig = openshiftCluster.kubeconfig; // Create Kubernetes provider pointing to the ARO cluster created above const openshiftProvider = new k8s.Provider("openshiftProvider", { kubeconfig: openshiftCluster.kubeconfig, }); // Deploy Choerodon Asgard using Helm Chart const choerodonAsgardChart = new k8s.helm.v3.Chart("choerodon-asgard", { chart: "choerodon-asgard", version: "x.y.z", // Specify the chart version you want to deploy // Add the repo and namespace as necessary, along with any required values fetchOpts: { repo: "https://<your-choerodon-helm-chart-repository>" // Replace with the repository URL }, }, { provider: openshiftProvider }); // Export the URL to access Choerodon Asgard if available export const asgardUrl = choerodonAsgardChart.getResourceProperty("v1/Service", "choerodon-asgard-service", "status").apply(status => status.loadBalancer.ingress[0].hostname);

    This program initializes a new OpenShift cluster on Azure and then deploys Choerodon Asgard on it using a Helm chart. You will need to replace the placeholder values with the actual parameters that fit your use case, such as the Helm Chart repository URL and version.

    After deploying this Pulumi program, the output will include the kubeconfig required to access the newly created cluster and the URL for the Choerodon Asgard service if available. For this specific case, I have not included the exact Helm Chart version and repository URL. You will need to replace these with the actual values for the Choerodon Asgard Helm chart you want to deploy.

    This Pulumi program assumes that you have the necessary permissions on Azure and the credentials configured in your environment for Pulumi to use. The cluster provisioning may take a while, and you can monitor the progress with the Pulumi CLI. After the provisioning is complete, you can use the provided kubeconfig to manage the cluster using kubectl.