Deploy the tekton-pipelines helm chart on Azure Managed Openshift Service
TypeScriptTo deploy the Tekton Pipelines Helm chart on an Azure Managed OpenShift service using Pulumi, we will follow a sequence of steps:
-
Set up an Azure Managed OpenShift Service: This service will provide a Kubernetes-compatible platform for deploying our applications on Azure.
-
Install and configure a Helm chart: Once we have our OpenShift cluster set up, we will install the Tekton Pipelines Helm chart which will set up Tekton on our OpenShift cluster for running CI/CD pipelines.
Here is how you can accomplish the task using Pulumi with TypeScript:
Prerequisites
- Ensure you have Pulumi installed and configured with Azure credentials. You can follow the Pulumi installation guide and Azure setup guide to get started.
- Install Node.js and npm to run the TypeScript programs and manage packages.
Program Structure
Your Pulumi program will go through the following steps:
- Import necessary Pulumi and cloud provider libraries.
- Create an Azure resource group to contain all resources.
- Provision an Azure Managed OpenShift Service (ARO) cluster.
- Deploy the Tekton Pipelines Helm chart onto the ARO cluster.
The Pulumi TypeScript Program
import * as azure from "@pulumi/azure-native"; import * as pulumi from "@pulumi/pulumi"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create an Azure Resource Group const resourceGroup = new azure.resources.ResourceGroup("tektonResourceGroup"); // Step 2: Provision an Azure Red Hat OpenShift Cluster const openshiftCluster = new azure.redhatopenshift.OpenShiftCluster("tektonOpenShiftCluster", { // Define required properties such as location, resource group, and cluster properties. // ... // The exact values here will depend on your organization's needs and the specifications for your cluster. // This typically includes the number of nodes, the size of nodes, networking details, and so on. }); // Step 3: Configure K8s provider to deploy Helm chart to the OpenShift cluster // The kubeconfig can be retrieved from the OpenShift cluster once it's created. const provider = new k8s.Provider("openshiftProvider", { kubeconfig: openshiftCluster.kubeconfig.apply(kubeconfig => kubeconfig), }); // Step 4: Deploy the Tekton Pipelines Helm chart using the K8s provider const tektonChart = new k8s.helm.v3.Chart("tekton-pipelines", { chart: "tekton-pipelines", version: "0.28.0", // replace with the desired version fetchOpts: { repo: "https://tekton.dev/charts", }, }, { provider }); // Export the URL for the OpenShift console in case you need to access it export const openshiftConsoleUrl = openshiftCluster.consoleUrl; // You'll use `pulumi up` to deploy this program.
Explanation
Within this program:
-
Resource Group: We create an Azure resource group which acts as a logical container for our OpenShift cluster.
-
OpenShift Cluster: A Managed OpenShift cluster is provisioned on Azure. This cluster is an instance of Azure Red Hat OpenShift, which is fully managed by Microsoft and Red Hat.
-
Kubernetes Provider Configuration: The
k8s.Provider
resource is set up with the necessarykubeconfig
. This kubeconfig file is generated by the OpenShift cluster creation and is used by Pulumi to communicate with your cluster. -
Helm Chart Deployment: Finally, we utilize Pulumi’s Kubernetes provider to deploy the Tekton Pipelines chart from the Tekton Helm repository.
-
OpenShift Console URL: After deployment, we export the OpenShift console URL for easy access to the OpenShift web console.
Running the Program
To run this program, save the code to a file named
index.ts
, then execute the following commands:npm install @pulumi/pulumi @pulumi/azure-native @pulumi/kubernetes pulumi stack init tekton-openshift-deployment pulumi up
This will kick-off the deployment process. Follow the on-screen instructions to execute the deployment. After the command
pulumi up
finishes, you should see outputs with relevant information.Please adjust the properties for the OpenShift cluster and Helm chart version according to your exact requirements. The comments in the program are placeholders and should be replaced with actual properties suitable for your needs.
Remember that any infrastructure as code comes with considerations on authentication, permissions, network settings, and more, which are specific to your Azure subscription and organizational practices.
-