You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for reading Helm API versions from files (#8)
* Add support for reading API versions from foot comments
* Add Argo Workflows test manifests
* Not the purpose of the `argo-workflows` test files
* Readme: Add TOC, document how to specify API versions
* Readme: Add remainder of sentence
Requires [Helm](https://helm.sh/) and [yq](https://mikefarah.gitbook.io/yq). Both can be installed using [Arkade](https://github.com/alexellis/arkade-get) if needed.
@@ -35,6 +47,7 @@ In `diff_markdown` the output for each file will either be:
35
47
36
48
## Usage
37
49
50
+
<!-- omit in toc -->
38
51
### TL;DR
39
52
40
53
```yaml
@@ -45,6 +58,7 @@ In `diff_markdown` the output for each file will either be:
@@ -174,13 +188,40 @@ Optionally, cause check to fail, if any Helm file failed to render:
174
188
175
189
See [example-workflow.yaml](example-workflow.yaml) for coherent example.
176
190
191
+
192
+
## Dry-running/Emulating API Capabilities
193
+
194
+
When installing, Helm can access the available Kubernetes APIs and versions, through "[Built-in Objects](https://helm.sh/docs/chart_template_guide/builtin_objects/)".
195
+
196
+
This enable charts to deploy custom resources, or tweak properties as needed, based on the APIs offered in the cluster. For example, starting with `argo-workflows` chart 0.41.0, the `ServiceMonitor` resource doesn't even get deployed, if [`.Capabilities.APIVersions.Has`](https://github.com/argoproj/argo-helm/blob/argo-workflows-0.41.0/charts/argo-workflows/templates/controller/workflow-controller-servicemonitor.yaml#L2) doesn't contain [`monitoring.coreos.com/v1`](https://github.com/argoproj/argo-helm/blob/argo-workflows-0.41.0/charts/argo-workflows/templates/_helpers.tpl#L200).
197
+
198
+
This does however also make it difficult to dry-run (using the `helm template` command), with no cluster access. As a workaround, it's possible to specify API version to be used when running the `template` command as commented YAML. The comments has to be the last in the file and must have the document start `---` above. Example:
199
+
200
+
```yaml
201
+
---
202
+
# helm-api-versions:
203
+
# - myapi/v0
204
+
# - monitoring.coreos.com/v1
205
+
```
206
+
207
+
You can verify that the APIs are read correctly from the log output of the "Helm diff" step of the action:
| `argo-workflows` | Read API from comment in helm file (otherwise `ServiceMonitor` resource is not rendered) | Diff shows change to `ServiceMonitor`, instead of being removed |
308
+
| `dcgm-exporter` | Chart added in `head` that doesn't exist in `base` | Diff shows entire rendered template as added |
309
+
| `metaflow` | Very non-standard way of publishing charts (not sure if should be supported) | TBD |
310
+
| `nvidia-device-plugin` | HelmRepository (using `https`), minor chart version bump | Diff (with potentially breaking `nodeAffinity`) |
311
+
| `weave-gitops-helm2oci` | Repository type changed from HelmRepository (type `oci`) to OCIRepository | No changes |
312
+
| `weave-gitops-helmrepo` | HelmRepository with type `oci` | Diff |
0 commit comments