Skip to content

feat(ec): do not allow upgrading more than 1 k8s minor #5313

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

Merged
merged 13 commits into from
May 15, 2025

Conversation

JGAntunes
Copy link
Member

@JGAntunes JGAntunes commented May 7, 2025

What this PR does / why we need it:

This is a temporary measure while we work on releasing 1.31 (see replicatedhq/embedded-cluster#2148), to avoid having customers jump between more than 1 kubernetes minor version (e.g. moving from 1.29 to 1.31).

What we do is return an error that gets exposed in the UI when the user triggers a deploy. This is how it's currently showing up after a user presses deploy under the upgrade:

image

Which issue(s) this PR fixes:

https://app.shortcut.com/replicated/story/113724/release-ec-with-support-for-1-31

Does this PR require a test?

Yes

Does this PR require a release note?

* Limit Kubernetes version upgrades in Embedded Cluster to no more than one minor version at a time.

Does this PR require documentation?

Maybe?

@JGAntunes JGAntunes self-assigned this May 7, 2025
@github-actions github-actions bot added the type::feature New feature or request label May 7, 2025
Comment on lines +52 to +59
currentVersion, err := extractKubeVersion(params.CurrentECVersion)
if err != nil {
return errors.Wrap(err, "failed to extract current kube version")
}
updateVersion, err := extractKubeVersion(params.UpdateECVersion)
if err != nil {
return errors.Wrap(err, "failed to extract update kube version")
}
Copy link
Member Author

Choose a reason for hiding this comment

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

We're erroring out if we fail to extract a valid kube version effectively halting the upgrade process altogether. So my question would be:

  • Could there be EC releases out there without the *+k8s-<version>* version syntax?
  • Should we be more cautious here and instead ignore the check altogether if we fail to extract any of the versions?

Copy link
Member

Choose a reason for hiding this comment

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

new versions should all have k8s-<version>. i think this looks good for now.

Comment on lines +11 to +17
func TestUpdateWithinKubeRange(t *testing.T) {
tests := []struct {
name string
params types.UpgradeServiceParams
expectError bool
expectedErrMsg string
}{
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we have a good way to test the bootstrap and Serve methods right now, particularly because of the large volume of side effects the methods seem to have. I've opted for some unit tests here but curious to hear your thoughts:

  • func Serve(params types.UpgradeServiceParams) error {
    fmt.Printf("Starting KOTS Upgrade Service version %s on port %s\n", buildversion.Version(), params.Port)
    // cleanup on shutdown
    defer cleanup(params)
    if err := bootstrap(params); err != nil {

Copy link
Member

Choose a reason for hiding this comment

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

I think a unit test where you have one is the best option at this point.

if currentVersion.Major() != updateVersion.Major() {
return errors.Errorf("major version mismatch: current %s, update %s", currentVersion.String(), updateVersion.String())
}
if updateVersion.Minor() > currentVersion.Minor()+1 {
Copy link
Member

Choose a reason for hiding this comment

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

do you want to prevent downgrades here as well? or is that handled somewhere else?

Copy link
Member Author

@JGAntunes JGAntunes May 8, 2025

Choose a reason for hiding this comment

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

TIL we support downgrading the kube version 👀 Nvm, I get what you mean now.

Copy link
Member Author

@JGAntunes JGAntunes May 8, 2025

Choose a reason for hiding this comment

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

Done via f06ade3

@JGAntunes JGAntunes requested a review from emosbaugh May 8, 2025 14:11
@JGAntunes JGAntunes marked this pull request as ready for review May 8, 2025 14:28
emosbaugh
emosbaugh previously approved these changes May 8, 2025
@JGAntunes JGAntunes requested review from emosbaugh and ajp-io May 9, 2025 10:00
@ajp-io
Copy link
Member

ajp-io commented May 9, 2025

mind updating the screenshot in the description with what the error now looks like?

emosbaugh
emosbaugh previously approved these changes May 9, 2025
@JGAntunes
Copy link
Member Author

mind updating the screenshot in the description with what the error now looks like?

Missed it sorry. Yeah sure.

@JGAntunes
Copy link
Member Author

@ajp-io updated the screenshot.

@JGAntunes JGAntunes requested a review from emosbaugh May 15, 2025 08:30
@JGAntunes JGAntunes merged commit cbc1221 into main May 15, 2025
223 of 250 checks passed
@JGAntunes JGAntunes deleted the jgantunes/sc-113724/release-ec-with-support-for-1-31 branch May 15, 2025 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants