1. Deploy the runner helm chart on Oracle Kubernetes Engine (OKE)

    TypeScript

    To deploy a Helm chart on Oracle Kubernetes Engine (OKE) using Pulumi, we will follow these steps:

    1. Ensure you have access to an existing Oracle Kubernetes Engine (OKE) cluster.
    2. Install the OCI and Kubernetes Pulumi providers, allowing us to interact with OCI resources and Kubernetes resources respectively.
    3. Use the kubernetes.helm.sh/v3.Chart class from the Pulumi Kubernetes provider to deploy the Runner Helm chart to the cluster.

    Before you begin, you should have the Pulumi CLI installed and be logged in. You should also have your OCI credentials configured locally to connect to your Oracle Cloud Infrastructure, including your OKE cluster.

    Below is the TypeScript program that demonstrates deploying a Helm chart. In this case, it's a generic "runner" chart, and you would replace 'runner' with the actual Helm chart name you wish to deploy.

    import * as pulumi from '@pulumi/pulumi'; import * as k8s from '@pulumi/kubernetes'; // Assume you have a preconfigured OKE cluster and kubeconfig. // Load the kubeconfig const kubeconfig = pulumi.output(<your_oke_kubeconfig_here>); // Create a provider to deploy the Helm chart to the OKE cluster const provider = new k8s.Provider('oke-k8s', { kubeconfig: kubeconfig.apply(JSON.stringify), }); // Define the Helm chart, which will deploy the 'runner' chart from the specified repository const runnerChart = new k8s.helm.v3.Chart('runner-chart', { repo: 'my-charts', // Replace with the Helm repository URL hosting 'runner' chart chart: 'runner', // The name of the chart version: '1.2.3', // Specify the chart version, if required namespace: 'default' // Specify the namespace to install the chart into }, { provider }); // Attach the OKE cluster provider to ensure that the chart is installed in the correct cluster. // Export the chart resource name export const chartName = runnerChart.ready.map(_ => runnerChart.metadata.apply(m => m.name));

    Explanation

    • kubeconfig: This variable will hold your Kubeconfig file content and is required to communicate with your OKE cluster. Replace <your_oke_kubeconfig_here> with the Kubeconfig content you obtained from Oracle Cloud Infrastructure for your cluster.

    • k8s.Provider: Initializes a new Kubernetes provider instance, which is used to deploy Kubernetes resources onto the specified cluster. The kubeconfig is passed to authenticate with your OKE cluster.

    • k8s.helm.v3.Chart: This class represents a Helm chart that can be deployed to a Kubernetes cluster. Here, you specify the repository, name, and version of the Helm chart, as well as the namespace where the Helm chart will be deployed.

    • export const chartName: After the Helm chart has been successfully deployed, we capture the name of the chart and make it available as a stack output.

    In the above program, you must replace the placeholders with real values relevant to your Helm chart and OKE cluster:

    • Replace 'my-charts' with the real URL to your Helm chart repository.
    • Replace 'runner' with the actual name of the Helm chart you want to deploy.
    • Replace '1.2.3' with the version of the Helm chart you want to deploy if you have a specific version in mind.
    • Replace '<your_oke_kubeconfig_here>' with your actual kubeconfig content to allow Pulumi to interact with your OKE cluster.

    After filling in those details, you can run the Pulumi program using the Pulumi CLI. The CLI enables you to create, update, and manage the deployment of your infrastructure as code. Use pulumi up to preview and deploy your changes, and pulumi stack output chartName to see the name of the deployed Helm chart once the deployment is complete.