1. Deploy the shoreline-agent helm chart on Opensshift


    To deploy the shoreline-agent Helm chart on an OpenShift cluster using Pulumi, you will need to use the kubernetes package, which allows you to interact with Kubernetes resources within Pulumi.

    Below is a Pulumi program in TypeScript that demonstrates how you can deploy a Helm chart on a Kubernetes cluster, which similarly applies to an OpenShift cluster since OpenShift is a Kubernetes distribution.

    The first step in working with Kubernetes resources in Pulumi is to install the necessary Pulumi packages. You will need @pulumi/kubernetes for this task:

    npm install @pulumi/kubernetes

    After setting up the npm package, we can start with the code. In the following Pulumi program, we use the Chart resource which is the Pulumi representation of a Helm chart. The Chart resource allows you to deploy applications defined by a Helm chart to your Kubernetes cluster.

    Let's walk through the main parts of the program:

    • We instantiate a new kubernetes.helm.v3.Chart which represents the Helm chart we want to deploy.
    • The Helm chart is defined by its name and the options including the chart which is the name of the Helm chart (in this case shoreline-agent) and repo which is the chart's repository URL.
    • We specify the namespace where we want to deploy the chart. If this namespace doesn't exist, it will be created.
    • We can provide additional configurations to the chart using the values property which accepts an object representing the Helm values.yaml file.

    Below is your Pulumi program to deploy the shoreline-agent Helm chart:

    import * as kubernetes from "@pulumi/kubernetes"; // Create an instance of the kubernetes provider connected to the desired OpenShift cluster. const openshiftProvider = new kubernetes.Provider("openshift", { kubeconfig: "<Your OpenShift kubeconfig here>", }); // Deploy the shoreline-agent Helm chart on the OpenShift cluster. const shorelineAgentChart = new kubernetes.helm.v3.Chart("shoreline-agent-chart", { chart: "shoreline-agent", version: "<chart version>", // specify the version of the chart if necessary repo: "<repository URL>", // specify the Helm chart repository URL here namespace: "default", // target namespace for the chart, change it if you have a specific namespace // To customize the deployment, you might provide a 'values' property here, e.g.: // values: { // someKey: "someValue", // }, }, { provider: openshiftProvider }); // Export the base URL for the shoreline agent service once it's deployed export const shorelineAgentUrl = shorelineAgentChart.getResourceProperty("v1/Service", "shoreline-agent-chart-shoreline-agent", "status").apply(status => status.loadBalancer.ingress[0].ip || status.loadBalancer.ingress[0].hostname);

    In this program:

    • Replace <Your OpenShift kubeconfig here> with the actual kubeconfig content or a reference to it.
    • Replace <chart version> with the specific version of shoreline-agent chart you wish to deploy. If you want the latest, you may omit the version field.
    • Replace <repository URL> with the URL where your Helm chart is located.

    Before running the program with Pulumi, you must set up your Pulumi stack and authenticate with your OpenShift cluster. The Pulumi CLI will guide you through this process.

    Finally, after running the program with the Pulumi CLI (pulumi up), the shorelineAgentUrl variable will output the base URL for the shoreline-agent service, which you can use to access the deployed application. Please note that accessing the service will depend on the service type and the configuration in the Helm chart. If it's an internal service, you might need to use a port-forward or ingress to access it externally.

    Additional information about the Helm Chart resource can be found in the Pulumi Kubernetes provider documentation.