Deploy the reportportal helm chart on Opensshift
TypeScriptTo deploy the ReportPortal Helm chart on an OpenShift cluster using Pulumi, we first need to ensure that we have access to an existing OpenShift cluster. In this instance, we would use Pulumi's Kubernetes provider to interact with the cluster and deploy the Helm chart. The
kubernetes.helm.v3.Chart
resource is a part of the Pulumi Kubernetes provider and allows you to specify the Helm chart you want to deploy along with any configuration values required by that chart.Before you proceed, you should have the following prerequisites in place:
- An OpenShift cluster where you have administrative privileges.
- The
kubectl
command-line tool configured with the appropriate context to communicate with your OpenShift cluster. - The Pulumi CLI installed on your machine.
- The Helm CLI installed on your machine, if you need to download or explore the charts manually.
- Access to the ReportPortal Helm chart repository, if it’s not included in the default Helm chart repositories.
Here is a TypeScript program that demonstrates how to deploy the ReportPortal Helm chart on an OpenShift cluster using Pulumi. This program assumes that you have already set up and configured the Pulumi Kubernetes provider to communicate with your Openshift cluster:
import * as k8s from '@pulumi/kubernetes'; // Define the name of the namespace in which the ReportPortal Helm chart should be deployed. const namespaceName = "reportportal"; // Create a Kubernetes namespace for ReportPortal if it doesn't already exist. const ns = new k8s.core.v1.Namespace(namespaceName, { metadata: { name: namespaceName, }, }); // Define the ReportPortal Helm chart and its values. // Note: Make sure to modify 'repo' with the actual repository URL and 'chart' with the correct chart name. const reportportalChart = new k8s.helm.v3.Chart("reportportal", { namespace: namespaceName, repo: "reportportal", chart: "reportportal", values: { // Place any custom values here, according to the ReportPortal Helm chart's expectations. // For instance, if you need to specify a persistent volume claim or customize service types, // you would specify those values here. // The values below are placeholders and should be replaced with actual values required for your setup: service: { type: "ClusterIP", }, database: { type: "postgresql", host: "your-database-host", port: 5432, // Include other database configuration as needed. }, // Include additional custom values as required. }, transformations: [ // If you need to apply transformations to the resources created by this chart, define them here. // For example, you might need to add specific labels or annotations. (obj: any) => { if (obj.metadata) { obj.metadata.namespace = namespaceName; } }, ], }, {dependsOn: ns}); // Export the base URL for the ReportPortal instance // You will need to adjust this to reflect the actual service URL. export const reportportalUrl = pulumi.interpolate`http://reportportal.${namespaceName}.svc.cluster.local`;
This program starts by importing the required Pulumi Kubernetes package. Then, it creates a Kubernetes namespace for ReportPortal. Afterwards, it deploys the ReportPortal Helm chart to the cluster using the
k8s.helm.v3.Chart
resource. Thevalues
field inside the chart specification allows customizing the deployment, which you would need to fill in with values specific to your environment, such as database connection information.To run this Pulumi program, you'll need to save it to a file (e.g.,
index.ts
), then run the following commands in your terminal:pulumi stack init reportportal-deployment pulumi up
Remember that you should have the appropriate access rights to the cluster and have the Pulumi CLI configured correctly with the desired OpenShift Kubernetes context. The
pulumi up
command will prompt you to confirm the deployment after showing you a preview of the actions it will take.This deployment will attempt to create the resources specified in the ReportPortal Helm chart within the OpenShift cluster. The specifics of these resources, such as the exact services, deployments, and configurations, will rely on the structure of the chart itself