1. Deploy the yace-exporter helm chart on Rancher


    To deploy the yace-exporter Helm chart on a Rancher-managed Kubernetes cluster, you'll need to create a CatalogV2 resource that points to the Helm chart repository containing the yace-exporter, then deploy the Helm chart using the Rancher2 provider in Pulumi. Unfortunately, Pulumi's Rancher2 provider does not have a dedicated Helm chart resource. However, you can use the helm.sh/v3 package to deploy Helm charts in a general Kubernetes cluster.

    Here's how you can do it:

    1. Enable the Helm chart repository in Rancher using CatalogV2.
    2. Deploy the Helm chart to the Rancher Kubernetes cluster.

    Below is a TypeScript program using Pulumi to accomplish this. The program assumes you have a Kubernetes cluster managed by Rancher and that Rancher is configured as a Pulumi provider.

    import * as pulumi from "@pulumi/pulumi"; import * as rancher2 from "@pulumi/rancher2"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Adding a Catalog to Rancher for accessing the Helm chart repository const catalog = new rancher2.CatalogV2("yace-exporter-catalog", { clusterId: "<RANCHER-CLUSTER-ID>", // Replace with your actual Rancher Cluster ID url: "https://<HELM-CHART-REPO-URL>", // Replace with the URL of the Helm chart's repository // Make sure that the cluster you are targeting is the same one that Pulumi is configured to use. }); // Ensure that the catalog is created before creating the Helm chart const catalogName = catalog.metadata.apply(meta => meta.name); // Step 2: Deploying the yace-exporter Helm Chart into your Rancher Kubernetes cluster const yaceChart = new k8s.helm.v3.Chart("yace-exporter", { chart: "yace-exporter", version: "<CHART-VERSION>", // Replace with the specific version of yace-exporter you want to deploy. fetchOpts: { repo: "https://<HELM-CHART-REPO-URL>", // Replace with the URL of the Helm chart's repository }, // Include any values here to customize the Helm chart installation. values: { // Provide any configuration specific to yace-exporter Helm chart }, }, { dependsOn: catalog }); // Export the URL to access the deployed yace-exporter service export const yaceExporterUrl = yaceChart.getResourceProperty( "v1/Service", "<YACE-EXPORTER-SERVICE-NAME>", "status" ).apply(status => status.loadBalancer.ingress[0].hostname || status.loadBalancer.ingress[0].ip);

    Replace the placeholders such as <RANCHER-CLUSTER-ID>, <HELM-CHART-REPO-URL>, <CHART-VERSION>, and <YACE-EXPORTER-SERVICE-NAME> with the appropriate values for your setup.

    This code does the following:

    • Defines a CatalogV2 resource, which adds the Helm chart repository to your Rancher setup. This repository should contain the yace-exporter Helm chart.
    • Creates a Chart resource from the @pulumi/kubernetes package that installs the yace-exporter chart from the defined catalog. Make sure to fill in the chart, version, and values based on the Helm chart’s requirements and your desired configuration.
    • Exports the URL to access the service created by the yace-exporter Helm chart. This assumes that your chart creates a Service with type LoadBalancer.

    Please ensure that your Pulumi stack is configured with the appropriate credentials to communicate with your Rancher cluster.

    Run this program using the Pulumi CLI by navigating to the directory containing this file and executing pulumi up. This will start the deployment process, which you can monitor directly from your command line or from the Pulumi Console, if you have it set up.