1. Deploy the pulsar-resources-operator helm chart on Kubernetes


    To deploy the pulsar-resources-operator Helm chart on Kubernetes using Pulumi, you can use the kubernetes.helm.v3.Chart class from the Kubernetes provider package. This class allows you to deploy Helm charts into a Kubernetes cluster.

    First, ensure that you have Pulumi installed and that you've set up your Kubernetes context to point to your desired cluster. The Pulumi Kubernetes provider will use your current context to communicate with your cluster unless you explicitly provide another configuration.

    Below is a Pulumi program in TypeScript that demonstrates how to deploy a Helm chart. In this case, the pulsar-resources-operator Helm chart:

    1. Import the necessary modules: We'll import the Chart class from @pulumi/kubernetes/helm/v3.

    2. Install the Helm Chart: Instantiate a new Helm chart using the new Chart syntax. We'll need to provide a chart name, and optionally, we can provide the repository where the chart is hosted, the version of the chart, and custom values to override the default chart values.

    3. Export resources: We might want to export certain resources or URLs, like the service endpoint, to access the deployed resources later.

    Here's the program:

    import * as k8s from "@pulumi/kubernetes"; // Set the details of the Helm chart: the name, its repository, and the version const chartName = "pulsar-resources-operator"; const chartRepo = "http://pulsar-helm-repo"; // Replace with the actual Helm repo URL const chartVersion = "1.0.0"; // Replace with the actual chart version const pulsarOperator = new k8s.helm.v3.Chart(chartName, { chart: chartName, version: chartVersion, fetchOpts: { repo: chartRepo, }, // If you need to provide custom values to the pulsar-resources-operator Helm chart, you can specify an object here. // For example: // values: { // replicaCount: 2, // image: { // repository: "my-pulsar-image", // tag: "latest", // }, // }, }); // Export any necessary resources, this is just a placeholder and does not apply to all helm charts. // For instance, if your Helm chart creates a Kubernetes service, you might want to export its endpoint: // export const serviceEndpoint = pulsarOperator.getResourceProperty("v1/Service", "my-service-name", "status.loadBalancer.ingress[0].hostname");

    Now to explain:

    • We import the @pulumi/kubernetes package, which is the primary Pulumi package for interacting with Kubernetes clusters.

    • We specify the details for the Helm chart: its name, the repository from where it should be fetched, and the version. Make sure to provide the correct Helm chart repository URL and a version that matches what you want to deploy.

    • We create a new instance of the Chart class, passing the name of the chart, the version, and fetch options that include the repository URL. We can also pass a values property to override default Helm chart values, but in this example, it is commented out.

    • Finally, while this script does not include an export statement out of the box, there's a commented line suggesting how you would export a service endpoint after deploying a Helm chart that includes a service.

    Remember to replace http://pulsar-helm-repo with the real Helm repository URL for the pulsar-resources-operator if it's different and the version with the one you intend to deploy.

    After deploying this Pulumi program, your pulsar-resources-operator Helm chart will be applied to your Kubernetes cluster. If you need to hook into a specific service or endpoint post-deployment, you can use Pulumi's .getResourceProperty() method to retrieve and export such details.