Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Allow deprecating k8s versions #3493

Merged
merged 7 commits into from
Aug 17, 2018

Conversation

CecileRobertMichon
Copy link
Contributor

@CecileRobertMichon CecileRobertMichon commented Jul 17, 2018

What this PR does / why we need it: This PR allows removing support for k8s versions (by setting the "supported" value to false in the version map) and keep support for scaling/upgrading those clusters

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #3399

Special notes for your reviewer:

If applicable:

  • documentation
  • unit tests
  • tested backward compatibility (ie. deploy with previous version, upgrade with this branch)

Release note:

@ghost ghost added the in progress label Jul 17, 2018
@CecileRobertMichon CecileRobertMichon changed the title Allow depricating k8s versions Allow deprecating k8s versions Jul 17, 2018
allSupportedVersions = AllKubernetesWindowsSupportedVersions
}
for ver, supported := range allSupportedVersions {
if (isCreate && supported) || !isCreate {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the key change in this PR

@CecileRobertMichon CecileRobertMichon changed the title Allow deprecating k8s versions [WIP] Allow deprecating k8s versions Jul 17, 2018
@@ -235,28 +239,11 @@ func getAllKubernetesWindowsSupportedVersionsMap() map[string]bool {
return ret
}

// GetAllSupportedKubernetesVersionsWindows returns a slice of all supported Kubernetes versions on Windows
func GetAllSupportedKubernetesVersionsWindows() []string {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

combined GetAllSupportedKubernetesVersionsWindows() with GetAllSupportedKubernetesVersions()

allSupportedVersions = AllKubernetesWindowsSupportedVersions
}
for ver, supported := range allSupportedVersions {
if (!isUpdate && supported) || isUpdate {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the key change in this PR

@codecov
Copy link

codecov bot commented Jul 18, 2018

Codecov Report

Merging #3493 into master will decrease coverage by 0.01%.
The diff coverage is 85.5%.

@@            Coverage Diff             @@
##           master    #3493      +/-   ##
==========================================
- Coverage   55.41%   55.39%   -0.02%     
==========================================
  Files         108      108              
  Lines       16098    16102       +4     
==========================================
  Hits         8920     8920              
- Misses       6412     6415       +3     
- Partials      766      767       +1

@CecileRobertMichon
Copy link
Contributor Author

CecileRobertMichon commented Jul 18, 2018

Tests running on CecileRobertMichon/acs-engine@k8s-versions-distinct...CecileRobertMichon:test-deprecate-versions (disables all versions expect [1.8.15 1.9.9 1.10.5 1.11.0])

Deploy a deprecated version (expected to fail): https://jenkins.azure-containers.io/view/acs-engine%20ad-hoc/job/k8s-deployment/206/console
Upgrade a cluster deployed with a now deprecated version: https://jenkins.azure-containers.io/view/acs-engine%20ad-hoc/job/k8s-upgrade/128/console
Scale a cluster deployed with a now deprecated version: https://jenkins.azure-containers.io/view/acs-engine%20ad-hoc/job/k8s-scale/41/console

@CecileRobertMichon CecileRobertMichon changed the title [WIP] Allow deprecating k8s versions Allow deprecating k8s versions Jul 18, 2018
@CecileRobertMichon
Copy link
Contributor Author

CecileRobertMichon commented Jul 18, 2018

TODO:

  1. Only validate version that we are upgrading to in upgrade (not the version we are upgrading from)

  2. Only allow upgrade to versions currently supported (allow list for create and upgrade is identical)

  3. Fix the orchestrators command to reflect the above

  4. Fix logic for upgrading a cluster with Windows --> only versions supported for Windows should be allowed

@CecileRobertMichon
Copy link
Contributor Author

CecileRobertMichon commented Jul 19, 2018

After thinking about this some more, I don't think we should do

  1. Only validate version that we are upgrading to in upgrade (not the version we are upgrading from)

The validate happens at https://github.com/Azure/acs-engine/blob/master/cmd/upgrade.go#L141 and actually makes sure that the apimodel passed in by the user is valid. If we do not validate it, there is no garantee that the apimodel passed in with the acs-engine upgrade command has an OrchestratorProfile or is a valid acs-engine apimodel. However, we can validate the apimodel with isUpdate true such that the version is compared to the list of all existing versions, not just supported create versions. Then, the upgrade version is validated against the subset of valid Create/Upgrade versions.

@@ -365,7 +365,7 @@ var (
func setPropertiesDefaults(cs *api.ContainerService, isUpgrade, isScale bool) (bool, error) {
properties := cs.Properties

setOrchestratorDefaults(cs)
setOrchestratorDefaults(cs, isUpgrade || isScale)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

isUpgrade || isScale <=> isUpdate

ret := []*OrchestratorProfile{}

currentVer, err := semver.Make(csOrch.OrchestratorVersion)
if err != nil {
return nil, err
}
nextNextMinorString := strconv.FormatUint(currentVer.Major, 10) + "." + strconv.FormatUint(currentVer.Minor+2, 10) + ".0"
upgradeableVersions := common.GetVersionsBetween(common.GetAllSupportedKubernetesVersions(), csOrch.OrchestratorVersion, nextNextMinorString, false, true)
nextNextMinorString := strconv.FormatUint(currentVer.Major, 10) + "." + strconv.FormatUint(currentVer.Minor+2, 10) + ".0-alpha.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fix bug where pre-releases were include in previous previous minor version upgrades

CecileRobertMichon added 7 commits August 16, 2018 10:32
wip

merge windows and non-windows k8s versions

add isupdate logic

add missing args

add isCreate to defaults

set orchestratorDefaults args

fmt

change isCreate to isUpdate

merge getDefaultVersion

fix !isUpdate arg

remove windows versions
@jackfrancis
Copy link
Member

/lgtm

@acs-bot acs-bot added the lgtm label Aug 17, 2018
@acs-bot
Copy link

acs-bot commented Aug 17, 2018

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CecileRobertMichon, jackfrancis

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:
  • OWNERS [CecileRobertMichon,jackfrancis]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jackfrancis jackfrancis merged commit 5645440 into Azure:master Aug 17, 2018
@ghost ghost removed the in progress label Aug 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Distinct version support for create/upgrade/scale
3 participants