Deploy the ibm-open-liberty helm chart on Azure Managed Openshift Service
TypeScriptTo deploy the
ibm-open-liberty
Helm chart on Azure Managed Openshift Service using Pulumi, you'll go through the following steps:-
Set up an Azure Managed OpenShift Cluster: First, you must have an OpenShift cluster running on Azure. You will use the
azure-native.containerservice.OpenShiftManagedCluster
resource to create a managed OpenShift cluster. -
Install the Helm Chart: Once the cluster is up and running, you will use the
kubernetes.helm.v3.Chart
resource to deploy theibm-open-liberty
Helm chart on the OpenShift cluster.
Here's how you could write a Pulumi program in TypeScript to achieve these steps:
import * as pulumi from "@pulumi/pulumi"; import * as azure from "@pulumi/azure-native"; import * as k8s from "@pulumi/kubernetes"; // Create an Azure Resource Group const resourceGroup = new azure.resources.ResourceGroup("openLibertyRg", { location: azure.Locations.EastUS, // You can choose the appropriate Azure region }); // Create an Azure Managed OpenShift Cluster const cluster = new azure.containerservice.OpenShiftManagedCluster("openLibertyCluster", { resourceGroupName: resourceGroup.name, location: resourceGroup.location, openShiftVersion: "4.3", // Specify the OpenShift version you want to deploy networkProfile: { vnetCidr: "10.0.0.0/8", }, masterPoolProfile: { name: "master", count: 3, vmSize: "Standard_D4s_v3", // Ensure the VM size is appropriate for your needs }, // For the sake of simplicity, a single agent pool is defined here. // You can create more pools tailored to your application requirements. agentPoolProfiles: [{ name: "agentpool", count: 3, vmSize: "Standard_D4s_v3", }], // Define the authentication profile for the cluster authProfile: { identityProviders: [{ name: "Azure AD", provider: { kind: "AADIdentityProvider", clientId: "<Azure_AD_Client_ID>", secret: "<Azure_AD_Secret>", tenantId: "<Azure_AD_Tenant_ID>", }, }], }, }); // Initialize the Kubernetes provider using the created OpenShift cluster details const k8sProvider = new k8s.Provider("k8sProvider", { kubeconfig: cluster.config.rawConfig.apply(cfg => cfg!), // Access the kubeconfig from the created cluster }); // Deploy the ibm-open-liberty Helm chart const helmChart = new k8s.helm.v3.Chart("ibm-open-liberty", { chart: "ibm-open-liberty", version: "3.2.3", // Specify the version of the Helm chart you want to deploy fetchOpts: { repo: "https://charts.bitnami.com/bitnami", // Replace with the correct Helm repository for ibm-open-liberty }, }, { provider: k8sProvider }); // Export the Kubernetes cluster name and kubeconfig export const kubeconfig = cluster.config.rawConfig; export const clusterName = cluster.name;
Explanation:
-
We start by importing the necessary Pulumi libraries. We need
@pulumi/pulumi
for core Pulumi functionalities,@pulumi/azure-native
to interact with Azure resources, and@pulumi/kubernetes
to work with Kubernetes resources, including Helm charts. -
We declare an Azure Resource Group
resourceGroup
to organize all our resources. -
We create an Azure Managed OpenShift Cluster
cluster
with the necessary configurations. Make sure to replace placeholders like<Azure_AD_Client_ID>
,<Azure_AD_Secret>
, and<Azure_AD_Tenant_ID>
with your real Azure Active Directory credentials. Customize theopenShiftVersion
,vmSize
, and other parameters according to your requirements. -
We then initialize a Kubernetes provider
k8sProvider
using the kubeconfig of the OpenShift cluster we just created. -
After setting up the Kubernetes provider, we declare a Helm chart
helmChart
using thekubernetes.helm.v3.Chart
resource, pointing to theibm-open-liberty
chart. Please note that you will have to replace therepo
with the correct Helm repository URL ifibm-open-liberty
is not located in the Bitnami repository. Also, specify the appropriate version of the chart. -
Lastly, we export the kubeconfig and the name of the cluster for easy access. Exported values can be used if you want to configure additional resources or accesses manually.
Remember to set up your Pulumi project and install the necessary Pulumi CLI and Azure provider credentials before running this code.
-