Skip to content

Commit cc0e53a

Browse files
committed
feat(charts): add rhoso-apps helm chart and ci
Add Helm chart for Argo CD Applications (templates, values, values.schema.json), and a path-filtered GitHub Actions workflow (lint, template, package) with a TODO for publishing release artifacts. Refs: https://redhat.atlassian.net/browse/OSPRH-27658 AI-Assist: Cursor; model=Composer-2; mode=agent; origin=cursor Made-with: Cursor
1 parent 63d2510 commit cc0e53a

10 files changed

Lines changed: 742 additions & 0 deletions

File tree

.github/workflows/helm-chart.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
# Validate charts/rhoso-apps: lint (incl. values.schema.json), helm-unittest,
3+
# kubeconform on rendered CRs, package.
4+
# TODO: When release process is defined, persist and publish the chart artifact
5+
# (rhoso-apps-<version>.tgz from `helm package`)—e.g. GitHub Release asset, Helm
6+
# HTTP repo, or OCI registry—for downloadable installs.
7+
name: helm-chart
8+
permissions:
9+
contents: read
10+
on: # yamllint disable-line rule:truthy
11+
pull_request:
12+
branches:
13+
- main
14+
paths:
15+
- "charts/**"
16+
- ".github/workflows/helm-chart.yml"
17+
push:
18+
branches:
19+
- main
20+
paths:
21+
- "charts/**"
22+
- ".github/workflows/helm-chart.yml"
23+
jobs:
24+
validate:
25+
runs-on: ubuntu-latest
26+
env:
27+
# Pin tool versions (kubeconform: https://github.com/yannh/kubeconform/releases)
28+
KUBECONFORM_VERSION: v0.6.7
29+
# helm-unittest plugin: https://github.com/helm-unittest/helm-unittest/releases
30+
HELM_UNITTEST_VERSION: "0.7.0"
31+
# Kubernetes OpenAPI for built-in kinds; Argo Application uses Datree CRDs-catalog.
32+
KUBERNETES_SCHEMA_VERSION: "1.29.0"
33+
defaults:
34+
run:
35+
working-directory: charts/rhoso-apps
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
40+
- name: Install Helm
41+
uses: azure/setup-helm@v4
42+
with:
43+
version: v3.16.3
44+
45+
- name: Install helm-unittest plugin
46+
run: helm plugin install https://github.com/helm-unittest/helm-unittest.git --version "${HELM_UNITTEST_VERSION}"
47+
48+
- name: Install kubeconform
49+
run: |
50+
set -euo pipefail
51+
mkdir -p "${HOME}/.local/bin"
52+
curl -sSL "https://github.com/yannh/kubeconform/releases/download/${KUBECONFORM_VERSION}/kubeconform-linux-amd64.tar.gz" | tar xz -C /tmp
53+
mv /tmp/kubeconform "${HOME}/.local/bin/kubeconform"
54+
echo "${HOME}/.local/bin" >> "${GITHUB_PATH}"
55+
56+
- name: Helm lint
57+
run: helm lint . -f values.yaml
58+
59+
- name: Helm unittest
60+
run: helm unittest .
61+
62+
- name: Helm template (kubeconform)
63+
run: |
64+
set -euo pipefail
65+
helm template rhoso-apps-test . -f values.yaml | kubeconform -summary \
66+
-kubernetes-version "${KUBERNETES_SCHEMA_VERSION}" \
67+
-schema-location default \
68+
-schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json'
69+
70+
# Produces rhoso-apps-*.tgz; publishing is TODO until release workflow exists (see file header).
71+
- name: Helm package
72+
run: helm package .

.yamllint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ ignore:
55
- '*.env'
66
- '*.txt'
77
- '*.sh'
8+
# Helm templates are not valid YAML until rendered (Go templating).
9+
- 'charts/**/templates/**'
810

911
rules:
1012
line-length:

charts/rhoso-apps/.helmignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
24+
# helm-unittest suites (not part of the packaged chart)
25+
tests/

charts/rhoso-apps/Chart.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
apiVersion: v2
3+
name: rhoso-apps
4+
description: Create and manage argocd applications to deploy RHOSO
5+
6+
# A chart can be either an 'application' or a 'library' chart.
7+
#
8+
# Application charts are a collection of templates that can be packaged into versioned archives
9+
# to be deployed.
10+
#
11+
# Library charts provide useful utilities or functions for the chart developer. They're included as
12+
# a dependency of application charts to inject those utilities and functions into the rendering
13+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
14+
type: application
15+
16+
# This is the chart version. This version number should be incremented each time you make changes
17+
# to the chart and its templates, including the app version.
18+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
19+
version: 0.1.0
20+
21+
# This is the version number of the application being deployed. This version number should be
22+
# incremented each time you make changes to the application. Versions are not expected to
23+
# follow Semantic Versioning. They should reflect the version the application is using.
24+
# It is recommended to use it with quotes.
25+
appVersion: "18.0.17"

charts/rhoso-apps/README.md

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# rhoso-apps Helm chart
2+
3+
This chart renders Argo CD `Application` resources to deploy Red Hat OpenStack Services on OpenShift (RHOSO) and related manifests from Git. Chart-wide defaults apply to every rendered application; each entry under `applications` is optional and can be toggled or overridden independently.
4+
5+
## Chart-wide values
6+
7+
| Key | Type | Description |
8+
|-----|------|-------------|
9+
| `applicationNamespace` | string | Namespace for the Argo CD `Application` CRs (`metadata.namespace`). Default: `openshift-gitops`. |
10+
| `destinationServer` | string | `spec.destination.server` for every application. Default: `https://kubernetes.default.svc`. |
11+
12+
This chart does not set `spec.destination.namespace`; only `destination.server` is set (from `destinationServer`).
13+
14+
## Per-application keys (`applications.<name>`)
15+
16+
Each `<name>` is a unique key (DNS-1123). Set `enabled: true` to render that `Application`; set `enabled: false` to skip it.
17+
18+
| Key | Type | Description |
19+
|-----|------|-------------|
20+
| `enabled` | bool | If `true`, render an `Application` CR; if `false`, skip. |
21+
| `repoURL` | string | `spec.source.repoURL` (Git URL). |
22+
| `path` | string | Directory in the repo; empty uses default `"."`. |
23+
| `targetRevision` | string | Branch, tag, or commit; empty uses default `"HEAD"`. |
24+
| `syncWave` | string | `argocd.argoproj.io/sync-wave` annotation. |
25+
| `syncOptions` | list | Optional strings merged into `spec.syncPolicy.syncOptions` (for example `Prune=true`). |
26+
| `kustomize` | map | Optional; passed to `spec.source.kustomize` (`namePrefix`, `patches`, `components`, etc.). See [Argo CD Kustomize](https://argo-cd.readthedocs.io/en/stable/user-guide/kustomize/). |
27+
| `finalizers` | list | `metadata.finalizers` (Argo CD resources finalizer). Valid: `resources-finalizer.argocd.argoproj.io/background` or `.../foreground`. Omit to use chart default (background). |
28+
| `project` | string | Argo CD `AppProject`; default `default` if unset. |
29+
| `syncPolicy` | map | Merged with `syncOptions` into `spec.syncPolicy`. |
30+
31+
### Adding a new application
32+
33+
Copy a block under `applications`, choose a unique key, set `enabled: true`, and set `repoURL`, `path`, and `targetRevision` as needed.
34+
35+
### Default applications (from `values.yaml`)
36+
37+
These entries ship enabled by default; each has a `syncWave` that defines Argo CD apply order (lower waves first).
38+
39+
| Application | Purpose (summary) | Default `syncWave` |
40+
|-------------|---------------------|--------------------|
41+
| `operator-dependencies` | MetalLB, nmstate, cert-manager | `-20` |
42+
| `openstack-operator` | OpenStack operator | `-20` |
43+
| `openstack-operator-cr` | Main OpenStack custom resource | `-15` |
44+
| `openstack-secrets` | Vault secrets operator | `-10` |
45+
| `openstack-networks` | Control plane and dataplane networks | `0` |
46+
| `openstack-controlplane` | `OpenStackControlPlane` | `10` |
47+
| `openstack-dataplane` | Data plane node set and deployment | `20` |
48+
49+
## Default application ordering (sync waves)
50+
51+
Replace the placeholder below with a diagram of the default sync-wave ordering for the applications listed in `values.yaml`.
52+
53+
```mermaid
54+
flowchart TD
55+
A["operator-dependencies (-20)"] --> C["openstack-operator-cr (-15)"]
56+
B["openstack-operator (-20)"] --> C["openstack-operator-cr (-15)"]
57+
C --> D["openstack-secrets (-10)"]
58+
D --> E["openstack-networks (0)"]
59+
E --> F["openstack-controlplane (10)"]
60+
F --> G["openstack-dataplane (20)"]
61+
```
62+
63+
## Layered values and partial overrides
64+
65+
Helm merges values files left to right: later files override earlier ones. Keep a **base** `values.yaml` (or your fork of the chart defaults) and add **environment** files that only change what differs (for example one Git revision, one path, or a single application).
66+
67+
### Install with base + environment file
68+
69+
```bash
70+
helm install deploy-rhoso . \
71+
-f values.yaml \
72+
-f values-prod.yaml
73+
```
74+
75+
Use any release name and paths; `values-prod.yaml` can be minimal.
76+
77+
### Example: override Git revision for all apps that share defaults
78+
79+
`values-revision.yaml`:
80+
81+
```yaml
82+
applications:
83+
operator-dependencies:
84+
targetRevision: main
85+
openstack-operator:
86+
targetRevision: main
87+
openstack-operator-cr:
88+
targetRevision: main
89+
openstack-secrets:
90+
targetRevision: main
91+
openstack-networks:
92+
targetRevision: main
93+
openstack-controlplane:
94+
targetRevision: main
95+
openstack-dataplane:
96+
targetRevision: main
97+
```
98+
99+
```bash
100+
helm template deploy-rhoso . -f values.yaml -f values-revision.yaml
101+
```
102+
103+
### Example: change only one application
104+
105+
Disable or repoint a single app without repeating the rest of `values.yaml`:
106+
107+
`values-disable-dataplane.yaml`:
108+
109+
```yaml
110+
applications:
111+
openstack-dataplane:
112+
enabled: false
113+
```
114+
115+
`values-custom-controlplane-path.yaml`:
116+
117+
```yaml
118+
applications:
119+
openstack-controlplane:
120+
path: environments/prod/controlplane
121+
targetRevision: v1.2.3
122+
```
123+
124+
```bash
125+
helm install deploy-rhoso . -f values.yaml -f values-custom-controlplane-path.yaml
126+
```
127+
128+
### Example: Kustomize overrides for one application
129+
130+
`values-dev-prefix.yaml`:
131+
132+
```yaml
133+
applications:
134+
openstack-networks:
135+
kustomize:
136+
namePrefix: dev-
137+
```
138+
139+
### Example: chart-wide + per-app in one overlay
140+
141+
`values-staging.yaml`:
142+
143+
```yaml
144+
destinationServer: https://kubernetes.default.svc
145+
applications:
146+
openstack-operator:
147+
targetRevision: staging
148+
openstack-controlplane:
149+
syncWave: "15"
150+
```
151+
152+
Later keys win for the same path; unspecified keys under `applications.<name>` keep values from `values.yaml`.
153+
154+
## See also
155+
156+
- [Argo CD Application specification](https://argo-cd.readthedocs.io/en/stable/operator-manual/application-specification/)
157+
- Chart templates: `templates/application.yaml`, `templates/_helpers.tpl`
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{{/*
2+
Namespace for Argo CD Application CRs (metadata.namespace).
3+
Pass root context ($) from inside range.
4+
*/}}
5+
{{- define "rhoso-apps.applicationNamespace" -}}
6+
{{- default "openshift-gitops" .Values.applicationNamespace | quote -}}
7+
{{- end }}
8+
9+
{{/*
10+
Default Kubernetes API server URL for spec.destination.server.
11+
Pass root context ($) from inside range.
12+
*/}}
13+
{{- define "rhoso-apps.destinationServer" -}}
14+
{{- default "https://kubernetes.default.svc" .Values.destinationServer | quote -}}
15+
{{- end }}
16+
17+
{{/*
18+
Argo CD AppProject name; empty string in values maps to "default".
19+
Pass dict with key "app" (per-application values map).
20+
*/}}
21+
{{- define "rhoso-apps.argocdProject" -}}
22+
{{- $app := .app -}}
23+
{{- default "default" $app.project | quote -}}
24+
{{- end }}
25+
26+
{{/*
27+
Repository path under spec.source.path.
28+
*/}}
29+
{{- define "rhoso-apps.sourcePath" -}}
30+
{{- $app := .app -}}
31+
{{- default "." $app.path | quote -}}
32+
{{- end }}
33+
34+
{{/*
35+
Git revision, branch, or tag for spec.source.targetRevision.
36+
*/}}
37+
{{- define "rhoso-apps.targetRevision" -}}
38+
{{- $app := .app -}}
39+
{{- default "HEAD" $app.targetRevision | quote -}}
40+
{{- end }}
41+
42+
{{/*
43+
Optional spec.source.kustomize (Argo CD Kustomize overrides).
44+
Pass dict with key "app" (per-application values map). Omitted if unset, non-map, or empty map.
45+
*/}}
46+
{{- define "rhoso-apps.sourceKustomize" -}}
47+
{{- $app := .app -}}
48+
{{- $k := $app.kustomize | default dict }}
49+
{{- if not (kindIs "map" $k) }}
50+
{{- $k = dict }}
51+
{{- end }}
52+
{{- if not (empty $k) }}
53+
kustomize:
54+
{{ toYaml $k | nindent 6 }}
55+
{{- end }}
56+
{{- end }}
57+
58+
{{/*
59+
Merge syncPolicy map with optional syncOptions; emit spec.syncPolicy block or nothing.
60+
Pass dict with key "app" (per-application values map).
61+
*/}}
62+
{{- define "rhoso-apps.syncPolicySpec" -}}
63+
{{- $app := .app -}}
64+
{{- $merged := $app.syncPolicy | default dict }}
65+
{{- if not (kindIs "map" $merged) }}
66+
{{- $merged = dict }}
67+
{{- end }}
68+
{{- if and $app.syncOptions (not (empty $app.syncOptions)) }}
69+
{{- $merged = merge $merged (dict "syncOptions" $app.syncOptions) }}
70+
{{- end }}
71+
{{- if not (empty $merged) }}
72+
syncPolicy:
73+
{{ toYaml $merged | indent 4 }}
74+
{{- end }}
75+
{{- end }}
76+
77+
{{/*
78+
Argo CD Application metadata.finalizers (resources finalizer: background vs foreground).
79+
Omitted finalizers default to background deletion.
80+
Pass dict with key "app" (per-application values map).
81+
*/}}
82+
{{- define "rhoso-apps.applicationFinalizers" -}}
83+
{{- $app := .app -}}
84+
{{- $f := default (list "resources-finalizer.argocd.argoproj.io/background") $app.finalizers }}
85+
{{- toYaml $f -}}
86+
{{- end }}

0 commit comments

Comments
 (0)