1. Deploy the openwhisk helm chart on AWS EKS

    TypeScript

    To deploy the OpenWhisk Helm chart on AWS EKS using Pulumi, you need to:

    1. Create an EKS cluster: An EKS cluster is a managed Kubernetes service provided by AWS that takes care of much of the maintenance and operational overhead.
    2. Deploy Helm chart on Kubernetes: Helm is a package manager for Kubernetes, which allows you to define, install, and upgrade complex Kubernetes applications.

    Below is a step-by-step guide, followed by the corresponding Pulumi code to accomplish this.

    Step-by-Step Guide

    Step 1: Create an EKS Cluster

    First, you’ll need to define an EKS cluster in your Pulumi program. The eks.Cluster is a high-level component that encapsulates the AWS EKS service.

    Step 2: Deploy Helm chart on EKS

    After creating the EKS cluster, use the kubernetes.helm.v3.Chart resource to deploy the OpenWhisk Helm chart. You need to specify the Helm chart details such as name, version, and values that are specific to OpenWhisk.

    Step 3: Export Necessary Endpoints

    Once your resources are defined, you can export important information, such as the EKS cluster name and the Kubernetes configuration required to connect to your cluster programmatically.

    Prerequisites

    Before running the Pulumi code, ensure you have:

    • Installed Pulumi CLI and authenticated to your AWS account.
    • Installed the necessary Pulumi providers (aws, kubernetes, eks, helm).
    • Configured AWS credentials that have permissions to create the required resources.

    Pulumi Program

    import * as pulumi from '@pulumi/pulumi'; import * as aws from '@pulumi/aws'; import * as eks from '@pulumi/eks'; import * as k8s from '@pulumi/kubernetes'; // Create an EKS cluster const cluster = new eks.Cluster('my-cluster', { desiredCapacity: 2, minSize: 1, maxSize: 2, storageClasses: "gp2", deployDashboard: false, }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Use the pulumi/kubernetes provider to connect to the created EKS cluster const provider = new k8s.Provider('k8s-provider', { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Deploy the OpenWhisk Helm chart on the EKS cluster const openWhiskHelmChart = new k8s.helm.v3.Chart('openwhisk', { chart: "openwhisk", version: "1.0.0", // specify the version of the chart fetchOpts: {repo: "https://openwhisk.apache.org/charts"}, // replace with the correct Helm repository }, {provider: provider}); // Export the OpenWhisk endpoint export const openWhiskEndpoint = openWhiskHelmChart.getResourceProperty('v1/Service', 'nginx', 'status').apply(status => status.loadBalancer.ingress[0].ip); // The program below creates an EKS cluster and deploys the OpenWhisk Helm chart into it. // - The `desiredCapacity`, `minSize`, and `maxSize` arguments specify the size of the EKS cluster. // - The kubeconfig output can be used to connect to the cluster using `kubectl`. // - The `provider` object configures the Kubernetes provider to use the created EKS cluster. // - The `openWhiskHelmChart` represents the deployment of the OpenWhisk chart into the created Kubernetes cluster.

    In the code above:

    • eks.Cluster creates a new managed Kubernetes cluster in AWS EKS.
    • k8s.Provider sets up the Pulumi Kubernetes provider with the kubeconfig of the newly created EKS cluster.
    • k8s.helm.v3.Chart deploys the OpenWhisk Helm chart to the Kubernetes cluster using the specified version and repository.

    Please ensure the Helm chart version and repository URL are up to date and available. You should replace "1.0.0" and the repo string with the appropriate Helm chart version and repository of OpenWhisk.

    After running this code with Pulumi, you should have a running EKS cluster with the OpenWhisk server deployed on it. You can use the exported kubeconfig to manage your cluster with kubectl and interact with OpenWhisk as necessary.