1. Deploy the watson-nlp helm chart on Oracle Kubernetes Engine (OKE)

    TypeScript

    To deploy a Helm chart to Oracle Kubernetes Engine (OKE) using Pulumi, you'll need to set up a few things:

    1. A Kubernetes cluster in Oracle Cloud Infrastructure (OCI) using the oci.ContainerEngine.Cluster resource.
    2. If you haven't already, you'll need to set up the OCI provider and configure your Kubernetes provider to connect to the OKE cluster.

    Here's how you would write a Pulumi program in TypeScript to deploy the Watson NLP Helm chart to an OKE cluster:

    1. Set up the OCI Kubernetes cluster. You would use the oci.ContainerEngine.Cluster resource for this.

    2. Once the cluster is set up, you would configure Pulumi to use the cluster's kubeconfig for deploying applications.

    3. You would then use the kubernetes.helm.v3.Chart resource from Pulumi's Kubernetes provider to deploy the Watson NLP Helm chart.

    Here's the detailed code explaining the steps:

    import * as oci from "@pulumi/oci"; import * as kubernetes from "@pulumi/kubernetes"; // Step 1: Configuring the OCI provider const provider = new oci.Provider("oci", { region: "<oci-region>", tenancyOcid: "<tenancy-ocid>", userOcid: "<user-ocid>", fingerprint: "<api-fingerprint>", privateKey: "<private-key>", }); // Step 2: Creating an OKE cluster const cluster = new oci.ContainerEngine.Cluster("okeCluster", { // Ensure you set the required properties such as compartmentId and vcnId. // This example is simplified for brevity. name: "myOkeCluster", kubernetesVersion: "v1.18.10", compartmentId: "<compartment-id>", vcnId: "<vcn-id>", options: { serviceLbConfig: { subnetIds: ["<subnet-id1>", "<subnet-id2>"], }, }, }, { provider }); // Step 3: Fetching kubeconfig to interact with the cluster const kubeconfig = cluster.kubeconfig // Assuming `kubeconfig` is exposed by `oci.ContainerEngine.Cluster` // Step 4: Create Kubernetes Provider using the kubeconfig from the OKE cluster const k8sProvider = new kubernetes.Provider("k8sProvider", { kubeconfig: kubeconfig, }); // Step 5: Deploying the Watson NLP Helm chart const watsonNlpChart = new kubernetes.helm.v3.Chart("watson-nlp", { chart: "watson-nlp", // Replace with the correct repository URL or chart location fetchOpts: { repo: "https://<helm-chart-repo>" }, // Specify the namespace and values according to your needs namespace: "nlp-services", values: { // Include necessary Watson NLP configuration values here }, }, { provider: k8sProvider }); // Export the Watson NLP service endpoint to access the application export const watsonNlpServiceUrl = watsonNlpChart.getResourceProperty("v1/Service", "watson-nlp", "status").apply(status => status.loadBalancer.ingress[0].hostname);

    This program will do the following:

    • Configure a provider for Oracle Cloud Infrastructure.
    • Create an OKE cluster to run Kubernetes applications.
    • Fetch the kubeconfig from the newly created OKE cluster, which is necessary to interact with the cluster programmatically.
    • Set up a Kubernetes provider with the kubeconfig from the OKE cluster; this allows Pulumi to deploy resources to your Kubernetes cluster.
    • Deploy the Watson NLP Helm chart into the specified namespace using the chart name and optionally specify configuration values for the deployment.
    • Export the endpoint URL if you wish to access the Watson NLP service from outside the cluster; this assumes your service is exposed with a load balancer. Adjust as necessary for your use case.

    Please modify the placeholder values such as <oci-region>, <tenancy-ocid>, <compartment-id>, <vcn-id> and others with actual values from your OCI setup. Also replace the <helm-chart-repo> with the Helm repository URL where the Watson NLP chart is located.

    You will need to perform pulumi up to apply and execute the deployment of your infrastructure. Ensure that you customize the program to fit your specific OCI and Kubernetes setup details.

    When you run the program, Pulumi will perform the following actions:

    • Provision an OKE cluster with the specified configuration using Oracle's cloud resources.
    • Set up the Kubernetes provider to manage the Kubernetes resources using the kubeconfig from OKE.
    • Deploy the Watson NLP Helm chart to your Kubernetes cluster.
    • Provide you with an endpoint URL to access the Watson NLP services, assuming it's configured with a load balancer.

    Remember to replace any sensitive information such as private keys or OCIDs with environment variables or the Pulumi configuration system for better security practices.