1. Deploy the voltha-go-controller helm chart on Azure Managed Openshift Service


    To deploy the voltha-go-controller Helm chart on Azure Managed OpenShift Service, we need to perform a few steps:

    1. Set up an Azure Managed OpenShift Cluster.
    2. Ensure we have the necessary configuration to interact with the Kubernetes API provided by the OpenShift cluster.
    3. Use the Helm Chart resource from Pulumi Kubernetes Provider to deploy voltha-go-controller.

    Let's go through the steps and the corresponding Pulumi code required to achieve this. The example below is written in TypeScript.

    Step 1: Set up an Azure Managed OpenShift Cluster

    First, we need an OpenShift cluster on Azure. For this, we use the azure-native.containerservice.OpenShiftManagedCluster resource. We need to provide it with the necessary configuration such as location, resource group, and OpenShift version. We assume you already have a resource group created.

    Step 2: Configure Kubernetes Provider

    Once the cluster is provisioned, we need to configure the Pulumi Kubernetes provider with the appropriate kubeconfig, which we can obtain from the OpenShift cluster's outputs. This allows us to communicate with the cluster's Kubernetes API.

    Step 3: Deploy Helm Chart

    After setting up the Kubernetes provider, we move on to deploying the voltha-go-controller Helm chart. For this, we use the helm.v3.Chart resource, where we specify the chart name, version, and any values we want to override.

    Below is a complete Pulumi program that performs these steps:

    import * as pulumi from "@pulumi/pulumi"; import * as azure_native from "@pulumi/azure-native"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create an Azure Managed OpenShift Cluster. const clusterResourceGroup = new azure_native.resources.ResourceGroup("clusterResourceGroup", { location: "East US", // Replace with your desired location // Other properties as needed. }); const openshiftCluster = new azure_native.containerservice.OpenShiftManagedCluster("myOpenShiftCluster", { resourceName: "myOpenShiftCluster", resourceGroupName: clusterResourceGroup.name, // Replace these with actual values or Pulumi Config references location: clusterResourceGroup.location, openShiftVersion: "4.3", // Replace with the OpenShift version you need // ... Other necessary configurations like network profile, master and agent pool profiles }); // Step 2: Set up the Pulumi Kubernetes provider to interact with the OpenShift cluster. const creds = pulumi.all([openshiftCluster.name, clusterResourceGroup.name]).apply(([clusterName, rgName]) => { return azure_native.containerservice.listOpenShiftManagedClusterAdminCredentials({ resourceName: clusterName, resourceGroupName: rgName, }); }); const k8sProvider = new k8s.Provider("openshiftK8s", { kubeconfig: creds.apply(c => c.kubeconfigs[0].value), // This extracts the kubeconfig from the credentials. }); // Step 3: Deploy the voltha-go-controller Helm chart. const volthaChart = new k8s.helm.v3.Chart("voltha-go-controller", { chart: "voltha-go-controller", // Replace with the Helm repository that hosts voltha-go-controller if needed fetchOpts: { repo: "http://charts.example.com/", }, version: "1.0.0", // Use the appropriate chart version // values: {} // Specify any custom values file or configuration (optional) }, { provider: k8sProvider }); // Export the Kubernetes ingress endpoint to access voltha-go-controller, if applicable. export const volthaIngressEndpoint = volthaChart.getResourceProperty("v1/Service", "voltha-go-controller", "status") .apply(status => status.loadBalancer.ingress[0].ip || status.loadBalancer.ingress[0].hostname);

    In this program, we:

    • Create a resource group for our OpenShift cluster if it does not exist.
    • Provision an Azure Managed OpenShift cluster with a specified version and other required properties.
    • List the administrator credentials of the OpenShift cluster required to interact with the cluster through Kubernetes APIs.
    • Initialize a Pulumi Kubernetes provider with the obtained kubeconfig.
    • Deploy the voltha-go-controller Helm chart to the OpenShift cluster using the Pulumi Kubernetes Provider.

    We also export the ingress endpoint of the voltha-go-controller service, which can be used to access the deployed application.

    To run this Pulumi program, save it in a file (e.g., index.ts), and then execute it using the pulumi up command through the Pulumi CLI. Ensure that you have the Azure plugin, Pulumi CLI, and required npm packages installed.