Deploy the universal-crossplane helm chart on Rancher
TypeScriptTo deploy the Universal Crossplane Helm chart on Rancher, you'll need to interact with the Rancher platform through its API using the
rancher2
provider from Pulumi. The following Pulumi program will demonstrate how to perform this task.Before diving into the code, let's take a step-by-step approach of what the program will accomplish:
- Set up a Pulumi program using TypeScript.
- Install the
rancher2
provider to interact with the Rancher API. - Define a Rancher cluster where the Universal Crossplane Helm chart will be deployed. (This step assumes you have a cluster already set up in Rancher; if not, the
rancher2.Cluster
resource can be used to create one.) - Utilize the
rancher2.CatalogV2
resource to add the Helm chart repository that contains Universal Crossplane. - Deploy the Universal Crossplane Helm chart using the
rancher2.AppV2
resource.
Here's the program that carries out the above steps:
import * as pulumi from "@pulumi/pulumi"; import * as rancher2 from "@pulumi/rancher2"; // Initialize a Rancher provider instance const rancherProvider = new rancher2.Provider("my-rancher", { apiUrl: "https://rancher.my-domain.com/v3", accessKey: "xxxxxx", secretKey: "xxxxxx", }); // Define the Helm chart repository using CatalogV2 const crossplaneCatalog = new rancher2.CatalogV2("crossplane-catalog", { clusterId: "<CLUSTER-ID>", // Replace with your cluster ID name: "crossplane-catalog", url: "https://charts.crossplane.io/master/", // The repository URL containing the chart // Ensure any additional required properties are set here }, { provider: rancherProvider }); // Define the Universal Crossplane Helm chart deployment using AppV2 const crossplaneApp = new rancher2.AppV2("crossplane-app", { clusterId: "<CLUSTER-ID>", // Replace with your cluster ID namespace: "crossplane-system", // Replace with your target namespace if different repoName: crossplaneCatalog.name, chartName: "universal-crossplane", chartVersion: "1.3.0", // Replace with the version you want to deploy // Ensure any additional required properties are set here }, { provider: rancherProvider, dependsOn: [crossplaneCatalog] }); // Export the URL to access the Universal Crossplane dashboard (if any) export const crossplaneUrl = pulumi.interpolate`https://rancher.my-domain.com/dashboard/c/${crossplaneApp.clusterId}/apps/${crossplaneApp.id}`;
<CLUSTER-ID>
must be replaced with the actual ID of the cluster where you want to deploy Universal Crossplane.Make sure to replace placeholders like
https://rancher.my-domain.com
with your actual Rancher server's URL, and fill in theaccessKey
andsecretKey
with your credentials for the Rancher API.The
crossplaneCatalog
resource adds the Universal Crossplane Helm chart repository to Rancher's catalog within a specific cluster. ThecrossplaneApp
resource then uses this catalog to deploy the Helm chart to the cluster.When you run this Pulumi program, it will reach out to your Rancher instance, add the specified chart repository, and deploy Universal Crossplane based on the provided chart name and version.
Please note that this program assumes that you have permissions to deploy Helm charts and applications within Rancher and that your Kubernetes cluster is properly connected and managed under Rancher.
Remember to install the required dependencies for this Pulumi program using npm or yarn:
npm install @pulumi/pulumi @pulumi/rancher2
or
yarn add @pulumi/pulumi @pulumi/rancher2
After setting up the program, you can execute it using the Pulumi CLI to deploy Universal Crossplane to your Rancher-managed Kubernetes cluster.