Deploy the ibm-sam helm chart on Azure Managed Openshift Service
TypeScriptIn order to deploy the
ibm-sam
Helm chart on an Azure Managed OpenShift Service, we are going to execute a few steps:- Set up an Azure Managed OpenShift cluster using
azure-native.containerservice.OpenShiftManagedCluster
. - Deploy the
ibm-sam
application on the cluster using thekubernetes.helm.sh/v3.Chart
.
Let's start by creating the managed OpenShift cluster on Azure. The
azure-native.containerservice.OpenShiftManagedCluster
Pulumi resource will enable us to do so. When provisioning an OpenShift cluster, we must provide various properties likeresourceName
,resourceGroupName
,location
(which specifies the Azure region),openShiftVersion
, andagentPoolProfiles
(which specifies the size and number of nodes for the cluster).After the cluster is provisioned, we will use the
kubernetes.helm.sh/v3.Chart
resource representing a Helm chart for deploying applications on Kubernetes—here it being our OpenShift cluster. The chart resource requires information about the chart, such aschart
name,version
,repo
, and optionallyvalues
for configurations or any other overrides that you would want to provide.Below is a Pulumi program in TypeScript that creates an OpenShift cluster and deploys the
ibm-sam
Helm chart to it. This complete program bundles both infrastructure setup and the Helm chart deployment into one cohesive automation script.Make sure that you have all necessary configuration set up in your Azure environment and Pulumi settings for authentication. For the Helm chart deployment, you'll need to have Helm and Kubernetes providers properly configured with appropriate authentication credentials that Pulumi can use.
import * as pulumi from "@pulumi/pulumi"; import * as azureNative from "@pulumi/azure-native"; import * as k8s from "@pulumi/kubernetes"; // Create an Azure Resource Group const resourceGroup = new azureNative.resources.ResourceGroup("myResourceGroup", { location: "eastus", // Update to the preferred location }); // Provision an Azure OpenShift Managed Cluster const managedCluster = new azureNative.containerservice.OpenShiftManagedCluster("myOpenShiftCluster", { resourceName: "myOpenShiftCluster", resourceGroupName: resourceGroup.name, location: resourceGroup.location, openShiftVersion: "4.8", // Replace with the required OpenShift version networkProfile: { vnetCidr: "10.0.0.0/8", }, masterPoolProfile: { count: 3, vmSize: "Standard_D4s_v3", }, agentPoolProfiles: [{ name: "agentpool", count: 3, vmSize: "Standard_D4s_v3", role: "compute", }], authProfile: { identityProviders: [{ name: "Azure AD", provider: { kind: "AADIdentityProvider", clientId: "example-client-id", // Set the Azure AD Client ID secret: "example-secret", // Set the Azure AD Secret tenantId: "example-tenant-id", // Set the Azure AD Tenant ID }, }], }, }); // Deploy the `ibm-sam` Helm chart on the OpenShift Cluster const helmChart = new k8s.helm.v3.Chart("ibm-sam-chart", { chart: "ibm-sam", version: "0.1.0", // Replace with the specific Helm chart version you require fetchOpts: { repo: "https://charts.example.com/", // Replace with the URL of the repo containing `ibm-sam` }, }, { provider: new k8s.Provider("k8s-provider", { kubeconfig: managedCluster.config.rawConfig }) }); // Export the OpenShift cluster's kubeconfig export const kubeconfig = managedCluster.config.rawConfig;
In the code above, before running the Pulumi program, remember to replace placeholder values with the correct ones, such as the location, OpenShift version, Azure AD details, the Helm chart version, and the URL for the Helm repository hosting the
ibm-sam
chart.After the Pulumi program successfully runs, it will output the kubeconfig needed to interact with the OpenShift cluster. You can retrieve the kubeconfig by running the
pulumi stack output kubeconfig
command. With the kubeconfig in hand, you can usekubectl
or the OpenShift CLI to manage your applications on the cluster.Please keep in mind that cluster creation and Helm deployment might take several minutes to complete. Once the deployment is finished, you can start using your OpenShift cluster to manage your
ibm-sam
application.- Set up an Azure Managed OpenShift cluster using