1. Deploy the newrelic-infrastructure helm chart on Oracle Kubernetes Engine (OKE)

    TypeScript

    To deploy the newrelic-infrastructure Helm chart on Oracle Kubernetes Engine (OKE), you will need to do the following:

    1. Set up an OKE cluster where you will deploy the helm chart.
    2. Install the Helm CLI tool and configure it to work with your Kubernetes cluster.
    3. Deploy the newrelic-infrastructure chart using Pulumi within your TypeScript application.

    Below, you’ll find the TypeScript program that uses Pulumi to perform these steps. The program assumes you have already configured the Pulumi CLI and Oracle Cloud Infrastructure (OCI) provider credentials.

    The oci.ContainerEngine.Cluster resource is used to define an OKE cluster, and the kubernetes.helm.v3.Chart resource represents the newrelic-infrastructure Helm chart you wish to deploy to your cluster.

    Here is the full Pulumi program in TypeScript:

    import * as oci from "@pulumi/oci"; import * as k8s from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Create an OCI Container Engine for Kubernetes (OKE) cluster. const cluster = new oci.containerengine.Cluster("myCluster", { // Replace the following attributes with your specific OCI configuration. compartmentId: "<COMPARTMENT_ID>", vcnId: "<VCN_ID>", // The VCN ID must be created in advance. kubernetesVersion: "v1.21.4", // Specify the desired version. options: { // Configure other options as needed, like service LB subnet IDs, addons, etc. serviceLbSubnetIds: ["<SUBNET_ID_1>", "<SUBNET_ID_2>"], }, }); // The Pulumi Kubernetes provider needs a kubeconfig to interact with the OKE cluster. // The kubeconfig can be retrieved from the OKE cluster resource once the cluster is provisioned. // Pulumi StackReferences or Pulumi Config may allow you to pass the kubeconfig more securely or dynamically. const kubeconfig = cluster.kubeconfig.apply(JSON.stringify); // Create a k8s provider instance of the kubernetes provider using the kubeconfig retrieved from the cluster. const k8sProvider = new k8s.Provider("k8sProvider", { kubeconfig: kubeconfig, }); // Deploy the `newrelic-infrastructure` helm chart into the OKE cluster const newrelicChart = new k8s.helm.v3.Chart("newrelic-chart", { chart: "newrelic-infrastructure", fetchOpts: { repo: "https://helm-charts.newrelic.com", }, // The values can be structured as per the helm chart's requirements. // Replace `licenseKey` and `cluster` fields with correct values. values: { licenseKey: "<YOUR_NEW_RELIC_LICENSE_KEY>", cluster: cluster.name, // Include any additional configuration specific to the New Relic chart }, }, { provider: k8sProvider }); // Export the cluster name and kubeconfig. export const clusterName = cluster.name; export const kubeconfigOutput = kubeconfig;

    Remember to replace the placeholders like <COMPARTMENT_ID>, <VCN_ID>, <SUBNET_ID_1>, <SUBNET_ID_2>, and <YOUR_NEW_RELIC_LICENSE_KEY> with the appropriate values for your environment.

    This program does the following:

    • It creates an Oracle Kubernetes Engine cluster by specifying the required parameters such as the compartment ID, VCN ID, and Kubernetes version.
    • It retrieves the kubeconfig from the newly created OKE cluster, which is needed to interact with Kubernetes.
    • It sets up the Pulumi Kubernetes provider with the kubeconfig to manage Kubernetes resources.
    • It then declares a Chart resource that represents the New Relic Infrastructure Helm chart. It specifies which repository to fetch the chart from and specifies the values necessary to configure the New Relic agent in your cluster.

    To run this program, you will need to first install Pulumi and set up your OCI credentials. Then you can create a new Pulumi project and use this TypeScript file as your index.ts file. After running pulumi up, Pulumi will handle creating the resources on OCI accordingly. Remember that deploying infrastructure in OCI will incur costs.

    Also note, if you've created your OCI resources separately or are using existing infrastructures, you may need to provide additional configuration to align with your specific setup, such as network configuration or Kubernetes versions.