Deploy the typo3scan helm chart on Opensshift
TypeScriptTo deploy the
typo3scan
Helm chart on Openshift using Pulumi, we will primarily utilize thekubernetes.helm.v3.Chart
resource from Pulumi's Kubernetes provider. This allows us to specify a Helm chart to install, along with any configuration values that the chart may require.Now, let's go over the steps you would take to deploy this chart using Pulumi in TypeScript.
Prerequisites
Before deploying the Helm chart on Openshift, ensure that you have the following prerequisites in place:
- Pulumi CLI installed and configured.
- Access to an Openshift cluster with the
oc
CLI tool configured. - Helm (v3) installed and configured.
kubectl
configured to communicate with your Openshift cluster.
Step-by-Step Guide
1. Import Necessary Packages
To start, you need to import the necessary Pulumi package for Kubernetes.
import * as k8s from "@pulumi/kubernetes";
2. Create a Pulumi Kubernetes Provider
The Pulumi Kubernetes provider must be configured for Openshift. If you're using Pulumi with an Openshift environment, the provider will respect the Kubernetes configuration sourced from your local
.kube/config
or the service account configuration inside a pod.const openshiftProvider = new k8s.Provider("openshift", { // Depending on how you're authenticated, you might need to provide // specific credentials here, but usually this will work as-is. });
3. Deploy the
typo3scan
Helm ChartNow you're ready to define the
typo3scan
Helm chart using Pulumi'sChart
resource. You will need the repository URL where thetypo3scan
chart is located. Let's assume it is in a Helm repository calledtypo3scan-repo
. You will also specify the namespace for deployment.const typo3scanChart = new k8s.helm.v3.Chart("typo3scan", { repo: "typo3scan-repo", chart: "typo3scan", namespace: "typo3scan-namespace", // Set any Chart values here if needed, for example: /* values: { key: value, }, */ }, { provider: openshiftProvider });
4. Export the Deployment Endpoint
If your Helm chart service is of type
LoadBalancer
or creates an Ingress, you might want to export the endpoint URL.export const typo3scanUrl = typo3scanChart.getResourceProperty("v1/Service", "typo3scan-typo3scan", "status").apply(status => status.loadBalancer.ingress[0].hostname);
Full Example Program
Below is the entire script that creates a Pulumi program to deploy
typo3scan
on Openshift:import * as pulumi from "@pulumi/pulumi"; import * as k8s from "@pulumi/kubernetes"; // Create an Openshift provider instance. const openshiftProvider = new k8s.Provider("openshift", { // Credentials to access the Openshift cluster could be provided here // This assumes that your KUBECONFIG environment variable is correctly set }); // Deploy the typo3scan Helm chart in the specified namespace. const typo3scanChart = new k8s.helm.v3.Chart("typo3scan", { repo: "typo3scan-repo", chart: "typo3scan", namespace: "typo3scan-namespace", // Specify any custom values for your Helm chart here: /* values: { key: value, }, */ }, { provider: openshiftProvider }); // Exporting the URL in case the service type is LoadBalancer or an Ingress was created. export const typo3scanUrl = typo3scanChart.getResourceProperty("v1/Service", "typo3scan-typo3scan", "status").apply(status => status.loadBalancer.ingress[0]?.hostname ?? "No external endpoint");
This program can be run using the
pulumi up
command after setting up your Pulumi project.Remember, you need to replace
"typo3scan-repo"
with the actual Helm repository URL where thetypo3scan
chart can be found, and"typo3scan-namespace"
with the namespace where you want to install your application.Final Notes
After running this program, the
typo3scan
Helm chart will be installed on your Openshift cluster. The program also exports the service URL, making it easy for you to access yourtypo3scan
deployment. Please note that you would also typically want to set up ingress routing and domain mapping, depending on your cluster configuration and network setup.You can find more details on working with Pulumi's Kubernetes provider in the official Pulumi Kubernetes provider documentation.