1. Deploy the openwhisk helm chart on Kubernetes


    To deploy the OpenWhisk Helm chart on Kubernetes using Pulumi, you'll use the kubernetes.helm.v3.Chart resource which is a component that represents a Helm chart in a Pulumi program. Helm is a package manager for Kubernetes and provides a way to define, install, and upgrade even the most complex Kubernetes applications.

    Here's how you can create a Pulumi program to deploy the OpenWhisk Helm chart:

    1. Set up your Kubernetes cluster - To deploy OpenWhisk, you first need a Kubernetes cluster. For this program, we'll assume you have a cluster up and running and configured with kubectl.

    2. Install Pulumi - If you haven't already, install Pulumi.

    3. Create a new Pulumi project - Create a project and set the appropriate stack, which determines the environment to deploy to (dev, staging, production, etc.).

    4. Add dependencies - You will need the @pulumi/kubernetes package to interact with Kubernetes resources, which you can add by running npm install @pulumi/kubernetes.

    The following TypeScript program demonstrates how to deploy OpenWhisk using Helm. It includes comments explaining each part of the program:

    import * as k8s from "@pulumi/kubernetes"; // Create a Helm Chart for OpenWhisk. // Note: Ensure that you've added the OpenWhisk Helm repository to your Helm CLI and Pulumi knows about it, // or supply the `repo` property if it's hosted on a remote Helm Chart repository. const openwhiskChart = new k8s.helm.v3.Chart("openwhisk", { chart: "openwhisk", // The name of the chart. Replace with accurate chart reference as required. namespace: "openwhisk", // Specify the namespace where OpenWhisk should be installed. Create it if it doesn't exist. values: { // Supply any specific configuration values here. // These values will configure OpenWhisk according to your requirements. // Refer to the OpenWhisk chart's 'values.yaml' for available configuration options. }, // Optional: Specify the version of the chart if not wanting to use the latest. // version: "chart-version", }); // Outputs export const openwhiskUrl = openwhiskChart.getResourceProperty("v1/Service", "openwhisk-nginx", "status").apply(status => status.loadBalancer.ingress[0].ip);

    In the program:

    • We import the @pulumi/kubernetes library, which contains the necessary methods to deploy resources to Kubernetes.
    • We define a new Helm chart for OpenWhisk, assuming the chart is simply named "openwhisk." You might need to replace this with the appropriate chart name if different.
    • In the values object, you may provide the required configuration values according to your OpenWhisk setup needs. These values override the defaults in the Helm chart's values.yaml file.
    • Optionally, you can specify the chart version with the version key if you want to pin it to a specific version.
    • The output exports the IP address of the OpenWhisk deployment, assuming it is exposed via a LoadBalancer service named openwhisk-nginx. If the service has a different name or you are using a different type of service (like NodePort or ClusterIP), you'll need to modify the output accordingly.

    To run this program, you would save it to a file (e.g., index.ts), perform a pulumi up, and Pulumi would handle the deployment process, including setting up the Helm release and outputting the URL at which OpenWhisk is accessible.