Deploy the gitea-operator helm chart on Rancher
TypeScriptTo deploy the
gitea-operator
helm chart on a Rancher-managed Kubernetes cluster using Pulumi, you will first need to install the Pulumi CLI and set up your Rancher and Kubernetes credentials. Once you have Pulumi installed and configured, you can use the@pulumi/rancher2
package to interact with your Rancher instance.Below is a step-by-step guide explaining and a Pulumi program written in TypeScript to deploy the
gitea-operator
helm chart.-
Setting up the Pulumi project: Initiate a new Pulumi project by running
pulumi new typescript
. -
Installing the necessary packages: Within your Pulumi project, you need to install the rancher2 provider package, which allows you to interact with Rancher's resources. You can install it using
npm
oryarn
:npm install @pulumi/rancher2
or
yarn add @pulumi/rancher2
-
Referencing the Rancher cluster: You'll create an instance of
rancher2.Cluster
to reference the specific Kubernetes cluster managed by Rancher on which you wish to deploy the helm chart. -
Deploying the helm chart: Use
rancher2.AppV2
resource to deploy thegitea-operator
helm chart to the referenced Kubernetes cluster.
Here is the TypeScript Pulumi program that deploys the
gitea-operator
helm chart:import * as pulumi from '@pulumi/pulumi'; import * as rancher2 from '@pulumi/rancher2'; // Create a Rancher2 provider instance using credentials from the cluster const rancher2Provider = new rancher2.Provider('my-rancher', { /* You need to provide your Rancher API URL, access key, and secret key. These can be set in the following ways: - By using `pulumi config` commands, - By setting environment variables, - Or by specifying the values directly in the code, which is not recommended for secrets. */ }); // Reference an existing cluster in Rancher const cluster = rancher2.Cluster.get("myCluster", "my-cluster-id"); // Deploy the gitea-operator helm chart on the Rancher-managed cluster const giteaApp = new rancher2.AppV2("gitea-operator", { clusterId: cluster.id, repoName: "helm", // The name of the helm repo in Rancher chartName: "gitea-operator", // Name of the chart in the repo namespace: "default", // Namespace to deploy into, change if needed // Values for the chart can be provided below as key-value pairs values: { // ...insert any custom values required for your gitea-operator chart... }, }, { provider: rancher2Provider }); // Export the name of the deployed app export const appName = giteaApp.name;
This program initializes a Pulumi application using
@pulumi/rancher2
provider, references a Rancher-managed Kubernetes cluster, and deploys thegitea-operator
helm chart. Modify theclusterId
,repoName
, andchartName
accordingly along with any values needed for the helm chart deployment. Thevalues
field is a map that accepts configuration options for the helm chart.Please replace
"my-cluster-id"
with the actual ID of your Rancher-managed cluster and configure therancher2Provider
with the appropriate credentials.After writing this code in a
.ts
file, you may runpulumi up
to preview and deploy the changes. Make sure to review the proposed changes in the preview before confirming the deployment.-