1. Deploy the kserve-inference helm chart on Opensshift


    To deploy the kserve-inference Helm chart on an OpenShift cluster using Pulumi, we will use the kubernetes.helm.v3.Chart resource from the Pulumi Kubernetes Provider. This allows us to deploy Helm charts to a Kubernetes cluster from Pulumi. Since OpenShift is a certified Kubernetes distribution, you can use the standard Kubernetes Pulumi Provider to manage resources on it.

    The Chart resource encapsulates a Helm Chart deployment and the Pulumi program configures it with the values required for the chart. Please ensure you have kubectl configured to point to your OpenShift cluster and that you have the necessary permissions to deploy resources.

    Here is a TypeScript program that demonstrates how to deploy a Helm chart named kserve-inference to an OpenShift cluster:

    import * as k8s from "@pulumi/kubernetes"; // The Helm chart for kserve-inference will be deployed within this namespace. const namespace = "your-namespace"; // Instantiate a Helm chart for kserve-inference. // You must replace `repo` with the URL of the Helm repository that contains the kserve-inference chart. const kserveInferenceChart = new k8s.helm.v3.Chart("kserve-inference", { namespace: namespace, // specify the OpenShift namespace where this chart should be deployed chart: "kserve-inference", // the name of the chart version: "x.y.z", // replace with the specific chart version you want to deploy fetchOpts: { // You need to specify the repository where the chart can be found if it's not in the default Helm repo. repo: "https://kserve.github.io/kserve", // hypothetical Helm chart repository URL -- replace with the actual one }, // If your chart requires additional values, you can supply them as an object. values: { // Replace these with the appropriate values key: "value", // For instance, if your chart requires a specific inference service configuration // inferenceService: { // predictors: { // ... // }, // }, }, }, { provider: k8sProvider }); // Specify the Kubernetes provider if it's not the default one // Export the Chart's status URL, this depends on the kserve-inference Helm chart export const statusUrl = kserveInferenceChart.getResourceProperty( "v1/Service", // Assuming the chart creates a Service that you want to check `${namespace}/kserve-inference`, // the name of the resource created by the Helm chart "status.loadBalancer.ingress[0].hostname" // Modify this based on the actual property to extract );

    Here are the steps that the above code is taking:

    1. It imports the Kubernetes Pulumi package, which is used for interacting with the Kubernetes API.
    2. It then defines a namespace where the Helm chart will be deployed. Replace your-namespace with the actual namespace you are targeting.
    3. A new instance of the Chart class is created, named kserve-inference (matching the name of the Helm chart you want to deploy).
    4. Within the instance of Chart, it specifies the chart name, version, and repository location using fetchOpts. You must put the actual version you want to deploy and the URL to the chart's Helm repository.
    5. An export statement is included at the end of the program to allow you to access the URL of the service associated with the Helm chart once it's deployed. You will have to adjust the object path according to the actual output you expect from the service created by your Helm chart.

    You will need to replace placeholders with actual values tailored for the kserve-inference chart. Also, make sure to install the chart version that is compatible with your OpenShift version.

    Before running this code with Pulumi, make sure:

    • You have access to the OpenShift cluster and are authenticated.
    • The correct Helm chart repository URL is provided.
    • The Helm Chart name and version match the ones available in the repository.

    To execute this Pulumi program:

    1. Save the code to a file with a .ts extension, for example, deploy-kserve-inference.ts.
    2. Run pulumi up to preview and deploy the changes.

    This Pulumi program should successfully deploy the kserve-inference Helm chart to your OpenShift cluster. For more information and examples, you can refer to the Pulumi Kubernetes documentation.