-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Feature request: read from stdin as a resource #2985
Comments
@monopole WDYT? |
For the particular case of reading from a helm chart, we have this example. It could use some improvement - see #3128 A previously proposed interpretation of a missing
If this implicit inclusion method were supported (i.e. if no resource manifest is specified, then read all the files in the directory tree), then kustomize would have to provide an exclusion manifest to specify the files that should not be included (like a The goal of these choices is to err on the side of literal declaration of the cluster's configuration. One should only have to consult a kustomization file (and the files it points to) to understand the config, and not also have to understand what was on disk at the time someone ran Reading from But it breaks the notion of declaring what you use even more than globbing does. With globbing, you can maybe assume that if the kustomization file and its surroundings were maintained in source control that you have a clear declaration of configuration. Leaving this issue open for more comment. Would like to see #3128 done before thinking about allowing Meanwhile suggest try following the chartinflator example (see the unit test). |
Allow reading resources from stdin, using os.Stdin and ioutil.ReadAll to stay platform agnostic. This change allows specifying /dev/stdin in the "resources: {}" block to read resources from stdin, while still processing all other resources as normal. This is useful for helms post render hooks closes: kubernetes-sigs#2985
Not sure it's the best option, because kustomize may call other kustomization in resources and it also may have that "-". One more idea - to add a flag The underlaying kustomizations in that case won't get that resources - only the top one. also it may allow to remove some of that separate commands in
because it's possible to do them with kustomization... to be specific annotate works oob and grep may be done with patch (with target and $patch:delete). cc: @monopole |
Adds a special flag --as-transformer that converts kustomize behavior to something similar to transformer because it may read yamls from stdin, customize them and write to stdout. closes: kubernetes-sigs#2985
@monopole and I discussed this at length, and in the end we agreed that this feature should not be accepted. Although the trigger isn't CLI args or env vars in this case, it is definitely still a "build-time side effect". While it may be convenient for certain workflows built around it, facilitating dependence on build-time side-effects violates an important principle of Kustomize's approach. As @monopole commented earlier, "one should only have to consult a kustomization file (and the files it points to) to understand the config, and not also have to understand what was on disk at the time someone ran As for the Helm use case in particular, the example mentioned earlier has been replaced with / promoted to a built-in transformer, and contributions to make it better for real-world Helm use cases are appreciated. /close |
@KnVerey: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This is a great explanation...
When I PoC'ed that feature with additional flag Thank you @KnVerey :) |
This uses envsubst + kustomize to apply any overlays to resources as part of the release process. envsubst is used to evaluate environment variables in place before handing off to kustomize, since kustomize does not support reading from stdin (kubernetes-sigs/kustomize#2985).
This uses envsubst + kustomize to apply any overlays to resources as part of the release process. envsubst is used to evaluate environment variables in place before handing off to kustomize, since kustomize does not support reading from stdin (kubernetes-sigs/kustomize#2985).
Disappointing. This would be great:
|
Would it be possible to have kustomize build read the resource from stdin, just like Unix pipes work?
That would simplify use cases, which at the moment include kustomize unnecessarily via wrapper scripts.
For example:
helm template --post-renderer ./kustomize-wrapper.sh
kustomize-wrapper.sh:
It would be conceivable to have kustomize read from stdin if no resource is specified, or "-" (minus) or /dev/fd/0 for a resource path
Thanks!
The text was updated successfully, but these errors were encountered: