1. Deploy the turbonomic-importer helm chart on Oracle Kubernetes Engine (OKE)


    To deploy the turbonomic-importer Helm chart on Oracle Kubernetes Engine (OKE), we will accomplish this through two main steps using Pulumi:

    1. Setting up the OKE Cluster: We'll first ensure there is a Kubernetes cluster available in Oracle Cloud Infrastructure (OCI), managed by the OKE. For this step, we’ll use the oci.ContainerEngine.Cluster resource from the OCI Pulumi provider, which automates the provisioning of an OKE cluster.

    2. Deploying the Helm Chart: Once we have the Kubernetes cluster set up, we'll then use Pulumi’s kubernetes.helm.v3.Chart resource, which allows us to deploy Helm charts into a Kubernetes cluster. We'll assume the Helm chart for turbonomic-importer is available in a Helm repository or a defined package, and you have the required values for the deployment.

    Here is a TypeScript Pulumi program that does just that:

    import * as pulumi from "@pulumi/pulumi"; import * as oci from "@pulumi/oci"; import * as k8s from "@pulumi/kubernetes"; // Initialize a new Pulumi project and choose the appropriate OCI region const compartmentId = "YOUR_OCI_COMPARTMENT_ID"; // replace with your compartment ID const vcnId = "YOUR_VCN_ID"; // replace with your Virtual Cloud Network ID // Create a new OKE cluster const cluster = new oci.containerengine.Cluster("turbonomic-importer-cluster", { compartmentId: compartmentId, kubernetesVersion: "v1.21.5", // specify the desired Kubernetes version name: "turbonomic-importer-cluster", // name your cluster options: { addToImagePolicyConfig: { isPolicyEnabled: true, }, }, vcnId: vcnId, kubernetesNetworkConfig: { podsCidr: "", // specify your pod CIDR block servicesCidr: "", // specify your service CIDR block }, }); // Export the cluster ID and name export const clusterId = cluster.id; export const clusterName = cluster.name; // Set up Kubeconfig for connection to the provisioned OKE cluster // You will get credentials and other necessary information to configure kubectl // This step assumes you have the proper permissions to perform the operation in OCI const kubeconfig = pulumi.all([cluster.id, cluster.name]).apply(([id, name]) => { const response = oci.containerengine.getClusterKubeconfig({ clusterId: id, }); return response.content; }); // Initialize the Kubernetes provider using the obtained kubeconfig const k8sProvider = new k8s.Provider("k8s-provider", { kubeconfig: kubeconfig, }); // Deploy the turbonomic-importer Helm chart to the OKE cluster const chartName = "turbonomic-importer"; const chartVersion = "1.0.0"; // specify the chart version, ensure it is compatible const chartRepo = "https://charts.example.com/"; // replace with the actual Helm repository const turbonomicImporterChart = new k8s.helm.v3.Chart(chartName, { chart: chartName, version: chartVersion, fetchOpts: { repo: chartRepo, }, // If you have custom values you'd like to specify you can do so here // values: { // someValue: "some setting", // }, }, { provider: k8sProvider }); // Export the Helm chart status export const turbonomicImporterStatus = turbonomicImporterChart.status;

    Detailed Explanation

    This program performs the following steps:

    • It first imports the necessary Pulumi and cloud provider packages.
    • We define the compartmentId and vcnId variables where you should fill in values specific to your Oracle Cloud Infrastructure setup.
    • Using the OCI Pulumi provider, we define a containerengine.Cluster resource to create the OKE cluster, specifying parameters like Kubernetes version, name, pod and service CIDR blocks.
    • We export some of the cluster details such as the clusterId and clusterName.
    • We retrieve the Kubeconfig for the OKE cluster which will allow us to interact with the cluster using Kubernetes tooling like kubectl.
    • We use the retrieved Kubeconfig to initialize a Kubernetes provider for Pulumi (k8sProvider).
    • With this Kubernetes provider, we declare a k8s.helm.v3.Chart resource to deploy the turbonomic-importer Helm chart, indicating the chart name, version, repository, and other potential custom values for the deployment.
    • Lastly, we export the status of the Helm chart deployment so you can easily retrieve its deployment status from the outputs of the Pulumi program.

    Remember to replace placeholder values with actual data from your OCI environment, and ensure you have set up and authenticated the Pulumi OCI provider and OCI CLI before running the program.

    If you're new to Pulumi and looking to get started with creating Kubernetes clusters and deploying Helm charts, check out Pulumi's getting started guides for OCI and Kubernetes. These guides will help you set up your environment and understand the essential concepts.