Deploy the tyk-data-plane helm chart on Azure Managed Openshift Service
TypeScriptTo deploy the
tyk-data-plane
Helm chart on Azure Managed OpenShift Service using Pulumi, we will perform the following steps:- Set up an Azure Managed OpenShift Cluster
- Install the
tyk-data-plane
Helm chart on this cluster
We will be using two main resources from Pulumi:
azure-native.containerservice.OpenShiftManagedCluster
to create an Azure Red Hat OpenShift (ARO) managed cluster.kubernetes.helm.v3.Chart
to deploy the Helm chart on the Kubernetes cluster provided by ARO.
Here's a Pulumi program in TypeScript that accomplishes this:
import * as pulumi from "@pulumi/pulumi"; import * as azure_native from "@pulumi/azure-native"; import * as k8s from "@pulumi/kubernetes"; // Set up an Azure Resource Group const resourceGroup = new azure_native.resources.ResourceGroup("myResourceGroup"); // Create an Azure Red Hat OpenShift Managed Cluster const openshiftCluster = new azure_native.containerservice.OpenShiftManagedCluster("myOpenshiftCluster", { resourceGroupName: resourceGroup.name, location: resourceGroup.location, openShiftVersion: "4.3", // Specify the OpenShift version // Define master and worker node profiles, and other necessary properties masterPoolProfile: { name: "master", // Master profile name count: 3, // Number of master nodes vmSize: "Standard_D4s_v3", // Size of VM for the master pool }, agentPoolProfiles: [{ name: "default", // Worker node profile name role: "Compute", // Role of the pool count: 3, // Number of worker nodes vmSize: "Standard_D4s_v3", // Size of VM for the worker pool }], // Define networking and authentication profiles as needed // ... }); // Set up a provider to connect to the created cluster const provider = new k8s.Provider("openshiftProvider", { kubeconfig: openshiftCluster.config.rawConfig, }); // Deploy the tyk-data-plane Helm chart on the OpenShift cluster const tykDataPlaneChart = new k8s.helm.v3.Chart("tyk-data-plane", { chart: "tyk-headless", // Chart name in the Helm repository version: "0.6.1", // Specific chart version fetchOpts: { // Specify the repository settings if the chart is not in the default Helm repo repo: "https://helm.tyk.io/public/helm/charts/", }, values: { // Provide any required values to customize the installation of the tyk-data-plane chart // ... }, }, { provider: provider }); // Export the cluster's kubeconfig export const kubeConfig = openshiftCluster.config.rawConfig;
In this code, we begin by creating a resource group which will contain our OpenShift cluster.
azure_native.resources.ResourceGroup
is responsible for grouping our resources in Azure.Next, we define and deploy our OpenShift cluster using the
azure_native.containerservice.OpenShiftManagedCluster
. The parameters include the location, version of OpenShift, master and worker node profiles, and other necessary configuration like networking and authentication which are specified as needed. This cluster will be managed by Azure, abstracting away many of the underlying details for us.Then we set up a Pulumi Kubernetes Provider using the kubeconfig from our newly created OpenShift cluster. The provider enables Pulumi to deploy applications and resources to that cluster.
Afterwards, we use Pulumi's
kubernetes.helm.v3.Chart
to deploy thetyk-data-plane
Helm chart to the cluster. We specify the name of the chart, the version, repository details, and any necessary values to customize the Helm chart installation according to thetyk-data-plane
chart's documentation.Lastly, we export the kubeconfig which allows us to interact with our Kubernetes cluster through
kubectl
or any other compatible tools.Keep in mind that Pulumi stores state about your infrastructure, so it can safely make changes and updates. It requires some set up, such as installing Pulumi and configuring Azure credentials.
Upon running this program with
pulumi up
, Pulumi will perform the diff, show you the expected changes, and you can proceed with the deployment. Always review the plan before deploying.