1. Deploy the mediawiki-dev helm chart on AWS EKS

    TypeScript

    To deploy the mediawiki-dev Helm chart on AWS EKS using Pulumi, we'll follow these steps:

    1. Set up an EKS cluster using the eks.Cluster resource.
    2. Deploy the mediawiki-dev Helm chart onto the EKS cluster using the kubernetes.helm.v3.Chart resource.

    The eks.Cluster resource is a high-level component that encapsulates the AWS EKS cluster's creation and configuration, making it simpler than working with low-level AWS resources directly. After setting up the cluster, we will get its kubeconfig to interact with the Kubernetes cluster.

    The kubernetes.helm.v3.Chart resource is used for deploying Helm charts. A Helm chart is a collection of pre-configured Kubernetes resources that can be deployed as a package into a Kubernetes cluster.

    Here is the Pulumi program in TypeScript that accomplishes this:

    import * as pulumi from "@pulumi/pulumi"; import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Create an EKS cluster. const cluster = new eks.Cluster("mediawiki-dev-cluster", { desiredCapacity: 2, // Number of worker nodes minSize: 1, // Minimum number of worker nodes maxSize: 3, // Maximum number of worker nodes storageClasses: "gp2", // Type of storage class deployDashboard: false, // Disable Kubernetes dashboard for security purposes }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Deploy the mediawiki-dev Helm chart onto the EKS cluster using a Chart resource. const mediawikiChart = new k8s.helm.v3.Chart("mediawiki-dev-chart", { chart: "mediawiki", version: "x.y.z", // replace 'x.y.z' with the exact chart version you want to deploy fetchOpts: { repo: "https://helm.example.com/", // replace with the actual Helm repo URL where mediawiki-dev chart is hosted }, }, { provider: cluster.provider }); // ensure that the Helm chart is installed in the created EKS cluster // Export the resulting URLs to access the deployed Mediawiki instance. // Assuming that the mediawiki-dev chart exposes a Service of type LoadBalancer. const mediawikiService = mediawikiChart.getResource("v1/Service", "mediawiki-dev"); export const mediawikiUrl = mediawikiService.status.apply(status => `http://${status.loadBalancer.ingress[0].hostname}`);

    This Pulumi program does the following:

    1. Imports required Pulumi packages.
    2. Creates an AWS EKS cluster with a specified number of worker nodes.
    3. Exports the kubeconfig of the created EKS cluster, which will be used to interact with the Kubernetes API.
    4. Declares the deployment of the mediawiki-dev Helm chart using the Chart resource from the @pulumi/kubernetes package.
    5. Exports the URL to access the Mediawiki application, assuming the Helm chart deploys a Service of type LoadBalancer.

    Please note that you need to replace x.y.z with the exact version of the mediawiki-dev Helm chart you want to deploy and the Helm repo URL with the actual URL where the mediawiki-dev chart is hosted. Also, be aware that some Helm charts require you to input values for certain configurable parameters; if that's the case with mediawiki-dev, you should include these parameters in the values object inside the Chart resource.

    Make sure you have the Pulumi CLI installed and configured with appropriate AWS credentials. When running this Pulumi program, it will provision resources on your AWS account, which might incur AWS charges.

    To run this Pulumi program:

    1. Save this code in a file, such as index.ts.
    2. Run pulumi up to preview and deploy the changes.
    3. After deployment, Pulumi provides the kubeconfig output, which you can use to interact with your Kubernetes cluster, and mediawikiUrl, the URL where your Mediawiki instance can be accessed.