1. Deploy the mongodb-atlas-operator-crds helm chart on AWS EKS

    TypeScript

    To deploy the mongodb-atlas-operator-crds Helm chart on AWS EKS, we're going to complete several steps using Pulumi's TypeScript SDK. Here's what we'll do:

    1. Set up an AWS EKS cluster: We'll create a Kubernetes cluster in AWS using the eks.Cluster class from the Pulumi EKS package.
    2. Configure AWS IAM roles for the EKS cluster: We'll ensure the EKS cluster has the right IAM role(s) that allow it to manage resources within your AWS account.
    3. Deploy the Helm chart onto the EKS cluster: We'll use the kubernetes.helm.sh/v3.Chart class from the Pulumi Kubernetes provider to deploy the mongodb-atlas-operator-crds Helm chart.

    Below is the detailed Pulumi program written in TypeScript that accomplishes these steps.

    First, we'll need to install the necessary Pulumi packages. You can install these dependencies using npm with the following commands:

    npm install @pulumi/pulumi npm install @pulumi/awsx npm install @pulumi/eks npm install @pulumi/kubernetes

    Here's the TypeScript program that defines and deploys these resources:

    import * as pulumi from "@pulumi/pulumi"; import * as awsx from "@pulumi/awsx"; import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create an EKS cluster const cluster = new eks.Cluster("my-eks-cluster", { instanceType: "t2.medium", // Choose an appropriate instance type for your needs desiredCapacity: 2, // Specify the desired number of worker nodes minSize: 1, // Specify the minimum number of worker nodes maxSize: 3, // Specify the maximum number of worker nodes // For more options, refer to the EKS documentation: https://www.pulumi.com/registry/packages/eks/api-docs/cluster/ }); // Step 2: Use the EKS cluster as the provider for subsequent resources const k8sProvider = new k8s.Provider("k8s-provider", { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Step 3: Deploy the mongodb-atlas-operator-crds Helm chart const mongodbAtlasOperatorCRDs = new k8s.helm.sh.v3.Chart("mongodb-atlas-operator-crds", { chart: "mongodb-atlas-operator-crds", version: "0.6.0", // Replace this with the desired chart version fetchOpts: { repo: "https://mongodb.github.io/helm-charts" }, // Make sure to use the correct Helm repo URL }, { provider: k8sProvider }); // Export the cluster's kubeconfig and the Helm release status export const kubeconfig = cluster.kubeconfig; export const mongodbAtlasOperatorStatus = mongodbAtlasOperatorCRDs.status;

    Let's go over what the code does:

    • We create an AWS EKS cluster with eks.Cluster, specifying the desired instance type and the desired number of worker nodes. Adjust these values based on your workload requirements.
    • We create a provider that uses the kubeconfig from the EKS cluster, which allows us to deploy Kubernetes resources to it.
    • We then deploy the mongodb-atlas-operator-crds Helm chart by specifying the chart name, version, and repository URL. This will install the necessary CRDs and operator to manage MongoDB Atlas resources.
    • Finally, we export the kubeconfig and Helm release status, so they can be easily accessed from the Pulumi CLI after deployment.

    After writing this program in a file (e.g., index.ts), you would run it with the Pulumi CLI tool. Make sure to set up your AWS credentials and have the Pulumi CLI installed before running these commands:

    pulumi up

    This command asks for confirmation before proceeding to create the infrastructure. Once confirmed, it will provision the EKS cluster and deploy the specified Helm chart onto it.