Issues with defaults for windowsProfile in cluster definition
Is this a request for help?:
No, I have a workaround. It's a question on how something should work in the aks-engine code.
Is this an ISSUE or FEATURE REQUEST? (choose one): Issue
What version of aks-engine?: 0.35.1
Kubernetes version: N/A
What happened: As recently as last week, I was able to deploy a cluster with these parameters in my cluster definition JSON for the "windowsProfile" section:(some values removed)
"windowsProfile": {
"windowsPublisher": "MicrosoftWindowsServer",
"windowsOffer": "WindowsServer",
"windowsSku": "2019-Datacenter-Core-with-Containers-smalldisk"
}
Note that I am NOT specifying an imageVersion here.
I was trying to deploy a cluster today, and this failed during the ARM deployment with the following error:
The platform image 'MicrosoftWindowsServer:WindowsServer:2019-Datacenter-Core-with-Containers-smalldisk:1809.0.20190314' is not available. Verify that all fields in the storage profile are correct
If I look in aks-engine/pkg/api/defaults.go, I see the following:
func (p *Properties) setWindowsProfileDefaults(isUpgrade, isScale bool) {
windowsProfile := p.WindowsProfile
if !isUpgrade && !isScale {
if windowsProfile.WindowsPublisher == "" {
windowsProfile.WindowsPublisher = DefaultWindowsPublisher
}
if windowsProfile.WindowsOffer == "" {
windowsProfile.WindowsOffer = DefaultWindowsOffer
}
if windowsProfile.WindowsSku == "" {
windowsProfile.WindowsSku = DefaultWindowsSku
}
if windowsProfile.ImageVersion == "" {
windowsProfile.ImageVersion = DefaultImageVersion
}
}
}
So if I don't specify an image version, it will use "DefaultImageVersion", which is defined in aks-engine/pkg/api/const.go:
const (
// DefaultWindowsPublisher sets the default WindowsPublisher value in WindowsProfile
DefaultWindowsPublisher = "MicrosoftWindowsServer"
// DefaultWindowsOffer sets the default WindowsOffer value in WindowsProfile
DefaultWindowsOffer = "WindowsServerSemiAnnual"
// DefaultWindowsSku sets the default WindowsSku value in WindowsProfile
DefaultWindowsSku = "Datacenter-Core-1809-with-Containers-smalldisk"
// DefaultImageVersion sets the default ImageVersion value in WindowsProfile
DefaultImageVersion = "1809.0.20190314"
)
The "DefaultImageVersion" listed here, "1809.0.20190314", is what my error referenced. So since I never specified an imageVersion, it tried to use the imageVersion of "1809.0.20190314", for the windowsSku of "2019-Datacenter-Core-with-Containers-smalldisk", which I did supply in my JSON.
If I list all available images for that SKU:
az vm image list --location eastus --publisher MicrosoftWindowsServer --offer WindowsServer --sku 2019-Datacenter-Core-with-Containers-smalldisk --all
I see a bunch with version 2019.x.x, but nothing with 1809. Since I've never specified the imageVersion before and this always worked, my guess is there USED to be images for that SKU with the 1809 version number, but those have since been deleted on the Azure side? As a result these JSON values no longer work. I was able to just explicitly set the imageVersion in my windowsProfile and get it to deploy properly:
"windowsProfile": {
"windowsPublisher": "MicrosoftWindowsServer",
"windowsOffer": "WindowsServer",
"windowsSku": "2019-Datacenter-Core-with-Containers-smalldisk",
"imageVersion": "2019.0.20190410"
}
I'm not exactly sure what the right/expected behavior is here. If I look at the documentation on the cluster definition it states:
imageVersion no Specific image version to deploy from marketplace. Default: latest
So what exactly does "latest" mean? Is it supposed to intelligently determine the latest imageVersion for your specified SKU, or is it just going to grab that default value...in which case it should probably say the default is "1809.0.20190314", not "latest".
What you expected to happen:
Either I'm not understanding how the "latest" version is being determined when it's not specified, or the documentation is confusing/wrong when it says the default is "latest".
As to what should happen...either there could be logic to determine what the latest imageVersion for a given SKU is, or, we could make it so that if you enter ANY value (windowsPublisher, windowsOffer, windowsSku, or imageVersion), that you MUST enter all of them. I'd be willing to take a crack at writing the code for either one, but would like some feedback as to what makes the most sense first.
How to reproduce it (as minimally and precisely as possible): Specify your windows profile in your cluster definition as the following, making sure to exclude the imageVersion attribute:
"windowsProfile": { "windowsPublisher": "MicrosoftWindowsServer", "windowsOffer": "WindowsServer", "windowsSku": "2019-Datacenter-Core-with-Containers-smalldisk" }
Try to deploy the generated ARM templates from aks-engine and you should get the following error:
The platform image 'MicrosoftWindowsServer:WindowsServer:2019-Datacenter-Core-with-Containers-smalldisk:1809.0.20190314' is not available. Verify that all fields in the storage profile are correct
Anything else we need to know:
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.
so are you proposing moving to 2019 (LTSC) by default instead of 1809 (SAC), or doing more up-front parameter validation?
If parameter validation I think this would be something we could warn on, but not necessarily block. We're planning to make AKS-tuned Windows images soon and don't want to block those.
As the expected behavior of leaving out the image version (as per the documentation) is to provide an available/appropriate version of either LTSC or SAC depending on your offer and sku settings, fix options could be:
1: Change the code to provide the logic necessary to provide an appropriate default version for both LTSC or SAC based on the provided offer parameter. 2: Change the documentation help users avoid conflicts - let users know they need to specify all 4 parameters if they want to use something other than the default. 2: Change the code to give a better error during validation that prompts users to include all 4 parameters if they choose to set the first three, this way they don't end up in the current situation - with 3 parameters conflicting with the default setting of the 4th.
Why not use the "latest" as image Version to pick the latest version of the image. I thought it is supported by Azure.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.