Deploy the provider-openstack helm chart on Azure Managed Openshift Service
TypeScriptTo deploy the
provider-openstack
Helm chart on Azure Managed OpenShift Service, you will first need to create an OpenShift cluster on Azure. After setting up the cluster, you can then use Pulumi's Kubernetes package to deploy a Helm chart.The Pulumi code below is structured into two main parts:
- Creating an Azure Red Hat OpenShift cluster.
- Deploying the
provider-openstack
Helm chart on the created OpenShift cluster.
Prerequisites
- Ensure you have Pulumi CLI installed.
- Ensure you have Azure CLI installed and configured.
- Make sure that you have an Azure subscription and have the necessary permissions to create resources.
Pulumi Program
Below is the full TypeScript program to deploy the
provider-openstack
Helm chart on Azure Managed OpenShift Service.import * as azure from "@pulumi/azure"; import * as azuread from "@pulumi/azuread"; import * as k8s from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; import * as azureNative from "@pulumi/azure-native"; // Step 1: Create Azure Red Hat OpenShift cluster // Create an Azure Resource Group const resourceGroup = new azure.core.ResourceGroup("openshiftResourceGroup"); // Create an Azure AD Application for the OpenShift cluster const openshiftApp = new azuread.Application("openshiftAdApp"); // Create a Service Principal for the OpenShift AD Application const openshiftServicePrincipal = new azuread.ServicePrincipal("openshiftSp", { applicationId: openshiftApp.applicationId, }); // Create a Service Principal Password for the OpenShift Service Principal const openshiftServicePrincipalPassword = new azuread.ServicePrincipalPassword("openshiftSpPassword", { servicePrincipalId: openshiftServicePrincipal.id, value: "superstrongpassword", // Recommended to use Pulumi's secret management endDate: "2099-01-01T00:00:00Z", // Arbitrary expiry date far in the future }); // Create an OpenShift Managed Cluster const openshiftCluster = new azure.containerservice.OpenShiftManagedCluster("openshiftCluster", { resourceName: "myOpenshiftCluster", resourceGroupName: resourceGroup.name, location: resourceGroup.location, openShiftVersion: "4.6", // Specify your desired OpenShift version tags: { environment: "Production", }, networkProfile: { vnetCidr: "10.0.0.0/8", }, masterPoolProfile: { name: "master", count: 3, vmSize: "Standard_D4s_v3", }, agentPoolProfiles: [{ name: "agentpool", count: 3, vmSize: "Standard_D4s_v3", }], servicePrincipalProfile: { clientId: openshiftServicePrincipal.applicationId, secret: openshiftServicePrincipalPassword.value, }, }); // Step 2: Deploy the provider-openstack Helm chart on the created OpenShift cluster // Create a Pulumi Kubernetes Provider referencing the OpenShift cluster const k8sProvider = new k8s.Provider("openshiftK8sProvider", { kubeconfig: openshiftCluster.kubeConfigRaw, }); // Deploy the provider-openstack Helm chart const openstackHelmChart = new k8s.helm.v3.Chart("providerOpenstackChart", { chart: "provider-openstack", version: "1.2.3", // Specify the chart version you wish to deploy fetchOpts: { repo: "https://charts.example.com/", // Substitute with the actual Helm chart repository URL }, }, { provider: k8sProvider }); // Export the kubeconfig and chart name as an output export const kubeConfig = openshiftCluster.kubeConfigRaw; export const chartName = openstackHelmChart.metadata.name;
To deploy this Pulumi program:
- Save the code to a file named
index.ts
. - Run
pulumi up
to create the resources and deploy the Helm chart.
Please note that in the above program, we create an Azure Active Directory (AD) application and service principal which the OpenShift cluster will use for Azure integrations, such as Load Balancers and Managed Disks. The service principal's password is hardcoded in this example, but in a production scenario, you would use Pulumi's secrets management so that the password is not stored in plaintext.
Additionally, you should use the actual repository URL from where the
provider-openstack
Helm chart can be fetched. If this chart requires specific values, you can provide them in thevalues
field within theopenstackHelmChart
definition.Keep in mind that creating an OpenShift cluster can take significant time to complete and will incur costs on your Azure subscription. Always review and understand the billing implications before provisioning resources on any cloud provider.