Deploy the argocd-config helm chart on Opensshift
TypeScriptTo deploy the
argocd-config
Helm chart on an OpenShift cluster using Pulumi, we will use thekubernetes
package, which provides resources to manage Kubernetes resources, including Helm charts.The core resource we'll use is
Chart
, which is a component that enables deploying Helm charts into a Kubernetes cluster.Here's how you can do it step by step:
Prerequisites
- An existing OpenShift Kubernetes cluster where you have administrative access.
kubectl
configured to interact with your cluster.- Pulumi CLI installed and set up to manage resources in your cluster.
Program Explanation and Deployment
Firstly, you would typically pull in the necessary Pulumi packages for your project. In this instance, we're using the
@pulumi/kubernetes
package.Next, you will create a new Pulumi program that defines a
Chart
resource for theargocd-config
Helm chart. You will need to specify the chart’s name, version, and any custom values you want to provide to configure ArgoCD to suit your needs.Given that Helm charts can have dependencies on other charts, Pulumi's Helm support takes care of all the underlying complexities.
In the code,
namespace
specifies the namespace where you want to deploy ArgoCD. If the namespace does not exist, it will be created as part of the deployment process.Here’s what the Pulumi TypeScript program could look like:
import * as k8s from "@pulumi/kubernetes"; // Create an instance of the k8s provider for OpenShift. const openshiftProvider = new k8s.Provider("openshiftProvider", { kubeconfig: "<YOUR_KUBECONFIG_CONTENT>", }); // Define the ArgoCD config Helm chart resource. const argocdConfigChart = new k8s.helm.v3.Chart("argocd-config", { // Assuming 'argocd-config' is the name of the chart and it is available in a helm repository chart: "argocd-config", // Specify the version of the chart you wish to deploy version: "<CHART_VERSION>", // If the argocd-config chart is hosted in a private Helm repo, specify it here fetchOpts: { repo: "https://<YOUR_HELM_REPO_URL>", }, // Provide configuration values for the Chart. // Replace these values with the ones specific to ArgoCD configuration values: { // ... configuration values ... }, namespace: "argocd", // specify the namespace where you want to deploy ArgoCD }, { provider: openshiftProvider }); // Export the resulting base URL where ArgoCD can be accessed. // Note: Adjust the resource property accesses to align with the actual structure and content of the Helm chart deployment output. export const argocdServerUrl = argocdConfigChart.getResourceProperty("v1/Service", "argocd-server", "status").apply(status => { const ingress = status.loadBalancer.ingress[0]; if (ingress.hostname) { return `http://${ingress.hostname}`; } return `http://${ingress.ip}`; });
In this program, replace
<YOUR_KUBECONFIG_CONTENT>
and<CHART_VERSION>
with the actual content of your kubeconfig file and the version of theargocd-config
Chart you want to deploy.The
kubeconfig
field is particularly sensitive as it contains credentials for your Kubernetes cluster. In a real-world scenario, you should manage secrets like these using Pulumi secrets or other secret management systems.This program declares an OpenShift provider and a
Chart
resource that represents theargocd-config
Helm chart. When you runpulumi up
, Pulumi will communicate with your OpenShift cluster to create the resources defined by this Helm chart.You can find more info on Pulumi's Helm support.
After you've written this code into an
index.ts
file, you can deploy it by runningpulumi up
in the terminal from the same directory as your project. Pulumi CLI will show you the planned changes before execution. If you're satisfied with the plan, confirm the deployment, and Pulumi will apply the Helm chart onto your OpenShift cluster.Keep in mind that the specific
values
you need might differ based on your Helm chart's configuration requirements and your cluster's setup.If this is your first Pulumi TypeScript program, be sure to start with
pulumi new typescript
in an empty directory to create a new Pulumi project before adding this code to theindex.ts
file.Always refer to the official documentation and Helm chart details for exact configuration fields and values.