Deploy the pubsub-emulator helm chart on Azure Managed Openshift Service
TypeScriptTo deploy a Helm chart on an Azure Managed OpenShift service, you'll need to follow these steps:
-
Set up an Azure Managed OpenShift Cluster: This cluster will be the Kubernetes environment where your Helm chart will be deployed. You will need to create an OpenShift cluster using Pulumi's
azure-native.containerservice.OpenShiftManagedCluster
resource. -
Install the Helm chart: Once you have a Kubernetes cluster set up, you can deploy Helm charts to it. You'll use the Pulumi
kubernetes
provider and theChart
resource to deploy your specificpubsub-emulator
Helm chart to the OpenShift cluster.
Here is a comprehensive program to achieve this. The program is in TypeScript, and it uses Pulumi to orchestrate the deployment.
Pre-requisite: Ensure you have Pulumi installed, and you are logged in to Azure CLI with the right permissions to create resources in your subscription.
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 openShiftCluster = new azure_native.containerservice.OpenShiftManagedCluster("myOpenShiftCluster", { // Update with your own values resourceGroupName: "myResourceGroup", location: "East US", // choose an appropriate Azure location here openShiftVersion: "4.3", // specify your desired OpenShift version agentPoolProfiles: [{ name: "agentpool", count: 3, // the number of worker nodes vmSize: "Standard_DS2_v2", // VM size for your worker nodes role: "compute", // the role for the agent pool }], /* Replace the network profile as needed to fit within your VNET example: networkProfile: { vnetId: "/subscriptions/.../resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNET", peerVnetId: "...", // Define your CIDR as needed }, */ masterPoolProfile: { name: "masterpool", count: 3, // number of master nodes, pick according to your redundancy needs vmSize: "Standard_DS2_v2", // VM size for your master nodes }, // Define authentication profiles, DNS configuration etc., as necessary. }); // Step 2: Deploy the Helm chart of pubsub-emulator on OpenShift // Before this step make sure that Helm is installed on your machine, and the pubsub-emulator chart is available for installation. // You might need to add the Helm chart repository that contains the pubsub-emulator. const pubsubEmulatorChart = new k8s.helm.v3.Chart("pubsub-emulator-chart", { // Chart repository URL where `pubsub-emulator` is located or could be a a local path. chart: "pubsub-emulator", // Kubernetes namespace where the chart should be deployed. Defaults to `default` if not specified. namespace: "default", // Values to pass to the chart for customization. Example: { key: "value" } values: {}, // Specify which cluster to deploy to, using the kubeconfig provided by Azure. // In this case we get the kubeconfig from the created OpenShift Cluster. // Note: this step assumes that the cluster's `.kubeconfig` is exposed correctly. // If required, fetch the kubeconfig from Azure CLI or Azure portal and supply it here. fetchOpts: { repo: "http://<YOUR_HELM_REPO_URL>", }, }, { provider: new k8s.Provider("k8s-provider", { kubeconfig: "CONTENT_OF_YOUR_KUBECONFIG" }) }); // Export the kubeconfig of the cluster and the public hostname of the pubsub emulator app. export const kubeconfig = pulumi.secret(openShiftCluster.kubeConfigRaw); export const pubsubEmulatorHostname = pubsubEmulatorChart.getResourceProperty('v1/Service', 'pubsub-emulator-service', 'status').apply(status => status.loadBalancer.ingress[0].hostname);
Here's what the program does:
-
Initializes the OpenShift Cluster: This sets up the managed OpenShift cluster by specifying the name, location, version, profile for agent and master pool and other necessary configurations.
-
Deploys the Helm Chart: It sets up the pubsub-emulator Helm chart by specifying the namespace and values.
Remember the following:
- Replace placeholders like
"myResourceGroup"
,"East US"
,"4.3"
with your Azure resource group, preferred location, desired OpenShift version, and network configurations for the cluster. - Ensure you have access to the pubsub-emulator Helm chart and know the repository URL where it is located.
- In the
Chart
resource, customize thenamespace
or any values (values: {}
) as required by the pubsub-emulator Helm chart. - You will
-