1. Deploy the keda-operator helm chart on Oracle Kubernetes Engine (OKE)

    TypeScript

    To deploy the keda-operator Helm chart on Oracle Kubernetes Engine (OKE), we will create a Pulumi program that performs the following steps:

    1. Sets up the Oracle Kubernetes Engine cluster as a resource where the Helm chart will be deployed.
    2. Installs the Helm chart keda-operator onto the OKE cluster.

    For this task, we will use the oci.ContainerEngine.Cluster resource to define the OKE cluster and the kubernetes.helm.sh/v3.Chart resource to deploy the Helm chart onto the OKE cluster. Please ensure you have the required OCI (Oracle Cloud Infrastructure) credentials configured on your machine where Pulumi is installed.

    Firstly, we need to import the necessary Pulumi libraries for OCI and Kubernetes. We establish the provider connection to the OKE Kubernetes cluster using configuration data like the cluster ID, kubeconfig file, etc. Then we use the Helm chart resource to deploy the keda-operator to the cluster.

    Here is the TypeScript program to deploy the keda-operator Helm chart on OKE:

    import * as pulumi from "@pulumi/pulumi"; import * as oci from "@pulumi/oci"; import * as k8s from "@pulumi/kubernetes"; // Ensure you have the proper configuration for the OCI provider, // like the region and tenancy specific details. const provider = new oci.Provider("oci", { region: "<region>", // specify your OCI region tenancyOcid: "<tenancy_ocid>", // specify your tenancy OCID userOcid: "<user_ocid>", // specify your user OCID privateKey: "<private_key>", // specify your private key fingerprint: "<fingerprint>", // specify your public key fingerprint }); // Here you will provide the ID of an existing OKE cluster. const clusterId = "<your_cluster_id>"; // Retrieve the kubeconfig for the cluster, which we'll use to interact with the // Kubernetes cluster that OKE manages. This assumes you have the necessary // permissions to access the cluster and the cluster exists. const kubeconfig = oci.core.getKubeconfig({ // Provide the necessary kubeconfig parameters clusterId: clusterId, }, { provider: provider }).then(kubeconfig => kubeconfig.content); // Create a Kubernetes provider instance that uses the kubeconfig from OKE. const k8sProvider = new k8s.Provider("oke-k8s", { kubeconfig: kubeconfig, }); // Deploy the 'keda-operator' Helm chart using the OKE Kubernetes provider. const keda = new k8s.helm.v3.Chart("keda", { chart: "keda", version: "<chart_version>", // specify the chart version if needed fetchOpts: { repo: "https://kedacore.github.io/charts", }, }, { provider: k8sProvider }); // Export the KEDA operator deployment status export const kedaStatus = keda.status;

    Make sure to replace placeholders like <region>, <tenancy_ocid>, <user_ocid>, <private_key>, <fingerprint>, and <your_cluster_id> with your actual OCI information. You may also need to install the OCI and Kubernetes SDKs for Pulumi if you haven't already:

    pulumi plugin install resource oci <version> pulumi plugin install resource kubernetes <version>

    The specific version numbers <version> should match those compatible with your current Pulumi CLI version. After installing, you would run pulumi up to deploy the resources defined in the Pulumi program. If successful, the command line will output the current status of the KEDA deployment, and the KEDA operator will be running in your OKE cluster.

    This program sets up the Kubernetes provider with credentials obtained from your OCI OKE cluster and then uses that provider to deploy the keda-operator Helm chart from its official repository. Please refer to Oracle Container Engine for Kubernetes (OKE) and Helm Chart for more detailed information about these resources.