1. Deploy the reportportal helm chart on AWS EKS


    To deploy the ReportPortal Helm chart on AWS EKS, you need to follow a series of steps. First, you'll create an EKS cluster, which involves setting up the necessary networking and IAM roles. Once the cluster is ready, you'll then use the Pulumi Kubernetes provider to deploy ReportPortal using its Helm chart.

    Below you'll find a Pulumi program that demonstrates how to:

    1. Create an EKS cluster using the awsx and eks packages, which provide higher-level abstractions that simplify cluster creation.
    2. Deploy the ReportPortal Helm chart to the EKS cluster using the kubernetes package.

    This program is written in TypeScript and will require you to have AWS credentials configured, along with Pulumi CLI and kubectl installed on your machine.

    Note: Ensure to replace placeholder values like <ACCOUNT_ID> with your actual AWS Account ID.

    import * as awsx from "@pulumi/awsx"; import * as eks from "@pulumi/eks"; import * as kubernetes from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Create a VPC for the EKS cluster. const vpc = new awsx.ec2.Vpc("reportportal-vpc", { numberOfAvailabilityZones: 3, // Spread the VPC across three AZs for availability }); // IAM roles for the EKS cluster. These provide AWS permissions to your EKS nodes. const clusterRole = new aws.iam.Role("reportportal-cluster-role", { assumeRolePolicy: aws.iam.assumeRolePolicyForPrincipal({ Service: "eks.amazonaws.com" }), managedPolicyArns: [ "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy", "arn:aws:iam::aws:policy/AmazonEKSServicePolicy", ], }); const nodeRole = new aws.iam.Role("reportportal-node-role", { assumeRolePolicy: aws.iam.assumeRolePolicyForPrincipal({ Service: "ec2.amazonaws.com" }), }); // Attach the necessary policies for workers. new aws.iam.RolePolicyAttachment("reportportal-node-attach-0", { policyArn: "arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy", role: nodeRole.name, }); new aws.iam.RolePolicyAttachment("reportportal-node-attach-1", { policyArn: "arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy", role: nodeRole.name, }); // Create an EKS cluster with the created VPC and IAM roles. const cluster = new eks.Cluster("reportportal-cluster", { vpcId: vpc.id, subnetIds: vpc.privateSubnetIds, instanceRoles: [nodeRole], // Specify the version of Kubernetes you wish to deploy version: "1.21", }); // Once the EKS cluster is created, we can create a Kubernetes provider that uses the cluster's kubeconfig. const k8sProvider = new kubernetes.Provider("k8s-provider", { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Now you can deploy the ReportPortal Helm chart using the k8sProvider. const reportPortalChart = new kubernetes.helm.v3.Chart("reportportal", { repo: "stable", // Must point to the repository that contains the ReportPortal chart chart: "reportportal", version: "1.0.0", // Replace with the actual chart version values: { // Add custom values for ReportPortal deployment // Example: serviceType: "LoadBalancer" }, }, { provider: k8sProvider }); // Expose the EKS cluster endpoint to access ReportPortal export const clusterEndpoint = cluster.endpoint; // You can also export the kubeconfig for manual `kubectl` usage or any other purposes export const kubeConfig = cluster.kubeconfig; // If the ReportPortal chart exposes a service or ingress, you may export it here // e.g., export const reportPortalUrl = reportPortalChart.getResource(...)

    Let's break down the code:

    1. We start by creating a new VPC with multiple availability zones using the awsx package to ensure high availability for our EKS cluster.

    2. We define IAM roles for the EKS cluster and attach the necessary IAM policies that allow EKS and EC2 to manage resources on behalf of Kubernetes.

    3. We create the EKS cluster, specifying the VPC and subnets it should use as well as the IAM roles for the nodes.

    4. We define a Kubernetes provider which allows us to interact with the cluster using Pulumi's Kubernetes resources.

    5. We deploy the ReportPortal Helm chart into our Kubernetes cluster by creating a Helm chart resource, specifying the repository and chart version. You may also provide custom values for the deployment through the values property.

    6. Finally, we export the cluster endpoint and kubeconfig that can be used to interact with the