1. Deploy the variant-handler helm chart on Opensshift


    When deploying a Helm chart to an OpenShift cluster with Pulumi in TypeScript, we use the Pulumi Kubernetes provider. The kubernetes.helm.v3.Chart resource is ideal for the job. This resource allows you to deploy a Helm chart from a Helm repo or a local path.

    The program below assumes you have an existing OpenShift cluster and you are deploying the variant-handler Helm chart from a Helm repository. Please note that you should have your kubeconfig file correctly configured and accessible by Pulumi, as this information is required to communicate with your OpenShift cluster.

    Here's what the program looks like in TypeScript:

    import * as k8s from "@pulumi/kubernetes"; // Create an instance of the Helm chart to be deployed // Ensure that you have access to the repository where 'variant-handler' chart is hosted const variantHandlerChart = new k8s.helm.v3.Chart("variant-handler", { // If the chart is in a publicly accessible repository, specify `repo` and `chart`, // else if the chart is in a local directory, specify `path`. repo: "my-helm-charts-repository", // replace with your Helm repository name chart: "variant-handler", // Specify the version of the Helm chart you want to deploy version: "1.0.0", // replace with the desired chart version // Specify values for the Helm chart inline values: { service: { type: "ClusterIP" }, // ... additional custom values ... }, namespace: "default" // replace with the namespace where you want to deploy the chart, if other than 'default' }); // Export any required resources created by the Helm chart, such as the ClusterIP export const serviceClusterIp = variantHandlerChart.getResourceProperty("v1/Service", "variant-handler-service", "spec").clusterIP;

    In the above program:

    • A new Chart resource is instantiated from the variant-handler chart. We specify the chart's source repository, version, and any custom values you want to provide to the Helm chart. You need to replace my-helm-charts-repository with the actual name of the repository where your variant-handler chart is hosted and specify the version you want to deploy.

    • We're assuming the chart is named variant-handler and that there's a Kubernetes Service object inside it named variant-handler-service. You should change the getResourceProperty parameters accordingly if those names differ.

    • The namespace is provided where the chart should be installed. Replace default with whatever namespace you'd like to use, or omit this if you want to install it into the default namespace.

    • The serviceClusterIp is an example of how you can export a resource property created by the Helm chart.

    Before running the Pulumi program, make sure that:

    1. You have Pulumi installed.
    2. You have the @pulumi/kubernetes package installed in your project (npm install @pulumi/kubernetes).
    3. Your kubeconfig file is correctly set up to interact with your OpenShift cluster.
    4. You have access to the Helm chart repository where variant-handler is hosted, and it is reachable from your Pulumi environment.

    Once your environment is set up, you can deploy the Helm chart to your OpenShift cluster by running pulumi up in your terminal. This command will start the Pulumi deployment process.

    This introduction to Pulumi uses a Kubernetes provider to deploy a specific Helm chart to an OpenShift cluster. For more advanced scenarios, you might need to handle dependencies between resources, fine-tune permissions, or manage configurations across multiple environments. Pulumi supports all these use cases through additional concepts such as StackReferences, Config, and Secrets. For more information, refer to the official Pulumi Kubernetes documentation.