1. Deploy the druid-http-gateway helm chart on Opensshift

    TypeScript

    To deploy the Druid HTTP gateway Helm chart on OpenShift using Pulumi, you can leverage the kubernetes.helm.v3.Chart resource. This resource allows you to deploy a Helm chart from a repository or a local path into an OpenShift or Kubernetes cluster.

    Here's a step-by-step explanation followed by the TypeScript code that will help you accomplish this task:

    Explanation

    1. Importing Necessary Modules: You'll need to import the @pulumi/kubernetes package to interact with your Kubernetes cluster, specifically OpenShift in this case.

    2. Creating a Kubernetes Provider: Since we're working with OpenShift, you may need to customize your provider settings to target your OpenShift cluster. If you have configured your kubeconfig file correctly, Pulumi will use it by default.

    3. Declaring the Helm Chart: You'll use the Chart class from the @pulumi/kubernetes/helm/v3 module to declare a new Helm chart deployment.

    4. Chart Configuration: You'll need to provide the chart, version, and repo properties for the Druid HTTP gateway chart. Optionally, you can specify values if you want to override any default settings within the chart.

    5. Namespace: Helm charts can be deployed in a specific namespace. If the namespace doesn't exist, it can be created beforehand using the @pulumi/kubernetes/core/v1/Namespace resource.

    Now, let's see how these steps translate into Pulumi code.

    Pulumi TypeScript Program

    import * as pulumi from '@pulumi/pulumi'; import * as k8s from '@pulumi/kubernetes'; // Replace these variables with the correct values for your OpenShift cluster and Helm chart const projectName = 'druid-http-gateway-deployment'; const druidChartName = 'druid'; const druidChartVersion = '0.0.1'; // Specify the version of the Druid chart you wish to deploy const druidChartRepo = 'https://helm-repo-url'; // The URL of the Helm repo where Druid chart is hosted // Create a Kubernetes provider instance for OpenShift if necessary. If you have the kubeconfig // set correctly, Pulumi uses it by default and you can omit this step. const openshiftProvider = new k8s.Provider('openshift-k8s', { // You can specify provider settings here. If your kubeconfig is set and works, you don't need to add anything. }); // Deploying Druid HTTP gateway using Helm Chart // If you need to customize values within the chart, use the `values` parameter to pass in a configuration object. const druidHttpGatewayChart = new k8s.helm.v3.Chart(projectName, { chart: druidChartName, version: druidChartVersion, fetchOpts: { repo: druidChartRepo, }, // Uncomment the following line if you need to deploy in a specific namespace // namespace: "your-namespace", }, { provider: openshiftProvider }); // Export the base URL of the Druid HTTP gateway if available export const druidHttpGatewayUrl = pulumi.interpolate`http://${druidHttpGatewayChart.getResourceProperty("v1/Service", "druid-http-gateway-service", "status").apply(status => status.loadBalancer.ingress[0].hostname)}/`;

    What does this code do?

    • Declares the Helm chart parameters, such as Namen, Version, and Repository URL for the Druid chart.
    • Optionally includes a custom Kubernetes provider for OpenShift if your kubeconfig is not set to work out of the box with Pulumi.
    • Deploys the Druid HTTP gateway Helm chart using the k8s.helm.v3.Chart resource. It will look for the chart in the specified Helm repository and deploy it to your OpenShift cluster.
    • Exports the URL of the deployed service if your Helm chart creates a Kubernetes Service exposed through a load balancer. This URL will give you access to the Druid HTTP gateway.

    After writing this program:

    1. Run pulumi up on the command line to preview and deploy your changes.
    2. Check if there are any errors in the deployment process and ensure your Helm chart is correctly configured.
    3. Once applied, Pulumi will give you outputs such as the Druid HTTP gateway URL. You can use this to interact with your Druid HTTP gateway.