1. Deploy the pod-reaper helm chart on Rancher


    To deploy the Pod Reaper Helm chart on a Rancher-managed Kubernetes cluster, you'll need to perform the following steps using Pulumi:

    1. Set up a Pulumi project and configure your Kubernetes provider to communicate with your Rancher cluster.
    2. Use the rancher2.CatalogV2 resource to add the Helm repository that contains the Pod Reaper chart.
    3. Use the rancher2.AppV2 resource to deploy the Helm chart to your cluster.

    Before you begin, ensure you have access to your Rancher Kubernetes cluster and the appropriate permissions to deploy Helm charts. You also need kubectl configured to connect to your cluster and Pulumi installed on your local machine.

    Here's how the Pulumi TypeScript program would look like:

    import * as rancher2 from "@pulumi/rancher2"; import { kubernetes } from "@pulumi/kubernetes"; // Set up the Rancher provider configuration // This assumes you've already set up your Kubernetes provider and configured kubectl to connect to your Rancher Kubernetes cluster. const rancherProvider = new rancher2.Provider("rancher", { apiURL: "<RANCHER_API_URL>", // Your Rancher API URL tokenKey: "<RANCHER_BEARER_TOKEN>", // Your Rancher Bearer Token }); // Add the Helm chart repository using the rancher2.CatalogV2 resource const podReaperCatalog = new rancher2.CatalogV2("pod-reaper", { clusterId: "<RANCHER_CLUSTER_ID>", // Target cluster ID within Rancher url: "https://<HELM_REPO_URL>", // URL of the Helm repository containing the Pod Reaper chart // Additional configurations like branch, etc. can be added here if necessary }, { provider: rancherProvider }); // Deploy the pod-reaper helm chart using the rancher2.AppV2 resource const podReaperApp = new rancher2.AppV2("pod-reaper-app", { // Use the catalog added above as the source of the helm chart repoName: podReaperCatalog.metadata.name, chartName: "pod-reaper", // Chart name in the Helm repository clusterId: "<RANCHER_CLUSTER_ID>", // Cluster to which the app will be installed namespace: "<TARGET_NAMESPACE>", // Namespace where the app should be installed // Include values for the helm chart here, you can specify default values or configure as needed values: ` podReaper: schedule: "*/5 * * * *" # Every five minutes gracePeriod: "30" # 30 seconds # Additional configurations specific to pod-reaper can be set here `, }, { provider: rancherProvider, dependsOn: [podReaperCatalog] }); // Export the app name export const podReaperAppName = podReaperApp.metadata.name;

    This program sets up the necessary resources to add the Pod Reaper Helm chart repository to your Rancher cluster and then deploys that chart into the specified namespace.

    Here are the steps you should follow:

    1. Replace placeholders such as <RANCHER_API_URL>, <RANCHER_BEARER_TOKEN>, <RANCHER_CLUSTER_ID>, <HELM_REPO_URL>, and <TARGET_NAMESPACE> with actual values from your Rancher and Kubernetes environments.
    2. Customize the values property on the rancher2.AppV2 resource instance with configuration parameters as needed for the Pod Reaper Helm chart.
    3. Run pulumi up to preview and deploy the changes.

    Upon successful completion, Pod Reaper will be deployed to your Rancher-managed cluster and will begin managing the lifecycle of your pods according to its schedule and grace period settings.