Deploy the watson-nlp helm chart on Opensshift
TypeScriptTo deploy a Helm chart on OpenShift using Pulumi, you would use the
kubernetes.helm.sh/v3.Chart
resource from the Pulumi Kubernetes Provider. This allows you to specify the Helm chart you want to deploy, along with any values or configuration you might need.To deploy the Watson NLP Helm chart on OpenShift, you would need to follow these steps:
- Ensure you have an OpenShift cluster available and that you have access to it via
kubectl
. - Have Pulumi installed on your machine and be familiar with how to create a new Pulumi project.
- Ensure that the Helm chart for Watson NLP is available in a Helm repository or has its chart definition accessible.
Below is a TypeScript program using Pulumi to deploy the Watson NLP Helm chart on an OpenShift cluster. This assumes that you have a running OpenShift cluster configured with
kubectl
,helm
, andpulumi
.import * as k8s from "@pulumi/kubernetes"; // Define the Watson NLP Helm chart details. const watsonNlpChart = new k8s.helm.v3.Chart("watson-nlp", { // Specify the chart repository and name. chart: "watson-nlp", version: "x.y.z", // Replace with the version you wish to deploy // Add the repository where the chart is available. fetchOpts: { repo: "https://ibm-watson-nlp-charts-repository.example.com/", // Replace with the actual chart repository URL }, // The namespace where you want to deploy the chart. namespace: "default", // Provide any specific values needed for the Watson NLP Helm chart. values: { // Replace the following with real configuration parameters according to the chart's requirements. key1: "value1", key2: "value2", }, }); // Optionally, you can export the name of the release. export const releaseName = watsonNlpChart.getResourceProperty("v1/Service", "watson-nlp", "metadata").apply(m => m.name);
Let's break down what this program does:
-
We imported the
@pulumi/kubernetes
library, which includes the functionality for deploying Kubernetes resources, including Helm charts. -
We created a new instance of
k8s.helm.v3.Chart
. This is the Pulumi resource that represents a Helm chart. -
The
chart
option specifies the name of the chart we want to install, in this case,"watson-nlp"
. -
The
version
option specifies the chart version to deploy. Make sure to replace"x.y.z"
with the actual chart version you want to install. -
The
fetchOpts.repo
tells Pulumi where the Helm chart repository is located. You should replace the placeholder URL with the actual repository URL where the Watson NLP Helm chart is hosted. -
The
namespace
is where you want your Helm chart to be deployed in the OpenShift cluster. -
The
values
field is a dictionary that contains configuration values for the Helm chart. This is equivalent to the content you would place in avalues.yaml
file or pass as--set
options during a manualhelm install
command. -
The export at the end is optional and it allows you to get information such as service names, URLs, etc., after the deployment is completed.
Before running this Pulumi program, make sure you initialize a new Pulumi project, install necessary Pulumi packages, and have the OpenShift
kubectl
configuration ready on your machine.To create a new Pulumi project, you can follow these steps in your command line:
# Create a new Pulumi project directory mkdir watson-nlp-openshift cd watson-nlp-openshift # Create a new Pulumi project using TypeScript pulumi new kubernetes-typescript
Follow the prompts to initialize the project. Then you would replace the contents of
index.ts
with the provided TypeScript code above.To run the Pulumi program, execute the following command:
pulumi up
This will preview the changes and, upon confirmation, will apply them to your OpenShift cluster, deploying the Watson NLP Helm chart in the process.
- Ensure you have an OpenShift cluster available and that you have access to it via