Open akamac opened 2 years ago
Does anyone know of a way of generating the output of a Flux HelmRelease using other tools or a multi-step process?
In addition to flux build helmrelease
, it would be nice to have flux diff helmrelease
. While the former is handy during the local development stage, the latter could be used in CI/CD to generate PR diff.
@MrMarkW If It is not too late, here is the process:
Build Flux Kustomization:
flux build kustomization <kustomization_name> --path dev > out/kustomization_out.yaml
In my case kustomization_out.yaml
contains 2 YAML manifests HelmRepository
and HelmRelease
.
Take Helm repository URL and name from HelmRelease
and add the Helm repo:
helm repo add <helm_repo_name> <helm_repo_url>
Take the values
section from HelmRelease
and add it to values.yaml
file. After that you will be able to render the chart locally:
helm template <name> <helm_repo_name>/<helm_chart_name> -f out/values.yaml > out/helm_out.yaml
If you have postRenderers
section in HelmRelease
, you can create kustomization.yaml
file similar to this one:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- helm_out.yaml
patchesStrategicMerge:
- patch_1.yaml
- patch_2.yaml
- patch_3.yaml
After that move patches from the postRenderers
section to the patch files and render the final result:
kustomize build out
These steps can be scripted. But I don't see why Flux couldn't do the same. Because it is what it already does.
I just created https://github.com/DoodleScheduling/flux-build and came across this issue now, this seems exactly what you are looking for.
Would be great to have this functionality in the official flux cli, for "simple" HelmRelease I've built https://aur.archlinux.org/packages/helmrelease-tools which is quite simple and works surprisingly well 👍
selfish bump
We haven't forgot about this, to enable this feature in the CLI we first have to rewrite helm-controller. This rewrite is tracked in the roadmap under Helm GA. Hopefully we'll have it ready by end of Q3 then we can work on flux build/diff hr
.
any news on this ? For now: @cwrau how would your tool "helmrelease-tools" work in the described steps by @vvbogdanov87 ? thx
any news on this ? For now: @cwrau how would your tool "helmrelease-tools" work in the described steps by @vvbogdanov87 ? thx
Maybe I should write a README or usage note 😅
But you can use hr helmrelease.yaml
to render it, the other tools, like hrDiff
should explain themselves 😁
You can also pipe into it
There is tab completion
And you can do hr hr.yaml $localHelmFolder
to use a local version of the chart
It is also possible to use process substitution <(cmd)
, which treats the output of a command as a file to filter out the .spec.values
from the HelmRelease to use it in helm template
:
helm template <releasename> <helmrepo>/<helmchart> --values <(yq .spec.values < release.yaml) > manifests.yaml
It's not clear how to even debug all the spurious StatefulSet errors without it. Essentially making flux unusable for StatefulSet deploys (from HelmRelease).
It would be great if flux cli could render kubernetes manifests from HelmRelease locally, so it is possible to run static analysis checks against generated files before committing them into repo.