1. Deploy the cluster-gitlab-runner helm chart on Opensshift


    Deploying a Helm chart using Pulumi involves several steps. It requires you to have:

    1. A Pulumi account set up and the Pulumi CLI installed on your machine.
    2. An OpenShift cluster up and running.
    3. kubectl configured to connect to your OpenShift cluster.
    4. The Helm CLI installed if you want to manage Helm charts manually alongside Pulumi.

    Below I will walk you through a Pulumi program in TypeScript that deploys the cluster-gitlab-runner Helm chart onto an OpenShift cluster.

    To get started, the main thing we'll need from Pulumi's Kubernetes package is Chart, which represents a Helm chart in a Pulumi program.

    Here's how you can write the Pulumi program:

    1. Setting up a new Pulumi project: When creating a new Pulumi project, select kubernetes-typescript as the template.

    2. Writing the Pulumi TypeScript Code: You write TypeScript code in a file called index.ts. This code will instruct Pulumi to deploy the Helm chart into your OpenShift cluster.

    import * as k8s from "@pulumi/kubernetes"; // Create an instance of the k8s provider connected to the OpenShift cluster. const openshiftProvider = new k8s.Provider("openshift", { // Assuming 'kubectl' is configured to point to your OpenShift cluster, // you may not need to set any additional parameters here. // If extra configuration is needed, you can set kubeconfig or context here. }); // Deploy the GitLab Runner Helm chart. const gitlabRunnerChart = new k8s.helm.v3.Chart("gitlab-runner-chart", { chart: "cluster-gitlab-runner", // The 'version' field specifies the version of the Helm chart you want to deploy. // Replace 'x.y.z' with the actual chart version you want to use. version: "x.y.z", // The 'repo' field points to the repository where the chart is hosted. repo: "https://charts.gitlab.io/", // 'values' contains configuration values that override the chart's defaults. values: { // Set your values here to configure the GitLab Runner. // For instance, you can specify the GitLab URL, the runner registration token, and more. gitlabUrl: "https://gitlab.example.com", runnerRegistrationToken: "REGISTRATION_TOKEN", runners: { // ... other runner configuration ... }, }, }, { provider: openshiftProvider }); // Make sure the Helm chart is deployed using the openshiftProvider. // Export the base URL for the GitLab Runner so you can easily retrieve it. export const gitlabRunnerUrl = gitlabRunnerChart.getResourceProperty("v1/Service", "gitlab-runner", "status");

    In this Pulumi program:

    • A Provider is instantiated to represent our connection to the OpenShift cluster. If your kubectl is already configured to connect to your cluster, you don't need any additional parameters.
    • A Chart is declared to deploy the cluster-gitlab-runner Helm chart. You'll need to replace "x.y.z" with the actual chart version. The repo points to the Helm chart repository where cluster-gitlab-runner is stored. This example assumes that chart is hosted at https://charts.gitlab.io/, but you should replace it with the actual URL if it's different.
    • In the values object, you'll specify the configuration overrides for your instance of the GitLab Runner. Typically, this includes a GitLab URL and a runner registration token, plus any other configurations you want.
    • The openShiftProvider is passed as an option to ensure the chart is deployed to your OpenShift cluster.
    • Finally, we export a property of the runner service to get its exposed URL.

    This is a high-level overview and the actual details might vary based on your specific requirements and GitLab Runner configuration.

    To apply the Pulumi program, you would run pulumi up, review the plan, and then select yes to deploy your changes.

    This documentation provides a simple way to start deploying the GitLab Runner to an OpenShift cluster using Pulumi with TypeScript. For more complex needs or configurations, refer to the specific Helm chart documentation or the Pulumi Kubernetes documentation.