1. Deploy the argocd-operator helm chart on Azure Managed Openshift Service

    TypeScript

    To deploy the Argo CD Operator Helm chart on Azure Managed OpenShift Service using Pulumi, we will be using the azure-native.containerservice.OpenShiftManagedCluster resource to create an OpenShift Kubernetes cluster within Azure, and then deploy the Argo CD Operator using the kubernetes.helm.v3.Chart resource from the Pulumi Kubernetes provider.

    First, we need to set up an OpenShift Managed Cluster on Azure. An OpenShift Managed Cluster provides a PaaS environment maintained by Microsoft and Red Hat, allowing you to avoid operational overhead while using the powerful features of OpenShift.

    Then, once we have the OpenShift cluster ready, we will install Argo CD using the Helm package manager. To accomplish this with Pulumi, we need to define a Helm chart resource pointing to the Argo CD Operator chart.

    Here's a Pulumi program in TypeScript to deploy the Argo CD Operator Helm chart onto an Azure-managed OpenShift cluster.

    Detailed Setup Instructions

    First, ensure that you have installed the Pulumi CLI and logged in to the Pulumi service. Also, you should have the Azure CLI installed and have logged into your Azure account.

    Next, set up a new Pulumi project and install necessary dependencies:

    1. Create a new directory for your project and change to it:
      mkdir pulumi-argocd-openshift && cd pulumi-argocd-openshift
    2. Create a new Pulumi project targeting Azure:
      pulumi new azure-typescript
    3. Install the Kubernetes package for Pulumi:
      npm install @pulumi/kubernetes

    Now, let's walk through the TypeScript program that does this deployment:

    import * as pulumi from "@pulumi/pulumi"; import * as azureNative from "@pulumi/azure-native"; import * as k8s from "@pulumi/kubernetes"; // Define the Azure location to deploy the resources to. const location = "EastUS"; // Define the OpenShiftManagedCluster resource. const openshiftCluster = new azureNative.containerservice.OpenShiftManagedCluster("myOpenshiftCluster", { resourceGroupName: "myResourceGroup", location: location, openShiftVersion: "v4.8", // specify the OpenShift version networkProfile: { vnetCidr: "10.0.0.0/8" }, masterPoolProfile: { // Define master nodes properties count: 3, vmSize: "Standard_D4s_v3", }, agentPoolProfiles: [{ // Define worker nodes properties name: "workerpool", count: 3, vmSize: "Standard_D4s_v3", }], }); // Once the OpenShift cluster is provisioned, set up the Kubernetes configuration. const kubeConfig = openshiftCluster.config.apply(config => Buffer.from(config, "base64").toString()); // Create a Kubernetes provider instance using the kubeConfig. const k8sProvider = new k8s.Provider("k8sProvider", { kubeconfig: kubeConfig, }); // Deploy the Argo CD Operator Helm chart using the created Kubernetes provider. const argocdOperatorChart = new k8s.helm.v3.Chart("argocd-operator", { chart: "argocd-operator", version: "0.0.15", // specify the version of the chart fetchOpts: { repo: "https://argoproj.github.io/argo-helm", }, }, { provider: k8sProvider }); // Export the kubeConfig to be able to interact with the cluster outside of Pulumi. export const kubeconfig = kubeConfig;

    In the above program:

    • We declare an OpenShift managed cluster with a specified version, location, and networking setup using the azureNative.containerservice.OpenShiftManagedCluster resource.
    • We create a Kubernetes provider instance using the cluster's kubeconfig, which enables Pulumi to communicate with our OpenShift cluster.
    • We deploy the Argo CD Operator using the k8s.helm.v3.Chart resource. The properties we pass specify the Helm chart version and repository location.
    • We export the kubeConfig in case you need to interact with your Kubernetes cluster using a tool like kubectl.

    Keep in mind that when running this Pulumi program, it will create resources that incur costs against your Azure subscription. You should also configure the necessary permissions and service principals required for Azure Managed OpenShift.

    Finally, to run the program, execute:

    pulumi up

    This command will start provisioning the resources defined in the program. You'll be prompted to review the changes and confirm them before the provisioning begins.

    Once the deployment is complete, you will have a running Azure Managed OpenShift cluster with the Argo CD Operator deployed and ready to manage applications using GitOps workflows.