1. Deploy the goalert helm chart on AWS EKS

    TypeScript

    To deploy the GoAlert Helm chart on AWS EKS using Pulumi, you'll need to create an EKS cluster and then deploy the Helm chart to it. Below, I'll detail the steps and the corresponding Pulumi program written in TypeScript to accomplish this task.

    1. Define your AWS and Kubernetes resources - Using @pulumi/aws, @pulumi/eks, and @pulumi/kubernetes packages, we will set up an EKS cluster and deploy the GoAlert Helm chart onto it.

    2. Create an EKS Cluster - We use the eks.Cluster component from the @pulumi/eks package because it simplifies the creation of an EKS cluster by abstracting away much of the complexity.

    3. Deploy the GoAlert Helm chart - With the kubernetes.helm.v3.Chart resource from the @pulumi/kubernetes package, we deploy the specified Helm chart to the EKS cluster.

    Let's write the 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", { instanceType: "t2.medium", desiredCapacity: 2, minSize: 1, maxSize: 2, storageClasses: "gp2", // specifying the gp2 storage class deployDashboard: false, // EKS dashboard is not required for GoAlert }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Create a Kubernetes provider instance that uses our cluster from above. const k8sProvider = new k8s.Provider("k8s-provider", { kubeconfig: cluster.kubeconfig, }); // Deploy the GoAlert Helm chart to the EKS cluster using the Kubernetes provider. const goAlertChart = new k8s.helm.v3.Chart("goalert", { chart: "goalert", version: "x.y.z", // specify the version of GoAlert Helm chart you want to deploy fetchOpts: { repo: "http://example.com/helm/charts", // change this to the actual Helm chart repository of GoAlert }, }, { provider: k8sProvider }); // Export the GoAlert service endpoint to access the instance. export const goAlertEndpoint = goAlertChart.getResourceProperty( "v1/Service", "goalert", "status" ).apply(status => status.loadBalancer.ingress[0].hostname || status.loadBalancer.ingress[0].ip);

    Explanation:

    • eks.Cluster Resource: Creates a new Amazon EKS cluster with specified settings such as instance type and capacity. The deployDashboard: false option is used to skip the deployment of the Kubernetes dashboard since it's not needed for this purpose.

    • Kubeconfig Export: Exports the kubeconfig of the newly created EKS cluster so that it can be used by the Kubernetes provider and kubectl.

    • Kubernetes Provider: This informs Pulumi how to communicate with the EKS cluster to deploy Kubernetes resources such as our Helm chart.

    • k8s.helm.v3.Chart Resource: Deploys the GoAlert Helm chart to your EKS cluster. You'll need to provide the correct Helm chart repository URL and choose the appropriate version of the GoAlert Helm chart you wish to deploy.

    • GoAlert Service Endpoint Export: After deploying the Helm chart, this code snippet exports the service endpoint of GoAlert, which can be used to access the GoAlert application.

    Remember to replace x.y.z with the version of GoAlert Helm chart you want to deploy and the correct Helm chart repository URL.

    To apply this Pulumi program, save it to a file named index.ts, and run the following Pulumi CLI commands:

    pulumi up

    This will prompt you to review the infrastructure plan and confirm the deployment. Once the deployment is complete, it will output the kubeconfig and the endpoint for the GoAlert application.