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

    TypeScript

    To deploy the Harbor Operator Helm chart on Oracle Kubernetes Engine (OKE), we will perform the following steps using Pulumi:

    1. Configure the Pulumi program to use the OCI (Oracle Cloud Infrastructure) provider for managing resources within Oracle Cloud.
    2. Provision an OKE Cluster if you don't already have one.
    3. Use the Kubernetes provider to interact with the OKE cluster.
    4. Deploy the Harbor Operator Helm chart on the OKE cluster using the kubernetes.helm.v3.Chart resource.

    Below is a detailed Pulumi TypeScript program that you can use to deploy the Harbor Operator Helm chart to an OKE cluster. Make sure that your Oracle Cloud Infrastructure (OCI) account is properly configured with the necessary credentials before running this program.

    import * as pulumi from "@pulumi/pulumi"; import * as oci from "@pulumi/oci"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Set up the Oracle provider configuration. // Ensure that you have the OCI configuration set up with the proper API keys and region. const provider = new oci.Provider("oci", { region: "us-phoenix-1", // Change to the region where you want to deploy the OKE cluster }); // Step 2: Create an OKE cluster. // Replace these values with the desired configuration for your OKE cluster. const okeCluster = new oci.containerengine.Cluster("okeCluster", { compartmentId: "<compartment-id>", // Specify your compartment ID here kubernetesVersion: "v1.19.7", // Specify the Kubernetes version name: "oke-harbor-cluster", // Provide a name for the OKE cluster vcnId: "<vcn-id>", // Specify the existing VCN ID or create a new one }, { provider: provider }); // Export the cluster ID export const clusterId = okeCluster.id; // Step 3: Configure the Kubernetes provider to use the generated Kubeconfig from OKE. const k8sProvider = new k8s.Provider("k8sProvider", { kubeconfig: okeCluster.kubeconfigRaw, }); // Step 4: Deploy the Harbor Operator Helm chart on the OKE cluster using the Pulumi Kubernetes provider. const harborOperatorChart = new k8s.helm.v3.Chart("harbor-operator", { chart: "harbor-operator", version: "1.0.0", // Specify the version of the Helm chart you want to deploy namespace: "default", // Deploy the chart in the default namespace, or specify another namespace fetchOpts: { repo: "https://helm.goharbor.io", // The repository where the Harbor Operator chart is located }, }, { provider: k8sProvider }); // Export the Harbor Operator chart name export const harborOperatorChartName = harborOperatorChart.name;

    In the above program:

    • We begin by importing the necessary Pulumi packages.
    • We then configure the OCI provider with the appropriate region.
    • We create an instance of the OKE cluster with the specified configuration.
    • Following that, we set up the Kubernetes provider to interact with the OKE cluster using the generated Kubeconfig.
    • Finally, we deploy the Harbor Operator Helm chart on the OKE cluster using the k8s.helm.v3.Chart resource.

    After you have created your Pulumi program file (for example, index.ts), you can use the standard Pulumi CLI commands to preview and apply your changes:

    pulumi up

    This will prompt you for confirmation before provisioning the resources in your Oracle Cloud account. Once confirmed, Pulumi will deploy the Harbor Operator Helm chart to your OKE cluster.