generic-application-helm-chart-openshift

Openshift Manifests via Helm Charts

This repository provides a Helm chart for a generic OpenShift application and a step-by-step workflow to publish the chart as a Helm repository using GitHub Pages and deploy multiple applications using Argo CD ApplicationSet.

Checklist

Overview This README shows how to:

Prerequisites

1) Publish the Helm chart to GitHub Pages (docs/) 1.1 Package the chart (run from the chart directory):

cd generic-application-helm-chart-openshift
helm package . -d ../docs

1.2 Create or update the repository index pointing to the GitHub Pages URL (replace <owner> and <repo>):

# from repo root, put the index in docs/ and point to your GitHub Pages URL
helm repo index docs --url https://<owner>.github.io/<repo>

1.3 Ensure docs/ contains:

1.4 Commit and push docs/ and enable GitHub Pages to serve docs/ from the main branch.

2) Add the Helm repo locally and validate

helm repo add mycharts https://<owner>.github.io/<repo>
helm repo update
helm search repo mycharts/openshift-application --versions
helm pull mycharts/openshift-application --version 0.1.0

3) Deploy multiple apps with Argo CD ApplicationSet

Why ApplicationSet? ApplicationSet lets you generate multiple Argo Application resources from a single template and a generator. Using the list generator (or other generators like git, matrix, and clusters), you can create a set of Applications that deploy the same Helm chart with different values or deploy different charts from different sources.

3.1 Example: multiple applications from a Helm repo Below is an example ApplicationSet that creates multiple Applications from the hosted Helm repo. Each element in the list generator provides per-application parameters (name, target namespace, chart version, etc.). The template uses those parameters to render an Argo Application that installs the Helm chart into a specific namespace.

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: openshift-apps-set
  namespace: openshift-gitops
spec:
  generators:
    - list:
        elements:
          - name: app-alpha
            namespace: app-alpha
            chartVersion: "0.1.0"
            repoURL: https://<owner>.github.io/<repo>
            chart: openshift-application
            values:
              name: app-alpha
              replicaCount: 2
          - name: app-beta
            namespace: app-beta
            chartVersion: "0.1.0"
            repoURL: https://<owner>.github.io/<repo>
            chart: openshift-application
            values:
              name: app-beta
              replicaCount: 1
  template:
    metadata:
      name: '-application'
    spec:
      project: default
      source:
        repoURL: ''
        chart: ''
        targetRevision: ''
        helm:
          values: |
            # inline values block rendered per element
            name: 
            replicaCount: 
      destination:
        server: https://kubernetes.default.svc
        namespace: ''
      syncPolicy:
        automated:
          prune: true
          selfHeal: true

Notes on values in the template

3.2 Example: multiple sources (Git + Helm repo) You can mix generators and elements that point to different sources. For example, use some elements whose source is a Helm repo and others whose source is a Git repo that contains a values file or a sub-chart.

Example element using a Git repo for values:

# element example (inside list)
- name: app-git-values
  namespace: app-git
  repoURL: https://github.com/your-org/your-values-repo.git
  path: charts/overrides
  chart: openshift-application
  chartVersion: 0.1.0

In that case the template.spec.source would use repoURL and path for Git, and the chart would reference the hosted Helm chart (or you can include the chart package directly in that Git repo).

4) Useful workflows & tips

5) Example end-to-end commands

# package and index (from repo root)
cd generic-application-helm-chart-openshift
helm package . -d ../docs
helm repo index ../docs --url https://<owner>.github.io/<repo>

# commit & push
git add docs
git commit -m "Publish helm chart to docs for GitHub Pages"
git push origin main

# add repo locally and verify
helm repo add samplechart https://<owner>.github.io/<repo>
helm repo update
helm search repo samplechart/openshift-application --versions

6) Troubleshooting

7) Where to go from here

If you’d like, I can: