1. Deploy the ibm-websphere-liberty helm chart on Oracle Kubernetes Engine (OKE)

    TypeScript

    Deploying the IBM WebSphere Liberty Helm chart on Oracle Kubernetes Engine (OKE) involves a few key steps that we will go through together. To achieve this, we need to:

    1. Set up the OKE Cluster: Before deploying any applications, an Oracle Kubernetes Engine cluster must be provisioned and ready for use.
    2. Configure Kubernetes Provider: We need to configure Pulumi to use the Kubernetes provider that will interact with our OKE cluster.
    3. Deploy IBM WebSphere Liberty Helm Chart: After setting up the Kubernetes provider, we can then deploy the IBM WebSphere Liberty Helm chart to the cluster.

    Below is a Pulumi TypeScript program that explains and demonstrates these steps.

    Before we begin writing the Pulumi code, make sure you have:

    • Installed Pulumi CLI and set it up with your Pulumi account.
    • Configured access to your Oracle Cloud Infrastructure (OCI) account and the OCI CLI.
    • Installed Node.js and set up the TypeScript environment.

    Now, here's the Pulumi TypeScript program:

    import * as k8s from "@pulumi/kubernetes"; import * as oci from "@pulumi/oci"; // Load your OCI configuration, this is typically established during your `oci` CLI setup const config = new pulumi.Config(); // 1. Set up your OCI provider - this will use your default OCI configuration // Make sure to replace `compartmentId` with your own compartment id from OCI const provider = new oci.Provider("oci", { compartmentId: config.require("compartmentId"), }); // You should have already an Oracle Kubernetes Engine (OKE) cluster set up and running. // We will retrieve this cluster using its OKE Cluster ID, make sure to replace it with your actual cluster id. const okeClusterId = config.require("okeClusterId"); const cluster = oci.core.Cluster.get("my-cluster", okeClusterId, { provider: provider }); // 2. Configure Kubernetes provider to interact with the OKE cluster. // This provider will use the kubeconfig file that we obtain from the OKE cluster's details. const k8sProvider = new k8s.Provider("oke-k8s", { kubeconfig: cluster.kubeconfig, }); // 3. Deploy IBM WebSphere Liberty Helm chart to the cluster. // We will use the `kubernetes.helm.v3.Chart` resource which is capable of deploying Helm charts. // You can specify the chart version, values, and other configurations as required. const ibmWebsphereLibertyChart = new k8s.helm.v3.Chart( "ibm-websphere-liberty-chart", { chart: "ibm-websphere-liberty", version: "1.0.0", // specify correct chart version fetchOpts: { repo: "https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/helm/webshpere-liberty/", // specify correct Helm repo URL }, // Specify any custom values needed for the chart values: { // ... (custom values go here) }, }, { provider: k8sProvider } ); // Export the public IP or hostname of the IBM WebSphere Liberty application if available. export const ibmWebsphereLibertyPublicIp = ibmWebsphereLibertyChart.getResourceProperty( "v1/Service", "ibm-websphere-liberty-service", // Make sure to replace with the actual service name from the chart "status" ).apply(status => status.loadBalancer.ingress[0].ip);

    Explanation:

    • We start by importing the necessary Pulumi packages for Kubernetes and OCI.
    • oci.Provider is configured with your compartment ID obtained from the OCI configuration or Pulumi config.
    • We fetch details of an existing OKE cluster using its ID.
    • A Kubernetes provider is created using the OKE cluster's kubeconfig, allowing Pulumi to interact with your OKE cluster.
    • We declare the IBM WebSphere Liberty Helm chart deployment using k8s.helm.v3.Chart. Ensure the chart version and repository URL are correct.
    • Optionally, we export the public IP of the WebSphere Liberty service, which can be used to access the application.

    Remember to replace placeholder values like okeClusterId, compartmentId, and any custom values in the values field with your specific details.

    After you have this program ready, you can run it using the below Pulumi CLI commands:

    • pulumi stack init dev to initialize a new stack.
    • pulumi up to preview and deploy the changes.

    This program, once executed, will deploy the IBM WebSphere Liberty Helm chart to your Oracle Kubernetes Engine cluster. Make sure the chart name and version match the actual Helm chart details you wish to deploy.