Skip to content
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: add restriction when upgrade addon from 0.8 to 0.9 #433

Closed
wants to merge 4 commits into from

Conversation

loomts
Copy link
Contributor

@loomts loomts commented Aug 28, 2024

assume the situation that addon version is 0.8 and kb version was upgrade from 0.8 to 0.9

  1. add a validation in order to check this situation and return a warning, but which can also be exculated by "--force".
  2. consider that user could disable and enable addon, this scenario will also hit this bug, event flag not set, we should give a warning when simply enable 0.8 addon

@github-actions github-actions bot added the size/M Denotes a PR that changes 30-99 lines. label Aug 28, 2024
@codecov-commenter
Copy link

codecov-commenter commented Aug 28, 2024

Codecov Report

Attention: Patch coverage is 52.38095% with 10 lines in your changes missing coverage. Please review.

Project coverage is 44.91%. Comparing base (0657641) to head (36c8b8a).

Files with missing lines Patch % Lines
pkg/cmd/addon/addon.go 52.38% 8 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #433      +/-   ##
==========================================
+ Coverage   44.89%   44.91%   +0.01%     
==========================================
  Files         157      157              
  Lines       23000    23021      +21     
==========================================
+ Hits        10325    10339      +14     
- Misses      11443    11448       +5     
- Partials     1232     1234       +2     
Flag Coverage Δ
unittests 44.91% <52.38%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -75,6 +76,10 @@ func (r *addonEnableFlags) useDefault() bool {
len(r.TolerationsSet) == 0
}

func (r *addonEnableFlags) noChange() bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if Values are set before upgrading?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

will return a warning and error to tell user should upgrade first, or specify "--force" to directly upgrade

@@ -354,6 +362,24 @@ func (o *addonCmdOpts) validate() error {
return nil
}

func checkBreakingChange(o *addonCmdOpts) error {
if o.addonEnableFlags.noChange() && o.addon.Status.Phase == extensionsv1alpha1.AddonEnabled {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if enable and enabled addon, and disable an disabled addon? For changes that wont modify Addon CR, there won't be a 'PATCH'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

it will do patch, but change nothing, even if the scenario like kb08->09 and addon08

@shanshanying
Copy link
Contributor

Used Webhook instead. Will close this issue.

@github-actions github-actions bot added this to the Release 0.9.1 milestone Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M Denotes a PR that changes 30-99 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Patch an addon upgraded from 0.8 does not work
3 participants