-
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
fix: krm exec function working dir #4654
fix: krm exec function working dir #4654
Conversation
|
Welcome @aabouzaid! |
Hi @aabouzaid. 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. |
/check-cla |
@KnVerey, does the implementation match your expectations? @aabouzaid, have you found an existing test that we can augment or duplicate to test this change? |
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.
Please feel free to add a unit test, this approach seems fine to me. Thanks!
/ok-to-test |
@seh @aabouzaid, https://github.com/kubernetes-sigs/kustomize/blob/master/api/krusty/fnplugin_test.go has some tests for KRM exec functions that you may be able to model after. |
@aabouzaid: This PR has multiple commits, and the default merge method is: merge. 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. |
5885360
to
d1a4bcf
Compare
@natasha41575 I've created the |
@KnVerey @natasha41575 could you please take a look at this PR? It's ready. |
@KnVerey @natasha41575 could we at least run the CI pipeline to make sure everything as expected 😅 |
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.
Can you please also rebase when you address the comments?
Re: the tests, Github isn't even offering me the button to run them for some reason. I've never seen that before, and I'll look into it if it doesn't start working after you push again.
@aabouzaid do you plan to continue this PR? It looks like we may need this functionality for #3980, which @annasong20 is working on. She'd like to pick this up unless you are still working on it. |
@natasha41575 Yes, I will try to finish it over the weekend. |
7b8484d
to
8566b9b
Compare
/ok-to-test |
/retest |
api/krusty/fnplugin_test.go
Outdated
@@ -126,7 +132,7 @@ spec: | |||
assert.NoError(t, fSys.RemoveAll(tmpDir.String())) | |||
} | |||
|
|||
func TestFnExecGeneratorWithOverlay(t *testing.T) { | |||
func TestFnExecGeneratorInOverlay(t *testing.T) { |
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.
Can we change this back to TestFnExecGeneratorWithOverlay
? In my last comment, I was only referring to the new test you added, TestFnExecTransformerInOverlay
. In this generator test, the exec generator is actually in the base, not the overlay, so it should be "with".
Sorry, my bad for not clarifying!
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.
Actually, I've renamed the functions to make it clear and avoid all of that confusion.
For example, for the transformer, we now have:
- TestFnExecTransformerInBase: The transformer is in the base, and there is no overlay.
- TestFnExecTransformerInBaseWithOverlay: The transformer is in the base, and there is an overlay, but it has no transformer.
- TestFnExecTransformerInOverlay: The transformer is in the overlay and not in the base.
And the generator follows the same pattern.
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.
Fantastic!
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.
/approve
@annasong20 go ahead and lgtm once you're satisfied your comments are addressed
Thank you to both of you for your work on this fix and its review!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aabouzaid, KnVerey The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
e7c2348
to
73224d2
Compare
73224d2
to
3e447da
Compare
I've addressed all comments. So we are ready to go. ✔️ I see that there is alredy an error in the CI pipeline but it has nothing to do with this PR. |
`) | ||
|
||
m := th.Run(prod, o) | ||
assert.NoError(t, err) |
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.
This assert
statement and the one here: https://github.com/kubernetes-sigs/kustomize/pull/4654/files#diff-34d93fef5d3973a037f7871d2010ebaa89547617081d5f672bac16be3bf88160R192
are still redundant, but not a big deal.
@@ -41,7 +41,19 @@ spec: | |||
EOF | |||
` | |||
|
|||
func TestFnExecGenerator(t *testing.T) { | |||
const krmTransformerDotSh = `#!/bin/bash |
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.
Thank you for making this change!
/lgtm |
@annasong20 thanks for reviewing this PR 👌 |
Totally on me. I didn't realize it would auto-merge... Thanks for bringing this up! |
Based on @seh tip in #4347
This change makes a deep copy from the loader config instead of passing a reference to the config.
How to test: Follow the steps in #4347.
I've added 2 tests: