-
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
add check that kustomization is empty #4949
add check that kustomization is empty #4949
Conversation
cc @KnVerey |
7a2d5db
to
1ae8490
Compare
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
/triage accepted |
@@ -301,6 +301,27 @@ func (k *Kustomization) FixKustomizationPreMarshalling(fSys filesys.FileSystem) | |||
return nil | |||
} | |||
|
|||
func (k *Kustomization) CheckEmpty() error { |
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.
Am I right to think that we want to throw an error on any file that does not contain any transformers? The code below effectively excludes files that specifically contain only Kustomization type metadata, but I suspect it would actually allow fully empty files or files with partial type meta (which is currently allowed, for better or for worse). I suggest changing the tests to be against raw yaml input rather than struct input to demonstrate the various cases more thoroughly. I also suggest trying the opposite approach for the comparison: deep copy the input Kustomization, clear its type meta, and then compare it to a completely empty object (in object form, not as yaml). LMK what you think of that approach.
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 your advice!
I agree with your opinions.
I fixed these codes.
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. |
0126d4b
to
a7ec04e
Compare
a7ec04e
to
928b823
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: koba1t, natasha41575 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 |
This was a breaking change with
Gets localized as:
The localized version in 5.1.0 is unable to build with this change. |
kustomization.yaml
.kustomize build
for an emptykustomization.yaml
file after merging this PR, we'll get the error.