1. Deploy the reportportal helm chart on Azure Kubernetes Service (AKS)

    TypeScript

    To deploy the ReportPortal Helm chart on the Azure Kubernetes Service (AKS), we will create an AKS cluster using Pulumi and then deploy the Helm chart to that cluster. The steps we follow are:

    1. Create a new AKS cluster.
    2. Install the Helm chart on the cluster.

    We will use the azure-native package to provision the AKS cluster and then the kubernetes package to deploy the ReportPortal Helm chart.

    For this program, you should have the following pre-configured:

    • The Azure CLI installed and configured with credentials that have permissions to create resources in your Azure subscription.
    • Pulumi CLI installed.
    • The required cloud provider and Pulumi stacks properly set up.

    Now let's start with the Pulumi TypeScript program:

    import * as pulumi from '@pulumi/pulumi'; import * as azure from '@pulumi/azure-native'; import * as k8s from '@pulumi/kubernetes'; // Step 1: Create an AKS Cluster const resourceGroup = new azure.resources.ResourceGroup("my-resource-group"); const aksCluster = new azure.containerservice.ManagedCluster("my-aks-cluster", { resourceGroupName: resourceGroup.name, agentPoolProfiles: [{ count: 1, maxPods: 110, mode: "System", name: "agentpool", osType: "Linux", vmSize: "Standard_DS2_v2", }], dnsPrefix: `${pulumi.getStack()}-kube`, enableRBAC: true, kubernetesVersion: "1.18.14", }); // Export the Kubeconfig to access the AKS cluster from Kubectl export const kubeconfig = pulumi.all([aksCluster.name, resourceGroup.name]).apply(([name, rgName]) => { return azure.containerservice.listManagedClusterUserCredentials({ resourceName: name, resourceGroupName: rgName, }); }).apply(c => { const kubeconfig = c.kubeconfigs[0].value; return Buffer.from(kubeconfig, 'base64').toString(); }); // Step 2: Install the ReportPortal Helm chart on the AKS cluster const aksKubeconfig = new pulumi.Kubeconfig(kubeconfig); // Use the kubeconfig to connect a k8s provider to the AKS cluster where we will deploy the Helm chart const k8sProvider = new k8s.Provider("k8s-provider", { kubeconfig: aksKubeconfig, }); // Deploy the ReportPortal Helm chart const reportPortalChart = new k8s.helm.v3.Chart("reportportal", { chart: "reportportal", version: "5.2.0", // Specify the version of ReportPortal you want to deploy fetchOpts: { repo: "https://reportportal.github.io/helmchart/", // Helm chart repository }, }, { provider: k8sProvider }); // Export the ReportPortal service endpoint export const reportPortalEndpoint = reportPortalChart.getResourceProperty("v1/Service", "reportportal", "status");

    In this program:

    • We start by creating a new resource group and an AKS cluster with one node pool within that resource group.
    • We then configure RBAC for the cluster and specify the desired version of Kubernetes.
    • We export the kubeconfig for the AKS cluster, which is used to interact with the cluster via kubectl or any Kubernetes client.
    • Using the exported kubeconfig, we create a Pulumi Kubernetes Provider that will allow us to deploy Kubernetes resources to the AKS cluster.
    • Finally, we install the ReportPortal Helm chart using the k8s.helm.v3.Chart resource. We provide the chart name, the version, and the repository where the Helm chart is located.
    • We export the endpoint for the ReportPortal service, making it easy to access once deployed.

    Once you have this code in a index.ts file, you can deploy it by running pulumi up. This will provision the AKS cluster and deploy ReportPortal to it. After the deployment is complete, you can use the exported kubeconfig to access your cluster and ReportPortal service.

    Please replace the placeholder values in the code (like the ReportPortal chart version if needed) with the actual ones appropriate for your deployment.