-
Notifications
You must be signed in to change notification settings - Fork 226
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
kpt fn
commands includes functionConfigs
and Kptfile
by defaults as function input
#2894
Conversation
functionConfig
by defaults in kpt fn
commands
functionConfig
by defaults in kpt fn
commandsfunctionConfig
and Kptfile
by defaults in kpt fn
commands
@@ -16,5 +16,6 @@ runCount: 2 | |||
testType: eval | |||
image: gcr.io/kpt-fn/set-namespace:v0.1.3 | |||
includeMetaResources: true | |||
exitCode: 1 |
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.
Why?
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 this PR removes --includeMetaResources
commandline flag, so instead of deleting this test, I re-purposed to test the error if someone specifies this flag. I should probably add comment explaining that.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
- |
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 diff is not useful. We should to tweak it to get rid of this diff.
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.
Thanks for pointing out. Fixed it.
--- a/db/fn-config.yaml | ||
+++ b/db/fn-config.yaml | ||
@@ -1,17 +1,3 @@ | ||
-# Copyright 2021 Google LLC |
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.
It seems the license header become part of the diff. It's verbose and not useful.
I guess we don't want the license header to be part of the diff.
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.
Removed the license header.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
- |
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.
Same comment here and below
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.
Fixed.
This is important step. Otherwise, users may not have a clear way to upgrade.
It will impact not only horizontal transformers but also any functions uses OpenAPI (e.g. kubeval). We also need to verify if the comments in Kptfile can be preserved after going through KRM functions. |
This PR should be merged after this enhancement has been implemented. /cc @natasha41575 |
functionConfig
and Kptfile
by defaults in kpt fn
commandskpt fn
commands includes functionConfigs
and Kptfile
by defaults as function input
@droot I am wondering what is the usecase for this? Afaict in a cluster functionConfig would not mean anything and only seems useful in the context of a function. |
I should have worded it better (updated it in the PR description). Basically from |
@@ -57,8 +57,6 @@ func GetEvalFnRunner(ctx context.Context, parent string) *EvalFnRunner { | |||
&r.Exec, "exec", "", "run an executable as a function") | |||
r.Command.Flags().StringVar( | |||
&r.FnConfigPath, "fn-config", "", "path to the function config file") | |||
r.Command.Flags().BoolVarP( | |||
&r.IncludeMetaResources, "include-meta-resources", "m", false, "include package meta resources in function input") |
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.
If we want to print a helpful message when they are using this flag, we can't remove these lines. As you asked, I created a draft PR (#2939) for how to gracefully let users know this is no longer available, you can integrate that code into this PR.
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.
Yes, re-introduced include-meta-resources
as hidden flag and throwing an error as suggested in your PR. Thanks.
@mortent Can you take a look at the |
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.
Overall LGTM. Some minor comments about backward compatible handling
Thanks for the review Yuwen. Addressed the comments. |
Thanks everyone for reviewing! |
* refactor starlark function * use kpt before kptdev/kpt#2894 merged * fix a test
* refactor starlark function * use kpt before kptdev/kpt#2894 merged * fix a test
hi @droot If so, how can I make the |
We added mechanism to exclude resources on the basis of labels, annotations, group/version/kind/namespace/name in I don't think we added to kpt fn source. If you are combining |
Thanks for the quick reply. The use case is following:
If I understand it correctly, the function exclude capability mentioned above will simply not apply transformations to the excluded resources but will still pass the whole pkg to the next pipe. |
Thanks for the sharing the use-case. The best solution will be for It requires using another tool called kubectl-slice.
Hope this helps. |
I wasn't aware of kubectl-slice - nice tool! I have found another workaround using yq: Thanks for your help 👍 |
This PR introduces following (breaking) changes:
functionConfigs
andKptfile
) in any special way. That means:- Include
functionConfigs
andKptfile
by default in the function inputs inkpt fn
commands.- Apply all resources to the cluster in
kpt live
commands unlesslocal-config
annotation is specified--include-meta-resources
flag has been removed fromkpt fn eval
andkpt fn source
commands.kpt fn render
now includesfunctionConfigs
andKptfile
as input to the functions like otherkpt fn
Note: I will add more details about the rationale behind this breaking change. Also this change will depend on following enhancements before merging in main:
kpt
should support a way to exclude KRM resources (especially Kptfile and local-configs) so that users who are impacted by this breaking change can use theexclude
directive to migrate to this change.set-namespace
,set-labels
etc. should handle unrecognized resources such as Kptfile gracefully).