-
Notifications
You must be signed in to change notification settings - Fork 527
feat: add "get-versions --azure-env" flag to list custom clouds supported versions #3394
Conversation
Will take a look |
pkg/api/common/versions.go
Outdated
@@ -198,37 +198,99 @@ var AllKubernetesSupportedVersions = map[string]bool{ | |||
"1.19.0-beta.0": true, | |||
} | |||
|
|||
// AllKubernetesSupportedVersionsOnAzureStack is a whitelist map of all supported Kubernetes version strings on Azure Stack | |||
// The bool value indicates if creating new clusters with this version is allowed | |||
var AllKubernetesSupportedVersionsOnAzureStack = map[string]bool{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will you be maintaining these version support lists going forward? In practice, this means when the AKS Engine project moves versions forward for public cloud, Azure Stack won't get that support. That seems sane, just want to clarify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass
cmd/get_versions.go
Outdated
@@ -44,6 +45,7 @@ func newGetVersionsCmd() *cobra.Command { | |||
gvc.orchestrator = "Kubernetes" // orchestrator is always Kubernetes | |||
f.StringVar(&gvc.version, "version", "", "Kubernetes version (optional)") | |||
f.BoolVar(&gvc.windows, "windows", false, "Kubernetes cluster with Windows nodes (optional)") | |||
f.StringVar(&gvc.azureEnv, "azureEnv", "", "The target Azure cloud (default is 'AzurePublicCloud')") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep it consistent with the deploy command by calling this flag azure-env
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially it was set to be like that, but that failed with a linter check error because of the "-" so I have to change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean this ... (&gvc.azureEnv, "azure-env", ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
cmd/get_versions.go
Outdated
@@ -44,6 +45,7 @@ func newGetVersionsCmd() *cobra.Command { | |||
gvc.orchestrator = "Kubernetes" // orchestrator is always Kubernetes | |||
f.StringVar(&gvc.version, "version", "", "Kubernetes version (optional)") | |||
f.BoolVar(&gvc.windows, "windows", false, "Kubernetes cluster with Windows nodes (optional)") | |||
f.StringVar(&gvc.azureEnv, "azureEnv", "", "The target Azure cloud (default is 'AzurePublicCloud')") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The third param is the default value, pass AzurePublicCloud
please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
cmd/get_versions.go
Outdated
@@ -44,6 +45,7 @@ func newGetVersionsCmd() *cobra.Command { | |||
gvc.orchestrator = "Kubernetes" // orchestrator is always Kubernetes | |||
f.StringVar(&gvc.version, "version", "", "Kubernetes version (optional)") | |||
f.BoolVar(&gvc.windows, "windows", false, "Kubernetes cluster with Windows nodes (optional)") | |||
f.StringVar(&gvc.azureEnv, "azureEnv", "", "The target Azure cloud (default is 'AzurePublicCloud')") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to add (default is 'AzurePublicCloud')
at the end, the command package takes care of that if you pass a default value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
pkg/api/apiloader.go
Outdated
@@ -145,6 +145,7 @@ func (a *Apiloader) LoadContainerServiceForAgentPoolOnlyCluster( | |||
hasExistingCS := existingContainerService != nil | |||
IsSSHAutoGenerated := false | |||
hasWindows := false | |||
onAzureStack := false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think variable name isAzureStack
would align better with the code base
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
pkg/api/common/versions_test.go
Outdated
@@ -8,46 +8,72 @@ import ( | |||
) | |||
|
|||
func Test_GetAllSupportedKubernetesVersions(t *testing.T) { | |||
responseFromGetter := GetAllSupportedKubernetesVersions(true, false) | |||
responseFromGetter := GetAllSupportedKubernetesVersions(true, false, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing a const (notAzureStack
or similar) instead of bool false
can possibly improve readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
pkg/api/orchestrators.go
Outdated
func isVersionSupported(csOrch *OrchestratorProfile, onAzureStack bool) bool { | ||
supported := false | ||
for _, version := range versionsMap[csOrch.OrchestratorType] { | ||
if onAzureStack { | ||
for _, version := range versionsMapAzureStack[csOrch.OrchestratorType] { | ||
|
||
if version == csOrch.OrchestratorVersion { | ||
supported = true | ||
break | ||
if version == csOrch.OrchestratorVersion { | ||
supported = true | ||
break | ||
} | ||
} | ||
} else { | ||
for _, version := range versionsMap[csOrch.OrchestratorType] { | ||
|
||
if version == csOrch.OrchestratorVersion { | ||
supported = true | ||
break | ||
} | ||
} | ||
} | ||
return supported | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be easier to read
supported := false
versions := versionsMap[csOrch.OrchestratorType]
if onAzureStack {
versions = versionsMapAzureStack[csOrch.OrchestratorType]
}
for _, version := range versions {
if version == csOrch.OrchestratorVersion {
supported = true
break
}
}
return supported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
pkg/api/orchestrators.go
Outdated
var err error | ||
onAzureStack := (azureEnv == "AzureStackCloud") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code base usually does a case insensitive comparison for cloud names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
pkg/api/orchestrators.go
Outdated
@@ -207,7 +225,7 @@ func getKubernetesAvailableUpgradeVersions(orchestratorVersion string, supported | |||
|
|||
} | |||
|
|||
func dcosInfo(csOrch *OrchestratorProfile, hasWindows bool) ([]*OrchestratorVersionProfile, error) { | |||
func dcosInfo(csOrch *OrchestratorProfile, hasWindows bool, onAzureStack bool) ([]*OrchestratorVersionProfile, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onAzureStack
not used in function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because kubernetesInfo, dcosInfo, swarmInfo, dockerceInfo are in the orchestratorsFunc, and they have to follow the structure of orchestratorsFunc (https://github.com/Azure/aks-engine/blob/master/pkg/api/orchestrators.go#L16). Similarly, the hasWindows
variable is also not used in these functions, but have to exist.
pkg/api/orchestrators.go
Outdated
@@ -255,7 +273,7 @@ func dcosUpgrades(csOrch *OrchestratorProfile) []*OrchestratorProfile { | |||
return ret | |||
} | |||
|
|||
func swarmInfo(csOrch *OrchestratorProfile, hasWindows bool) ([]*OrchestratorVersionProfile, error) { | |||
func swarmInfo(csOrch *OrchestratorProfile, hasWindows bool, onAzureStack bool) ([]*OrchestratorVersionProfile, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
pkg/api/orchestrators.go
Outdated
@@ -280,7 +298,7 @@ func swarmInfo(csOrch *OrchestratorProfile, hasWindows bool) ([]*OrchestratorVer | |||
}, nil | |||
} | |||
|
|||
func dockerceInfo(csOrch *OrchestratorProfile, hasWindows bool) ([]*OrchestratorVersionProfile, error) { | |||
func dockerceInfo(csOrch *OrchestratorProfile, hasWindows bool, onAzureStack bool) ([]*OrchestratorVersionProfile, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
pkg/api/common/versions.go
Outdated
"1.15.12": true, | ||
"1.16.8": false, | ||
"1.16.9": true, | ||
"1.16.10": false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v1.16.10
and v1.17.6
should be true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
"1.16.8": false, | ||
"1.16.9": true, | ||
"1.17.4": false, | ||
"1.17.5": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add v1.16.10 and v1.17.6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
pkg/api/common/versions.go
Outdated
"1.15.10": false, | ||
"1.15.11": true, | ||
"1.15.12": true, | ||
"1.16.8": false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 1.16.8
? do not think we ever supported that one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way I determine the supported versions is based on the Windows k8s binary URLs (https://github.com/Azure/aks-engine/blob/master/vhd/packer/configure-windows-vhd.ps1#L86-L94) and Linux k8s binaries (https://github.com/Azure/aks-engine/blob/master/vhd/packer/install-dependencies.sh#L349-L364). That may not be the best way, I will update.
Codecov Report
@@ Coverage Diff @@
## master #3394 +/- ##
==========================================
+ Coverage 72.96% 73.20% +0.23%
==========================================
Files 147 147
Lines 24978 24967 -11
==========================================
+ Hits 18226 18276 +50
+ Misses 5624 5562 -62
- Partials 1128 1129 +1
Continue to review full report at Codecov.
|
--azure-env
flag to get-versions
to list custom clouds supported version
--azure-env
flag to get-versions
to list custom clouds supported version
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
running some pan-version sanity checks, thank you @haofan-ms!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: haofan-ms, jackfrancis, jadarsie 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 |
Reason for Change:
The
aks-engine get-versions
command only shows Azure supported versions.The
--azure-env
flag will allow users to pass a target custom cloud like Azure Stack and get back supported versions on that target cloud.Usage:
aks-engine get-versions --azure-env AzureStackCloud
Requirements:
Notes: