-
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
Added list of env variables for fn-plugins #2999
Conversation
KRM-functions should be able get env variables. Reflecting in `build` cmd args added in [1] for `fn run` cmd. [1] kubernetes-sigs#2988
Hi @aodinokov. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
cc: @Shell32-Natsu |
/ok-to-test |
Can you add some tests in |
api/krusty/fnplugin_test.go runs tests with kpt-functions inside containers. that's a good idea to make something that passes env and expect the result based on the env variable value. the only concern, that I don't know any kpt-functions that need env variables. except 2 that I've written by myself :) That's why I'm not sure right now if it's possible to write a good test for that. with std kpt-functions I may use envs values, but not sure how to check... will need to look inside to find a good one |
OK, let's consider that later. |
Thanks for the SOPs function in GoogleContainerTools/kpt-functions-catalog#101 by all means please contribute a simple test function in go that use env vars (e.g. accepts them and emits their values somewhere in the output). https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/master/functions/go |
Was thinking about reusing already existing functions. helm_template looked promising, but it appeared that I ended up with this go-templater. Here is the ut that comply with our goal:
The implementation doesn't' look difficult to me, but of course it's not the simplest option. Is it simple enough? |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: aodinokov The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
please find this test I've added: it will be necessary to wait for GoogleContainerTools/kpt-functions-catalog#103 to be able to change image to gcr.io/kpt-functions/templater . |
Probably we should use one PR for both code and test. @monopole |
np. actually I just realized that these changes I propose now are not so critical, since it's now possible to make the following the plugin config file and basically get the previous behaviour, but for the limited number of vars:
the changes you made for env vars there + setting a user to run container are awesome 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
KRM-functions should be able to get env variables.
After changes of runfn object fn based plugins don't
get them anymore.
Reflecting in
build
cmd args added in [1]for
fn run
cmd.[1]
#2988