Deploy the tetragon-policy-builder helm chart on Kubernetes
TypeScriptTo deploy the
tetragon-policy-builder
Helm chart on a Kubernetes cluster, we will use Pulumi'sChart
resource from the Kubernetes provider. This resource allows you to deploy a Helm chart as part of your Pulumi stack. The Chart resource relies on having a Kubernetes cluster already provisioned and configured.Below is a program written in TypeScript that defines a Pulumi stack, which will deploy the
tetragon-policy-builder
chart to an existing Kubernetes cluster. Before running this code, ensure that you have configured Pulumi to use your Kubernetes cluster, either by setting your current context in your kubeconfig file or by providing the required configuration within your Pulumi program.The
Chart
resource takes several parameters, including the chart name and version, and any custom values you wish to pass to the Helm chart. Therepo
parameter specifies the Helm repository URL where the chart is located. If the chart requires any specific configuration, you can provide it in thevalues
parameter as an object.Here's a TypeScript program that shows how to use Pulumi to deploy the
tetragon-policy-builder
Helm chart:import * as k8s from "@pulumi/kubernetes"; const chartName = "tetragon-policy-builder"; const chartVersion = "1.0.0"; // Replace with the actual chart version you wish to deploy. const releaseName = "tetragon-policy-builder-release"; const namespace = "default"; // Ensure this is the namespace you wish to deploy the Helm chart in. // Helm chart configuration. const chartConfig: k8s.helm.v3.ChartOpts = { chart: chartName, version: chartVersion, namespace: namespace, // Use `repo` to specify the Helm repository that hosts the chart. // If the chart is from a known repository provider you may need to add // that repository to your Helm client with `helm repo add` first, // and then pass the repo name in this field. // // ex: `repo: "https://my-helm-repo.com/charts"`. // // If your chart values are different from the defaults provide them in the `values:` field. values: { // Custom values for the helm chart can go here. }, // If needed, you can specify the fetch options for the Helm chart. fetchOpts: { // ex: you can specify that you want to get the chart from a harbor repository. // repo: "https://helm.goharbor.io/chartrepo/library" } }; // Creating Helm chart resource which deploys the chart. const tetragonPolicyBuilderChart = new k8s.helm.v3.Chart(releaseName, chartConfig); export const chartStatus = tetragonPolicyBuilderChart.status;
In this program, I did not specify a value for
repo
underfetchOpts
because it largely depends on where thetetragon-policy-builder
chart is being hosted. You should replace the placeholder forrepo
with the actual URL of the Helm repository containing the chart.After running this Pulumi program, it will output the status of the deployment. You can use the Pulumi CLI to apply this deployment to your cluster with
pulumi up
.Please remember that this will not create a new Kubernetes cluster; it assumes that you are using an existing one, and you are authenticated with
kubectl
and Pulumi to interact with that cluster.Lastly, the version number and the values should be adjusted to match the specifics of the
tetragon-policy-builder
you are deploying. If additional configuration or resources are required by the chart, add them within thevalues:
field.