-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Exec plugins with argsFromFile can look for the file in wrong locations #4115
Comments
@Gikkman: This issue is currently awaiting triage. SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the The 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. |
Similar issue with exec functions: #4117 |
It's still reproducible on recently released 4.3.0 version. Fix from #4125 seems not to be working properly. |
#4125 only fixed the "function" version of exec plugins, whereas the examples on this issue are using the older env-lookup-based exec plugins. While we would accept a fix to the older exec plugins so that they also use the Kustomization's dir as their working dir, I would recommend switching to the newer "function" style, as the older style is proposed for deprecation as part of the plan to move plugins as a whole out of alpha: kubernetes/enhancements#2954. E.g. it would look like this: apiVersion: teamname/v1
kind: SedTransformer
metadata:
name: not-really-used
annotations:
config.kubernetes.io/function: |-
exec:
path: ../plugins/teamname/v1/sedtransformer/SedTransformer # can be anywhere within the Kustomize root
args: s/HELLO/WORLD/g
argsFromFile: sed-input.txt The function version of exec doesn't have argsFromFile support, so those can either be inlined in the functionConfig as well, or you can pass the filename for your executable to read. If that is problematic for your use case, I'd be interested to hear more details to inform our deprecation plan. /triage under-consideration |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
I had completely forgotten about this issue until I got the Our use case was creating a plugin that did some templating for us, to handle the auto-generated namespaces that we generate for testing. We had a list of what variables were pulled from the environment, using a file. But I think we can solve our case using what you described, by passing the path to the file to the plugin and let it read what it needs. If you plan to deprecate |
When writing a exec custom plugin, the
argsFromFile
seems to try to load the file relative to the root folder of the kustomize project, and not relative to the file describing the plugin. I recon this might be intentional, but since there is no documentation onargsFromFile
, at least to me, this feels unintuitive.You can find an example repo which exhibits the problem here
Files that can reproduce the issue
Expected output
Actual output
Kustomize version
{Version:kustomize/v4.2.0 GitCommit:d53a2ad45d04b0264bcee9e19879437d851cb778 BuildDate:2021-07-01T01:00:35+01:00 GoOs:darwin GoArch:amd64}
Platform
macOS
Additional notes
If you move the
sed-input.txt
to the base folder, the sed transformations are applied as expected.The text was updated successfully, but these errors were encountered: