1. Deploy the scheduler-plugins helm chart on Oracle Kubernetes Engine (OKE)

    TypeScript

    To deploy the scheduler-plugins Helm chart on Oracle Kubernetes Engine (OKE), you’ll need to follow a series of steps with Pulumi. First, you will create an instance of the OKE cluster using Pulumi's OCI (Oracle Cloud Infrastructure) provider. After the cluster is created and configured, you will install the scheduler-plugins Helm chart using Pulumi's Helm support within the Kubernetes provider.

    Here's a step-by-step explanation of the process, followed by a Pulumi TypeScript program:

    1. Setting Up OKE Cluster: We will define an OKE cluster resource using the oci.ContainerEngine.Cluster class. This entails specifying the details like the VCN networking configuration, the Kubernetes version, and other cluster configurations.

    2. Kubernetes Configuration: Once the OKE cluster is ready, we’ll retrieve the Kubeconfig for the cluster which can be used to communicate with the Kubernetes API. Pulumi allows us to define a Provider resource that encapsulates this configuration.

    3. Helm Chart Deployment: With the cluster up and Kubernetes provider configured, we will deploy the scheduler-plugins Helm chart. For this, we'll use Pulumi's kubernetes.helm.v3.Chart class, providing it with the name of the chart, any values to override the defaults, and the custom Provider we've configured with OKE's kubeconfig.

    Let's proceed with the Pulumi program in TypeScript:

    import * as pulumi from '@pulumi/pulumi'; import * as oci from '@pulumi/oci'; import * as k8s from '@pulumi/kubernetes'; // Create an Oracle Kubernetes Engine (OKE) cluster const cluster = new oci.ContainerEngine.Cluster("oke-cluster", { // We will need to provide the specific compartment ID, VCN ID, and other relevant details // Replace placeholders with actual IDs and configurations relevant to your Oracle Cloud setup compartmentId: "ocid1.compartment.oc1..xxxxxEXAMPLExxxxx", vcnId: "ocid1.vcn.oc1..xxxxxEXAMPLExxxxx", // Choose an appropriate Kubernetes version supported by OKE kubernetesVersion: "v1.20.11", options: { serviceLbSubnetIds: ["ocid1.subnet.oc1..xxxxxEXAMPLExxxxx"], // Additional cluster options can be provided here }, }); // Obtain the kubeconfig file from the OKE cluster const kubeconfig = pulumi.all([cluster.name, cluster.id]).apply(([name, id]) => { return oci.containerengine.getClusterKubeconfig({ name: name, clusterId: id, }); }); // Define a Kubernetes provider using the kubeconfig from OKE const k8sProvider = new k8s.Provider("oke-k8s", { kubeconfig: kubeconfig.rawConfig, }); // Use the Helm chart for deploying scheduler-plugins on the OKE cluster const helmChart = new k8s.helm.v3.Chart("scheduler-plugins", { chart: "scheduler-plugins", // The name of the chart. Make sure it's correct and available in the Helm repo // version: "x.y.z", // Specify the chart version, if needed // Add any custom values you want to override, as per the chart's 'values.yaml' file values: { // Provide specific values here: // replicaCount: 2, // image: { repository: "ghcr.io/kubernetes-sigs/scheduler-plugins", tag: "latest" }, // ... }, }, { provider: k8sProvider }); // Export the cluster name and Kubeconfig (base64 encoded) to easily access cluster after deployment export const clusterName = cluster.name; export const kubeconfigOutput = kubeconfig.rawConfig.apply(c => Buffer.from(c).toString("base64"));

    This TypeScript program is set up to be run with Pulumi. Ensure you replace the placeholder values with actual values from your OCI account and configuration.

    After defining these resources, when you run this Pulumi program, it executes the following:

    • Creates a new instance of OKE
    • Retrieves the kubeconfig from the newly created OKE instance
    • Sets up a new Kubernetes provider with this kubeconfig
    • Deploys the Helm chart for scheduler-plugins using the above provider

    To use this Pulumi program:

    1. Install the Pulumi CLI from the official Pulumi website.
    2. Make sure you have configured your OCI credentials on your machine where you intend to run Pulumi.
    3. Place this code into a file named index.ts in a new Pulumi project directory.
    4. Run pulumi up to create the resources and deploy the Helm chart on OKE.

    The outputs clusterName and kubeconfigOutput give you the cluster name and the kubeconfig in base64 encoded format. You can use the kubeconfig to connect to your Kubernetes cluster with kubectl or other Kubernetes tools.