-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 bug in MergeAddons and test #10045
Conversation
This looks like an actual bug because replaces has to be called from the new version by passing the existing as a parameter. It should be |
Reading over the ChannelVersion.replaces code, I'm inclined to agree that this should be flipped around. Given that, I don't understand how new Kops versions could still be applying addons with updated versions. Most of this code hasn't been touched in over a year, some of it 4 years. How has this bug not been noticed until now? /cc @justinsb for input |
@rifelpet: GitHub didn't allow me to request PR reviews from the following users: for, input. Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
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. |
* Replace existing addon if v (new) replaces() existing, instead of the other way around.
9643902
to
61ac9a5
Compare
I've added a commit that modifies the check, as it does seem to make sense as the correct merge behavior, but agree with @rifelpet that its strange this has never been detected. I think its because the usages I see for MergeAddons() are where we merge the addons from the virtual file system (i.e. S3) with those from what appears to be a local filesystem location. I'm not sure this code is even used during normal operations. Further down in apply_channel.go there is additional update code, which I think is the main update logic: https://github.com/kubernetes/kops/blob/master/channels/pkg/cmd/apply_channel.go#L136-L202 |
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.
These should make staticcheck
happy.
@hakman thanks for cleaning that up |
Co-authored-by: Ciprian Hacman <ciprianhacman@gmail.com>
374704f
to
0e442aa
Compare
/retest |
Great find & fix - thanks @nckturner I think we've got away with this in the past because historically we've only normally had a single manifest with our addons, so we likely haven't really gone down this codepath. /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: justinsb, nckturner 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 |
I was a little bit confused by the desired behavior of the AddonMenu merge in channels so I decided to write a test to better understand it. Can someone help me understand the expected behavior after a merge of two AddonMenus, like what happens in
apply_channel.go
? Unless my understanding is incorrect, (or I've got a bug in the test) it seems like the merge behavior is incorrect, or maybe just confusing.This test passes with a change in addon.go from:
to:
So either my intuitive understanding of the MergeAddons function is off or this is a bug?