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

GetSupportedVersion returns the right win default #3079

Merged

Conversation

CecileRobertMichon
Copy link
Contributor

@CecileRobertMichon CecileRobertMichon commented May 24, 2018

What this PR does / why we need it: Hotfix for ACS RP, wrong default version was returned for windows (1.8.13, which isn't supported).

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

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 May 24, 2018
@acs-bot acs-bot added the size/M label May 24, 2018
func GetSupportedKubernetesVersion(version string) string {
if k8sVersion := version; AllKubernetesSupportedVersions[k8sVersion] {
return k8sVersion
func GetSupportedKubernetesVersion(version string, hasWindows bool) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

we shouldn't silently override. If a value is passed in we should throw an error if invalid.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would tend to agree with you but this PR is intended to fix the bug, not change the behavior of default k8s version definition... The silent override was already in place for getting the k8s version for API version v20170701 so I don't think we want to change the behavior in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

does validation happen before this so we don't have to worry about it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do validate beforehand. So if I pass in something random as orchestratorVersion such as 0.5 I get FATA[0000] error loading API model in generateCmd: error parsing the api model: OrchestratorProfile has unknown orchestrator version: 0.5
The only case where this function overrides the version is if it is empty or if the cluster is a Windows cluster and the passed in version is valid but not supported for Windows, in which case the user gets default. I looked into fixing validation to also take into account "is this a Windows cluster? If so, is the passed in version valid for Windows?" but it's not straight forward since it requires having the agent pool profiles. I can make that an additional change in this PR if we see value in it.
TLDR: Is it okay to override the version if the value passed in for the user is not supported with windows but is a valid version or should we fail instead?

@codecov
Copy link

codecov bot commented May 24, 2018

Codecov Report

Merging #3079 into master will increase coverage by 0.21%.
The diff coverage is 84.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3079      +/-   ##
==========================================
+ Coverage    51.5%   51.71%   +0.21%     
==========================================
  Files          99       99              
  Lines       15036    15031       -5     
==========================================
+ Hits         7744     7773      +29     
+ Misses       6582     6544      -38     
- Partials      710      714       +4
Impacted Files Coverage Δ
pkg/acsengine/defaults.go 83.59% <100%> (ø) ⬆️
pkg/api/convertertoapi.go 55.86% <100%> (ø) ⬆️
pkg/api/v20170701/validate.go 29.26% <33.33%> (ø) ⬆️
pkg/api/convertertoagentpoolonlyapi.go 30.27% <66.66%> (ø) ⬆️
pkg/api/vlabs/validate.go 48.5% <81.81%> (+2.28%) ⬆️
pkg/api/common/versions.go 89.41% <93.33%> (+5.9%) ⬆️
pkg/api/v20170701/types.go 34.72% <0%> (+4.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6a02217...1b0af6d. Read the comment docs.

@acs-bot acs-bot added size/L and removed size/M labels May 24, 2018
@@ -649,9 +649,6 @@ func (a *Properties) Validate(isUpdate bool) error {
}

if a.OrchestratorProfile.OrchestratorType == Kubernetes {
if i == 0 {
continue
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 was causing a bug where we would not check anything for the first agentpool

@@ -663,25 +660,13 @@ func (a *Properties) Validate(isUpdate bool) error {
case Swarm:
case SwarmMode:
case Kubernetes:
var version string
if a.HasWindows() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need to check if the cluster has a Windows pool since this is run on Windows agents

a.OrchestratorProfile.OrchestratorVersion,
false)
}
if version == "" {
Copy link
Member

Choose a reason for hiding this comment

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

Let's put this empty string check back, and remove the common.AllKubernetesWindowsSupportedVersions[version] check

@jackfrancis
Copy link
Member

/approve
/lgtm

@acs-bot acs-bot added the lgtm label May 29, 2018
@acs-bot
Copy link

acs-bot commented May 29, 2018

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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:

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

@CecileRobertMichon CecileRobertMichon merged commit 2304363 into Azure:master May 29, 2018
@ghost ghost removed the in progress label May 29, 2018
@CecileRobertMichon CecileRobertMichon deleted the k8s-win-version-hotfix branch June 6, 2018 19:13
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.

4 participants