Deploy the reportportal helm chart on Rancher
TypeScriptDeploying the ReportPortal Helm chart on a Rancher-managed Kubernetes cluster involves several steps. I will guide you through the process of setting up the necessary resources using Pulumi with TypeScript.
Here is a step-by-step outline of what we will do:
- Set up a Rancher cluster: We will use Pulumi to provision a Kubernetes cluster managed by Rancher. We need to ensure we have a
Cluster
resource where we can deploy our applications. - Configure Rancher catalog: We will need to configure a Rancher Catalog (V2) to add the repository that contains the ReportPortal Helm chart.
- Deploy the ReportPortal Helm chart: Finally, we will use Pulumi to deploy the ReportPortal Helm chart to our cluster using the
rancher2
provider.
Let's start with the code:
import * as rancher2 from "@pulumi/rancher2"; import * as k8s from "@pulumi/kubernetes"; // Assume that we have pre-configured Pulumi to use the correct credentials and context for Rancher // We start by creating a new Kubernetes cluster in Rancher const cluster = new rancher2.Cluster("reportportal-cluster", { // ... you would specify your cluster configuration here // It might include the rancher version, the node count, region, instance types etc. // The specifics of the configuration would depend on your requirements and the specific cloud you are deploying to. }); // Creating a Rancher Catalog to add the ReportPortal Helm repository const catalog = new rancher2.CatalogV2("reportportal-catalog", { // Specify where to find the ReportPortal Helm chart. This could be an official or a community Helm repo // For example, to use the official stable Helm repo: url: "https://helm.reportportal.io/", // ReportPortal is available at "https://helm.reportportal.io/" as of the time of writing clusterId: cluster.id, // The name of our Helm catalog name: "reportportal", }); // We can now instantiate a Helm chart from this catalog const reportPortalChart = new k8s.helm.v3.Chart("reportportal", { chart: "reportportal", // Reference the created catalog above in the fetchOpts fetchOpts: { repo: catalog.url.apply(url => url), // Here we apply the catalog URL created above }, namespace: "reportportal", // Values to pass to the ReportPortal Helm chart values: { // ... you will have to provide the required values for your ReportPortal deployment here // This can vary based on how you want to customize ReportPortal like resource allocation, persistence, ingress, etc. }, }, { provider: /* This should be the provider associated with your Rancher Kubernetes cluster */ }); // Finally, we want to export the URL of the ReportPortal once it is up and running // Assuming we have set up an ingress for ReportPortal, we would watch for that ingress resource // to grab the endpoint URL and export it. export const reportPortalUrl = reportPortalChart.getResourceProperty("v1/Service", "reportportal-reportportal", "status").apply(status => { return status.loadBalancer.ingress[0].ip; });
Before you run this code with Pulumi, please take note of the following:
- You need to replace placeholder comments with actual configuration parameters specific to your Rancher, Kubernetes, and ReportPortal setup.
- Customizing the ReportPortal Helm chart via the
values
object requires knowledge of the specific configuration values that ReportPortal expects. These are typically found in the chart'svalues.yaml
file or in its documentation. - The provider to pass in the
reportPortalChart
options should be one that is configured to interact with the Kubernetes cluster you have provisioned through Rancher.
This Pulumi program acts as Infrastructure as Code (IaC), allowing you to repeatedly and reliably deploy your application within a Rancher-managed Kubernetes environment. To run this code, you would typically execute
pulumi up
within your project directory after setting up your Pulumi stack with thepulumi stack init
command. Remember to install the required NPM packages (@pulumi/rancher2
and@pulumi/kubernetes
) in your Pulumi project.Keep in mind that Helm charts, including the one for ReportPortal, can have a lot of different configuration options. You should customize the
values
section of thereportPortalChart
to suit the needs of your deployment and adjust the configurations to align with your enterprise standards and practices.- Set up a Rancher cluster: We will use Pulumi to provision a Kubernetes cluster managed by Rancher. We need to ensure we have a