1. Deploy the argocd-cr helm chart on Rancher

    TypeScript

    To deploy the Argo CD Helm chart on a Kubernetes cluster managed by Rancher, you would typically follow these steps:

    1. Set up access to your Rancher-managed Kubernetes cluster.
    2. Install the Pulumi Rancher2 provider which allows you to interact with the Rancher API.
    3. Write a Pulumi program to deploy the desired Helm chart to the cluster.

    First, make sure you have access to your Rancher-managed cluster. This usually involves obtaining a kubeconfig file which is configured to connect to your Kubernetes cluster.

    With Pulumi, you can use the rancher2 package to work with Rancher. Unfortunately, there is no direct support in the rancher2 provider for deploying a helm chart. However, you can deploy Helm charts to Kubernetes with Pulumi using the kubernetes package.

    Here is how you could write a Pulumi program in TypeScript to deploy the Argo CD helm chart using the kubernetes package.

    Before starting, make sure you have Pulumi installed and you’re logged into the Pulumi service. Ensure that you've installed the required Pulumi providers with npm for this program to work:

    npm install @pulumi/kubernetes

    Now, let’s describe what each part of the following TypeScript program is doing:

    • Import the necessary Pulumi packages.
    • Use the Kubernetes package to create a helm.v3.Chart resource, specifying the Argo CD chart by name and version (if desired), along with any custom values.
    • Configure the Helm chart deployment with settings that you would define in a Helm values file.
    • Optionally, you can specify the Kubernetes cluster details if your kubeconfig is not already pointing to the Rancher-managed Kubernetes cluster.

    Here is the TypeScript Pulumi program for deploying the Helm chart:

    import * as k8s from "@pulumi/kubernetes"; // Define the settings for the argocd Helm chart const argocdChartSettings = { // Replace with the namespace where you want to deploy Argo CD namespace: "argocd", // The values/options for the chart can be specified here. // These values would override the default values from the chart. values: { server: { service: { type: "LoadBalancer" // Use LoadBalancer if you want to access Argo CD externally } } } }; // Deploy the argocd Helm chart using the chart settings defined above const argocdChart = new k8s.helm.v3.Chart("argocd", { chart: "argo-cd", // The name of the chart in the Helm repository fetchOpts: { // The Argo CD chart repository URL // Replace if the chart is hosted in a different repository repo: "https://argoproj.github.io/argo-helm" }, version: "4.5.6", // The specific chart version to deploy; omit to deploy the latest version ...argocdChartSettings }); // Export the Argo CD server endpoint export const argocdServerEndpoint = argocdChart.getResourceProperty("v1/Service", "argocd-argocd-server", "status") .apply(status => status.loadBalancer.ingress[0].ip || status.loadBalancer.ingress[0].hostname);

    In this code, you've defined a helm.v3.Chart resource which will install the Argo CD Helm chart into your Rancher-managed Kubernetes cluster. You've also specified to use a LoadBalancer service type for the Argo CD server which means it will be accessible over the internet. The endpoint of the Argo CD server, either an IP address or a hostname, is being exported as an output of the Pulumi program.

    To run this Pulumi program, save it as index.ts and then execute pulumi up in the terminal. Pulumi will perform the deployment and print the resulting Argo CD server endpoint.