Add option --include-crds in expandHelmTemplate function for Helm v3
enkov opened this issue · comments
In Helm v3 hook crd-install
was removed and instead of it helm v3 look for CRD's in crd folder, but by default, helm template command doesn't render the CRD's. To render CRD's with helm v3 we need to pass --include-crds
flag to command line.
Pull Request where Helm v3 added this option
Helm v3 docs about CRD's
I think it will be great to have the ability to pass any argument to helm template command.
In config, it could look like this:
extraArgs: ['--include-crds', '--post-renderer ./path/to/executable']
Found another issue with helm template command.
In some charts there is a check for Capabilities.APIVersions like:
if ( .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" )
and by default helm template command doesn't check for avaible API in kubernetes cluster.
To fix this we need to pass --validate
to helm template command.
In some charts there is a check for Capabilities.APIVersions like:
if ( .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" )
and by default helm template command doesn't check for avaible API in kubernetes cluster.
To fix this we need to pass --validate to helm template command.
Not sure, but wouldn't be better to use helm upgrade --install --dry-run
instead of helm template
?
Or even add new function, std.native('shell')
to evaluate any arbitrary command, not only helm.
BTW for now I have reliable workaround, to just link all the crds to component directory, eg:
cd components
ln -s ../vendor/path/to/crds/* .
this solution works as a charm, except the fact that you need to keep eye on filename changes.
I guess glob-import
could also be good alternative to this, good point that all crds can also be moved in separate component, eg:
local p = importstr 'glob-import:../vendor/path/to/crds/*';
[
std.native('parseYaml')(p[x])
for x in std.objectFields(p)
]
but currently import
does not support import YAMLs, and importstr
returns a string, not an object, eg:
"{\n\t'../vendor/co-deployments/helm/charts/hpe-csi-driver/crds/hpe-nodeinfo-crd.yaml': import '../vendor/co-deployments/helm/charts/hpe-csi-driver/crds/hpe-nodeinfo-crd.yaml',\n\t'../vendor/co-deployments/helm/charts/hpe-csi-driver/crds/hpe-replicated-device-info-crd.yaml': import '../vendor/co-deployments/helm/charts/hpe-csi-driver/crds/hpe-replicated-device-info-crd.yaml',\n\t'../vendor/co-deployments/helm/charts/hpe-csi-driver/crds/hpe-volumeinfo-crd.yaml': import '../vendor/co-deployments/helm/charts/hpe-csi-driver/crds/hpe-volumeinfo-crd.yaml',\n}"
So parseYaml
also nit possible.
Not sure that it is expected behavior, cc @gotwarlost
I can also append that glob-import can be really useful for yaml files, eg I want to define all my qbec applications in argocd.
import 'glob-import:../*/qbec.yaml'
I would take all qbec.yaml
, then parse them and define an applications in argocd using app of apps pattern
https://argoproj.github.io/argo-cd/operator-manual/cluster-bootstrapping/
Ah probably fixed, this constriction is quite well, docs, thank you!:
local a = import 'glob-importstr:../*/qbec.yaml';
{
[x]: std.native('parseYaml')(a[x])
for x in std.objectFields(a)
}