Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option --include-crds in expandHelmTemplate function for Helm v3 #126

Open
enkov opened this issue Apr 15, 2020 · 7 comments
Open

Add option --include-crds in expandHelmTemplate function for Helm v3 #126

enkov opened this issue Apr 15, 2020 · 7 comments

Comments

@enkov
Copy link

enkov commented Apr 15, 2020

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

@enkov
Copy link
Author

enkov commented Apr 15, 2020

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']

@enkov
Copy link
Author

enkov commented Jun 1, 2020

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.

@kvaps
Copy link
Contributor

kvaps commented Aug 28, 2020

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?

@kvaps
Copy link
Contributor

kvaps commented Aug 28, 2020

Or even add new function, std.native('shell') to evaluate any arbitrary command, not only helm.

@kvaps
Copy link
Contributor

kvaps commented Dec 21, 2020

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

@kvaps
Copy link
Contributor

kvaps commented Jan 8, 2021

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/

@kvaps
Copy link
Contributor

kvaps commented Feb 16, 2021

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)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants