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

cli: add upgrade-check command #1109

Merged
merged 2 commits into from
Feb 8, 2023
Merged

cli: add upgrade-check command #1109

merged 2 commits into from
Feb 8, 2023

Conversation

derpsteb
Copy link
Member

@derpsteb derpsteb commented Jan 30, 2023

Proposed change(s)

  • Add constellation upgrade check as a command and remove constellation upgrade plan. Upgrade check shows the smallest upgrade a user could do to the current cluster with their current CLI. Smallest since we have to make some decision on which upgrade to show in order to support the --write-config flag. We could add a --all flag to show all possible upgrades.
    • Includes a --write-config flag can be used to persist the suggested update into the config.
    • Includes a --ref and --stream flag to select the ref and stream which should be checked for image upgrades.
  • Extend config validation with supported versions validation. This will check that the versions specified in the config adhere to our defined version drift of 1. I.e. the CLI will always have to be up to one minor version newer than the configured version.
  • Add --force flag that disables config validation.
  • Add config value MicroserviceVersion. This specifies the version of the constellation-services chart and (implicitly) the version of the constellation-operators chart. I decided to make the operator version implicit as we would otherwise have to have another config value for it. We could think about unifying the operators and services charts. I don't think there is a technical reason for keeping them separate.

Checklist

  • Update docs
  • Add labels (e.g., for changelog category)
  • Link to Milestone

@derpsteb derpsteb added the feature This introduces new functionality label Jan 30, 2023
@derpsteb derpsteb added this to the v2.6.0 milestone Jan 30, 2023
@edgelesssys edgelesssys deleted a comment from netlify bot Jan 30, 2023
Copy link
Member

@daniel-weisse daniel-weisse left a comment

Choose a reason for hiding this comment

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

Not a real review, just some thoughts after going over the changes

cli/internal/cmd/upgradecheck.go Outdated Show resolved Hide resolved
internal/constants/constants.go Outdated Show resolved Hide resolved
internal/versions/versions.go Outdated Show resolved Hide resolved
@derpsteb derpsteb force-pushed the feat/upgrade-check branch 6 times, most recently from 4f59e9d to 5dc4d43 Compare January 31, 2023 15:55
@derpsteb derpsteb marked this pull request as ready for review January 31, 2023 15:59
internal/config/config.go Outdated Show resolved Hide resolved
internal/config/config.go Outdated Show resolved Hide resolved
cli/internal/cmd/configfetchmeasurements.go Show resolved Hide resolved
internal/compatibility/compatibility.go Outdated Show resolved Hide resolved
internal/compatibility/compatibility.go Outdated Show resolved Hide resolved
internal/config/config.go Show resolved Hide resolved
cli/internal/cmd/upgradecheck.go Outdated Show resolved Hide resolved
cli/internal/cmd/upgradecheck.go Outdated Show resolved Hide resolved
cli/internal/cmd/upgradecheck.go Outdated Show resolved Hide resolved
cli/internal/helm/client.go Outdated Show resolved Hide resolved
cli/internal/helm/client.go Outdated Show resolved Hide resolved
cli/internal/helm/loader.go Outdated Show resolved Hide resolved
@3u13r 3u13r requested review from 3u13r and removed request for 3u13r February 6, 2023 08:29
@katexochen katexochen removed their request for review February 6, 2023 12:16
cli/internal/cmd/upgradecheck.go Outdated Show resolved Hide resolved
cli/internal/cmd/upgradecheck.go Outdated Show resolved Hide resolved
cli/internal/cmd/upgradecheck.go Outdated Show resolved Hide resolved
cli/internal/cmd/upgradecheck.go Outdated Show resolved Hide resolved
cli/internal/cmd/upgradecheck.go Outdated Show resolved Hide resolved
internal/compatibility/compatibility.go Outdated Show resolved Hide resolved
internal/compatibility/compatibility_test.go Outdated Show resolved Hide resolved
internal/config/config.go Show resolved Hide resolved
internal/config/validation.go Outdated Show resolved Hide resolved
Comment on lines 102 to 109
// currently supported versions.
//nolint:revive
V1_24 ValidK8sVersion = "1.24"
V1_24 ValidK8sVersion = "v1.24.9"
//nolint:revive
V1_25 ValidK8sVersion = "1.25"
V1_25 ValidK8sVersion = "v1.25.6"
//nolint:revive
V1_26 ValidK8sVersion = "1.26"
V1_26 ValidK8sVersion = "v1.26.1"

Copy link
Member

Choose a reason for hiding this comment

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

Checked our code again, if I understand it correctly the V1_X ValidK8sVersion variables are only used to keep track of the minor Kubernetes version supported by Constellation (We don't support choosing patch versions).

I think we should keep them as only Major.Minor, not sure about the v prefix.

Copy link
Member Author

Choose a reason for hiding this comment

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

The reason for switching to exposing the patch version is that we might want to offer a patch-version upgrade to the user. I think its cleaner to show users that the version will change from e.g. 1.25.6 to 1.25.7 instead of doing this implicitly. Users will still not be able to chose arbitrary patch versions, but it will be obvious which one is running/upgraded.

cli/internal/cmd/upgradecheck.go Outdated Show resolved Hide resolved
cli/internal/cmd/upgradecheck.go Outdated Show resolved Hide resolved
Version validation checks that the configured versions
are not more than one minor version below the CLI's version.
The validation can be disabled using --force.
This is necessary for now during development as the CLI
does not have a prerelease version, as our images do.
Copy link
Contributor

@malt3 malt3 left a comment

Choose a reason for hiding this comment

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

Nice work!

Upgrade check is used to find updates for the current cluster.
Optionally the found upgrades can be persisted to the config
for consumption by the upgrade-execute cmd.
The old `upgrade execute` in this commit does not work with
the new `upgrade plan`.
The current versions are read from the cluster.
Supported versions are read from the cli and the versionsapi.
Adds a new config field MicroserviceVersion that will be used
by `upgrade execute` to update the service versions.
The field is optional until 2.7
A deprecation warning for the upgrade key is printed during
config validation.
Kubernetes versions now specify the patch version to make it
explicit for users if an upgrade changes the k8s version.
@derpsteb derpsteb merged commit c275464 into main Feb 8, 2023
@derpsteb derpsteb deleted the feat/upgrade-check branch February 8, 2023 11:30
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This introduces new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants