Deploy the infinispan helm chart on Azure Managed Openshift Service
TypeScriptTo deploy the Infinispan Helm chart on Azure Managed OpenShift Service using Pulumi, you'll need to take a few steps. First, you'll create an instance of the Azure Managed OpenShift service, and then you'll deploy the Infinispan Helm chart to it.
Below is the program that accomplishes this. The example is in TypeScript, which is a language supported by Pulumi for defining infrastructure as code.
Prerequisites
- You must have Pulumi CLI installed.
- You must have
kubectl
configured to interact with your Kubernetes clusters. - You must have an Azure account configured with the necessary permissions to create resources.
Step-by-Step Program
This program performs the following actions:
-
OpenShift Managed Cluster Creation: We begin by creating an Azure Managed OpenShift cluster within a specified resource group.
-
Helm Chart Deployment: We then deploy the Infinispan Helm chart to the OpenShift cluster we have created, using Pulumi's Kubernetes provider.
Here's the Pulumi TypeScript program:
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 resourceGroupName = 'myResourceGroup'; const clusterName = 'myOpenShiftCluster'; const openshiftCluster = new azure_native.containerservice.OpenShiftManagedCluster(clusterName, { // Provide required configuration for the cluster here // For example, location, network profiles, cluster version, // agent pool profiles (compute resources), master pool profile, etc. // The example below assumes the minimum necessary properties have been set resourceName: clusterName, resourceGroupName, location: 'eastus', // Be sure to use a location that supports Azure Red Hat OpenShift // Make sure to provide the correct OpenShift version supported in your selected location openShiftVersion: '4.6', // Network profile configuration // VNet and subnet IDs need to be replaced with actual values networkProfile: { vnetCidr: '10.0.0.0/8', peerVnetId: null, // Replace with the VNet you would like to peer with, if applicable }, // Master and Agent Pool Profile setup // These would typically include VM size, subnet CIDR, and count of instances masterPoolProfile: { // Replace with your actual required settings count: 1, vmSize: 'Standard_D8s_v3', }, agentPoolProfiles: [{ // Replace with your actual required settings name: 'agentpool', count: 2, vmSize: 'Standard_D4s_v3', }], }); // Retrieve the kubeconfig from the created OpenShift cluster const kubeconfig = openshiftCluster.config.apply(config => Buffer.from(config, 'base64').toString()); // Step 2: Deploy the Infinispan Helm chart const myCluster = new k8s.Provider(clusterName, { kubeconfig, }); const infinispan = new k8s.helm.v3.Chart('infinispan', { chart: 'infinispan', version: 'x.y.z', // Specify the version of the chart you want to deploy fetchOpts: { repo: 'https://infinispan.org/infinispan-helm-charts/charts', }, }, { provider: myCluster }); // Export the OpenShift cluster's kubeconfig and Infinispan Helm Chart deployment status export const kubeConfigResult = kubeconfig; export const infinispanStatus = infinispan.status;
When the above program is executed via Pulumi, it will first create an OpenShift Managed Cluster in Azure. Once the cluster is available, it will deploy the Infinispan Helm chart to the cluster. You need to specify the correct OpenShift version and network settings that fit your requirements. The
kubeconfig
is retrieved and used to deploy the Helm chart using Pulumi’s Kubernetes provider.Make sure that the properties
location
,openShiftVersion
,networkProfile
,masterPoolProfile
, andagentPoolProfiles
are set according to your specific requirements and constraints of your Azure subscription and environment. The Helm chart version is dummy (x.y.z
) and should be replaced with the actual version of the Infinispan chart you wish to use.Run this program by executing
pulumi up
in the terminal after setting up the Pulumi project and stack. The program will provision the resources, and once completed, you will have an operational OpenShift cluster with Infinispan running. You can use the exported kubeConfig to interact with your cluster usingkubectl
.Remember that operations involving cloud resources can result in charges on your Azure account. Always review the resources and operations before applying them to avoid unexpected costs.