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

Commit

Permalink
Adding contianerd test casses to TestWindowsProfileDefaults
Browse files Browse the repository at this point in the history
  • Loading branch information
marosset committed Dec 18, 2020
1 parent b43cdb1 commit 31a2a26
Show file tree
Hide file tree
Showing 2 changed files with 503 additions and 29 deletions.
25 changes: 15 additions & 10 deletions pkg/api/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -795,13 +795,12 @@ func (cs *ContainerService) setWindowsProfileDefaults(isUpgrade, isScale bool) {

// Default to aks-engine WIndows Server 2019 docker image
defaultImageConfig := AKSWindowsServer2019OSImageConfig

if cs.Properties.OrchestratorProfile.KubernetesConfig.NeedsContainerd() {
// Use to using aks-engine Windows Server 2019 conatinerD VHD
defaultImageConfig = AKSWindowsServer2019ContainerDOSImageConfig
} else if windowsProfile.WindowsPublisher == WindowsServer2019OSImageConfig.ImagePublisher && windowsProfile.WindowsOffer == WindowsServer2019OSImageConfig.ImageOffer {
if windowsProfile.WindowsPublisher == WindowsServer2019OSImageConfig.ImagePublisher && windowsProfile.WindowsOffer == WindowsServer2019OSImageConfig.ImageOffer {
// Use 'vanilla' Windows Server 2019 images
defaultImageConfig = WindowsServer2019OSImageConfig
} else if cs.Properties.OrchestratorProfile.KubernetesConfig.NeedsContainerd() {
// Use to using aks-engine Windows Server 2019 conatinerD VHD
defaultImageConfig = AKSWindowsServer2019ContainerDOSImageConfig
}

// This allows caller to use the latest ImageVersion and WindowsSku for adding a new Windows pool to an existing cluster.
Expand Down Expand Up @@ -829,10 +828,16 @@ func (cs *ContainerService) setWindowsProfileDefaults(isUpgrade, isScale bool) {
}

if windowsProfile.ImageVersion == "" {
// default versions are specific to a publisher/offer/sku
if windowsProfile.WindowsPublisher == AKSWindowsServer2019OSImageConfig.ImagePublisher && windowsProfile.WindowsOffer == AKSWindowsServer2019OSImageConfig.ImageOffer && windowsProfile.WindowsSku == AKSWindowsServer2019OSImageConfig.ImageSku {
windowsProfile.ImageVersion = AKSWindowsServer2019OSImageConfig.ImageVersion
} else {
// default versions are specific to a publisher/offer/sku for aks-engine VHDs
aksEngineImageConfigs := []AzureOSImageConfig{AKSWindowsServer2019ContainerDOSImageConfig, AKSWindowsServer2019OSImageConfig}
for _, imageConfig := range aksEngineImageConfigs {
if windowsProfile.WindowsPublisher == imageConfig.ImagePublisher && windowsProfile.WindowsOffer == imageConfig.ImageOffer && windowsProfile.WindowsSku == imageConfig.ImageSku {
windowsProfile.ImageVersion = imageConfig.ImageVersion
break
}
}
// set imageVersion to 'latest' if still unset
if windowsProfile.ImageVersion == "" {
windowsProfile.ImageVersion = "latest"
}
}
Expand All @@ -852,7 +857,7 @@ func (cs *ContainerService) setWindowsProfileDefaults(isUpgrade, isScale bool) {
// Reference: https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-upgrade-scale-set#create-time-properties
windowsImageConfigs := []AzureOSImageConfig{AKSWindowsServer2019OSImageConfig, WindowsServer2019OSImageConfig}
if cs.Properties.OrchestratorProfile.KubernetesConfig.NeedsContainerd() {
windowsImageConfigs = []AzureOSImageConfig{AKSWindowsServer2019ContainerDOSImageConfig}
windowsImageConfigs = []AzureOSImageConfig{AKSWindowsServer2019ContainerDOSImageConfig, WindowsServer2019OSImageConfig}
}
for _, imageConfig := range windowsImageConfigs {
if windowsProfile.WindowsPublisher == imageConfig.ImagePublisher && windowsProfile.WindowsOffer == imageConfig.ImageOffer {
Expand Down
Loading

0 comments on commit 31a2a26

Please sign in to comment.