Deploy the micro-integrator helm chart on Rancher
TypeScriptDeploying a Helm chart on a Kubernetes cluster managed by Rancher involves several steps. Below is a Pulumi program written in TypeScript that demonstrates how you could deploy the 'micro-integrator' Helm chart onto a Rancher-managed Kubernetes cluster.
In this example, we're assuming that you've already set up Rancher and have a Kubernetes cluster registered with it. We'll be using the
rancher2
Pulumi provider to interact with your Rancher instance. Therancher2
provider allows us to manage resources in Rancher.Here's how the deployment process will work:
-
Install rancher2 Provider: The
rancher2
provider will be used to interact with Rancher. -
Create a CatalogV2: This resource represents a Helm chart repository in Rancher. We use it to add the repository that contains the 'micro-integrator' Helm chart.
-
Deploy Helm Chart: We use the native Helm support in Pulumi (not yet explicit in the Rancher Pulumi provider as of the provided data) to deploy the Helm chart onto the Kubernetes cluster managed by Rancher.
Let's dive into the code:
import * as rancher2 from "@pulumi/rancher2"; import * as k8s from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Cluster information const clusterId = "<RANCHER_CLUSTER_ID>"; // Replace with your actual Rancher cluster ID const clusterName = "<RANCHER_CLUSTER_NAME>"; // Replace with your Rancher cluster name // Create a Catalog V2 resource, representing a Helm chart repository const catalog = new rancher2.CatalogV2("micro-integrator-catalog", { clusterId: clusterId, url: "https://wso2.github.io/wso2-helm-charts/", // URL to the Helm repo containing the 'micro-integrator' chart // Provide additional configuration if needed }); // Deploy 'micro-integrator' Helm chart from the added Catalog V2 const microIntegratorChart = new k8s.helm.v3.Chart("micro-integrator", { chart: "micro-integrator", // The name of the chart in the catalog version: "<CHART_VERSION>", // Specify the version of the chart you want to deploy namespace: "default", // Specify the namespace (either existing or Pulumi will create it for you) fetchOpts: { repo: "https://wso2.github.io/wso2-helm-charts/", // Helm chart repository }, // Set any values required by the Helm chart values: { // Provide configuration for the chart, such as replica count or container image }, // Reference the Rancher cluster's Kubernetes provider // This tells Pulumi to deploy the chart on the Kubernetes cluster managed by Rancher provider: new k8s.Provider(clusterName, { kubeconfig: new pulumi.Output(() => { // Obtain the kubeconfig from the Rancher cluster // This may involve using the Rancher API or Pulumi rancher2 provider methods (need to be defined based on the actual capabilities and the state of the implementation) return "<KUBECONFIG_CONTENT>"; }), }), }, { dependsOn: [catalog] }); // Ensure the Catalog is created before deploying the chart // Export the name of the cluster where 'micro-integrator' is deployed export const cluster = clusterName;
In this Pulumi program, you need to replace placeholders with actual values:
<RANCHER_CLUSTER_ID>
: The specific ID of your Rancher-managed Kubernetes cluster.<RANCHER_CLUSTER_NAME>
: The name of the cluster as registered in Rancher.<CHART_VERSION>
: The version of the 'micro-integrator' Helm chart you want to deploy.<KUBECONFIG_CONTENT>
: The content of your kubeconfig file that allows you to interact with your Kubernetes cluster.
This program defines the necessary resources to interact with Rancher and deploy a Helm chart. The
CatalogV2
resource represents the Helm repository, while theChart
resource from thek8s
Pulumi package represents the actual Helm deployment of 'micro-integrator'. ThedependsOn
option ensures that the Helm chart deployment waits for the successful creation of the Helm repository resource in Rancher.Notice that the program is not complete because it requires actual mechanisms to obtain the kubeconfig for the Kubernetes provider, which depends on how the Rancher cluster is set up and how it can be accessed. The process of automating kubeconfig retrieval is specific to your configuration and may require using the Rancher API or other methods outside the current Pulumi implementation.
-