Deploy the quickwit helm chart on Opensshift
TypeScriptTo deploy a Helm chart on OpenShift using Pulumi, you'll leverage the
@pulumi/kubernetes
package which allows you to interact with Kubernetes resources, including those in an OpenShift cluster. Helm charts are a convenient way to package and deploy applications on Kubernetes.Below I'll guide you through the Pulumi program that deploys the Quickwit Helm chart. Quickwit is a search server that ingests large amounts of data and makes it searchable in real-time.
In this program, you will:
- Establish a connection with the Kubernetes cluster (OpenShift in this case).
- Use the
Chart
resource from Pulumi's Kubernetes provider to deploy the Quickwit Helm chart.
Before you run this Pulumi program, ensure that:
- You have
kubectl
configured with access to your Openshift cluster. - You have the Pulumi CLI installed and your environment is set up with the required cloud credentials.
Here is the TypeScript program for deploying the Quickwit Helm chart to your OpenShift cluster:
import * as k8s from "@pulumi/kubernetes"; // Step 1: Using an existing Kubernetes cluster (OpenShift) where `kubectl` is already pointing to. const cluster = new k8s.Provider("openshift-provider", { // Assuming `kubectl` is already configured to communicate with your OpenShift cluster. // Replace the placeholder below with actual context name if needed. // kubeconfigContext: "your-openshift-cluster-context" }); // Step 2: Deploy the Quickwit Helm chart on OpenShift. const quickwitChart = new k8s.helm.sh.v3.Chart("quickwit-chart", { // Replace with the actual name of the Quickwit Helm chart repository. // Assuming the Quickwit chart is in a repo that is already added to your helm. // If not, you would have to add that repository first. repo: "quickwit-helm-repo", chart: "quickwit", // Make sure to specify the namespace where you want to deploy your chart or create it if needed. namespace: "quickwit-namespace", // You can modify default values by providing a custom `values` object here. // For example: // values: { // service: { type: "ClusterIP" }, // ... other custom values ... // }, }, { provider: cluster }); // Optional: Export the Quickwit service endpoint if it is a LoadBalancer or NodePort. export const quickwitServiceEndpoint = quickwitChart.getResourceProperty( "v1/Service", "quickwit-service", "status" ).apply(status => status.loadBalancer.ingress[0].ip);
This code first configures a Kubernetes provider pointing to your existing OpenShift cluster. It assumes that your
kubectl
is already set up to communicate with your cluster. If your context isn't set as default, you might need to provide the specifickubeconfigContext
.Next, we create a new Helm chart resource using the
k8s.helm.sh.v3.Chart
class, specifying the Quickwit Helm chart and the namespace where the chart should be deployed. You might need to add the Quickwit Helm repository to your Helm CLI before executing this Pulumi program if it's not already added. This step also assumes that the Quickwit Helm chart is hosted in a Helm repository. If it's not in a repository, you could also use a local chart path.Finally, we have an optional export that outputs the Quickwit service endpoint. It's especially useful if you have a service of type
LoadBalancer
orNodePort
and want to connect to your Quickwit instance from outside the cluster.To run the above program:
- Save the code to a file named
index.ts
. - Run
pulumi up
to execute the Pulumi program. - Confirm the deployment by checking the output and resources in the OpenShift web console or by using
kubectl
.
Keep in mind Pulumi's infrastructure-as-code approach allows you to manage and version your deployments alongside your application code, providing a single source of truth for your infrastructure.