1. Deploy the devtron-in-clustercd helm chart on Digital Ocean Kubernetes Service


    To deploy the devtron-in-clustercd Helm chart on Digital Ocean Kubernetes Service, we will follow these steps:

    1. Create a DigitalOcean Kubernetes Cluster: First, you need a Kubernetes cluster where your Helm chart will be deployed. We'll use the digitalocean.KubernetesCluster to create a new cluster.

    2. Deploy the Helm chart: After setting up the cluster, we'll use the kubernetes.helm.sh/v3.Chart resource to deploy the Helm chart to the cluster.

    Let's go through the Pulumi program that accomplishes this. Before you run this code, make sure you have the Pulumi CLI installed and configured for DigitalOcean and Helm.

    import * as pulumi from "@pulumi/pulumi"; import * as digitalocean from "@pulumi/digitalocean"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create a DigitalOcean Kubernetes Cluster const cluster = new digitalocean.KubernetesCluster("do-cluster", { region: "nyc3", // Specify the Kubernetes version, if required. Otherwise, the default version provided by DigitalOcean is used. version: "1.21.5-do.0", nodePool: { name: "default", size: "s-2vcpu-2gb", nodeCount: 3, }, }); // Step 2: Deploy the devtron-in-clustercd Helm chart on the cluster const devtronChart = new k8s.helm.sh.v3.Chart("devtron-in-cluster", { chart: "devtron-in-clustercd", // You can specify the Helm repository URL using the 'repo' field if it's not a chart from the stable repository. // repo: "https://charts.devtron.ai", version: "1.0.0", // Specify the version of the chart if necessary namespace: "devtron-cd", // Namespace where you want to install the chart, it will be created if it doesn't exist values: { /* Additional configuration values can be specified here if needed */ }, }, { provider: new k8s.Provider("k8s-provider", { kubeconfig: cluster.kubeConfigs[0].rawConfig }) }); export const kubeConfig = cluster.kubeConfigs[0].rawConfig; export const devtronChartStatus = devtronChart.status;

    Here's what each part of the program does:

    • We first create a Kubernetes cluster in DigitalOcean using the digitalocean.KubernetesCluster resource. Within its parameters, we specify the region, Kubernetes version, and details of the node pool such as the droplet size and the number of nodes.

    • After the cluster is up and running, we deploy the devtron-in-clustercd Helm chart. To do this, we create a Pulumi resource of type k8s.helm.sh/v3.Chart. We set the chart property to devtron-in-clustercd and can optionally specify the repository, version, and namespace.

    • Since the Helm chart is being deployed on DigitalOcean Kubernetes Service, we pass the kubeConfig from the created cluster to the Helm chart resource as a Kubernetes Provider. This ties the lifecycle of the Helm chart to the cluster and makes sure we deploy the chart into the cluster we created.

    • Finally, we export the raw kubeconfig string so that it can be used outside of Pulumi. We also export the status of the Helm chart deployment, which can be useful for tracking the deployment status.

    Run this Pulumi program using pulumi up, and it will provision the infrastructure and deploy the Helm chart for you. Make sure to replace the version and any other placeholders like the chart repository URL if devtron-in-clustercd resides in a different Helm repository.