1. Deploy the custom-pod helm chart on Rancher


    To deploy a Helm chart on Rancher using Pulumi, you'll need to set up Pulumi to manage resources in your Rancher instance. The primary resource you will work with is the CatalogV2 which allows you to create and manage Helm chart repositories within Rancher, and then you'll need to deploy the Helm chart itself, which in this scenario is a custom-pod chart.

    Here's a high-level overview of the steps you'll take in the program:

    1. Establish a connection to your Rancher instance.
    2. Add a Helm chart repository to Rancher using the CatalogV2 resource if your chart is in a custom repository.
    3. Deploy the Helm chart using Rancher's Helm chart deployment capabilities.

    Make sure you have Pulumi installed and the appropriate Rancher2 provider set up. I'll use TypeScript for the example below.

    Here's the Pulumi program to deploy the custom-pod Helm chart on Rancher:

    import * as rancher2 from "@pulumi/rancher2"; // Import Rancher2 provider plugin // Create a new catalog in Rancher (if not already present) const customCatalog = new rancher2.CatalogV2("custom-catalog", { // This URL should be the address of your Helm chart repository // Replace with the correct URL where your custom-pod chart is hosted url: "https://charts.example.com/", clusterId: "local", // This should be the ID of your Rancher cluster }); // Deploy the custom-pod Helm chart using the app resource in the Rancher2 provider. const customPodApp = new rancher2.AppV2("custom-pod", { // Specify the cluster ID where you want to deploy clusterId: "local", namespace: "default", // Namespace where the chart will be installed repoName: customCatalog.name, // This should match the catalog name above chartName: "custom-pod", // The name of the chart in the repository chartVersion: "1.0.0", // Specify the version of the chart you wish to deploy // Values to provide to the Helm chart. Replace with values for your custom-pod chart. values: ` image: repository: nginx tag: stable service: type: ClusterIP `, }); // Export the endpoint of the application export const endpoint = customPodApp.status.apply(status => status.url);

    In this program:

    • We first import the Rancher2 provider from Pulumi's library.
    • We then create a CatalogV2 resource. This represents a Helm chart repository in Rancher. If your chart is hosted on a known repository like Helm's official charts, this step might not be necessary.
    • Next, we create the AppV2 resource to deploy the custom-pod Helm chart to the desired cluster and namespace. The repoName is aligned with the catalog created.
    • We use values to set the configuration for the Helm chart as a YAML-string. This should be replaced with the actual values necessary for configuring your custom-pod chart.
    • Lastly, we export the endpoint URL of the deployed application for easy access.

    Remember that the actual values, chart version, chart name, and repository URL will depend on your specific Helm chart's requirements and setup. Replace the placeholder values with actual data from your environment.