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

Commit

Permalink
Support Windows Server 2019 and make it default (#4299)
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickLang authored and jackfrancis committed Nov 29, 2018
1 parent f897033 commit 51c9c95
Show file tree
Hide file tree
Showing 12 changed files with 221 additions and 31 deletions.
14 changes: 8 additions & 6 deletions docs/clusterdefinition.md
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ https://{keyvaultname}.vault.azure.net:443/secrets/{secretName}/{version}
| adminPassword | yes | Password for the Windows adminstrator account created on each Windows node |
| windowsPublisher | no | Publisher used to find Windows VM to deploy from marketplace. Default: `MicrosoftWindowsServer` |
| windowsOffer | no | Offer used to find Windows VM to deploy from marketplace. Default: `WindowsServerSemiAnnual` |
| windowsSku | no | SKU usedto find Windows VM to deploy from marketplace. Default: `Datacenter-Core-1803-with-Containers-smalldisk` |
| windowsSku | no | SKU usedto find Windows VM to deploy from marketplace. Default: `Datacenter-Core-1809-with-Containers-smalldisk` |
| imageVersion | no | Specific image version to deploy from marketplace. Default: `latest` |
| windowsImageSourceURL | no | Path to an existing Azure storage blob with a sysprepped VHD. This is used to test pre-release or customized VHD files that you have uploaded to Azure. If provided, the above 4 parameters are ignored. |

Expand All @@ -626,8 +626,10 @@ $ az vm image list --publisher MicrosoftWindowsServer --all -o table
Offer Publisher Sku Urn Version
----------------------- ----------------------------- ---------------------------------------------- ------------------------------------------------------------------------------------------------------------- -----------------
...
WindowsServerSemiAnnual MicrosoftWindowsServer Datacenter-Core-1709-with-Containers-smalldisk MicrosoftWindowsServer:WindowsServerSemiAnnual:Datacenter-Core-1709-with-Containers-smalldisk:1709.0.20180412 1709.0.20180412
WindowsServerSemiAnnual MicrosoftWindowsServer Datacenter-Core-1803-with-Containers-smalldisk MicrosoftWindowsServer:WindowsServerSemiAnnual:Datacenter-Core-1803-with-Containers-smalldisk:1803.0.20180504 1803.0.20180504
WindowsServerSemiAnnual MicrosoftWindowsServer Datacenter-Core-1709-with-Containers-smalldisk MicrosoftWindowsServer:WindowsServerSemiAnnual:Datacenter-Core-1709-with-Containers-smalldisk:1709.0.20181017 1709.0.20181017
WindowsServerSemiAnnual MicrosoftWindowsServer Datacenter-Core-1803-with-Containers-smalldisk MicrosoftWindowsServer:WindowsServerSemiAnnual:Datacenter-Core-1803-with-Containers-smalldisk:1803.0.20181017 1803.0.20181017
WindowsServerSemiAnnual MicrosoftWindowsServer Datacenter-Core-1809-with-Containers-smalldisk MicrosoftWindowsServer:WindowsServerSemiAnnual:Datacenter-Core-1809-with-Containers-smalldisk:1809.0.20181107 1809.0.20181107
WindowsServer MicrosoftWindowsServer 2019-Datacenter-Core-with-Containers-smalldisk MicrosoftWindowsServer:WindowsServer:2019-Datacenter-Core-with-Containers-smalldisk:2019.0.20181107 2019.0.20181107
```

If you wanted to use the last one in the list above, then set:
Expand All @@ -637,9 +639,9 @@ If you wanted to use the last one in the list above, then set:
"adminUsername": "...",
"adminPassword": "...",
"windowsPublisher": "MicrosoftWindowsServer",
"windowsOffer": "WindowsServerSemiAnnual",
"windowsSku": "Datacenter-Core-1803-with-Containers-smalldisk",
"imageVersion": "1803.0.20180504"
"windowsOffer": "WindowsServer",
"windowsSku": "2019-Datacenter-Core-with-Containers-smalldisk",
"imageVersion": "2019.0.20181107"
},
```

Expand Down
10 changes: 6 additions & 4 deletions docs/kubernetes/windows-details.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,21 @@ $ az vm image list --publisher MicrosoftWindowsServer --all -o table
Offer Publisher Sku Urn Version
----------------------- ----------------------------- ---------------------------------------------- ------------------------------------------------------------------------------------------------------------- -----------------
...
WindowsServerSemiAnnual MicrosoftWindowsServer Datacenter-Core-1709-with-Containers-smalldisk MicrosoftWindowsServer:WindowsServerSemiAnnual:Datacenter-Core-1709-with-Containers-smalldisk:1709.0.20180412 1709.0.20180412
WindowsServerSemiAnnual MicrosoftWindowsServer Datacenter-Core-1803-with-Containers-smalldisk MicrosoftWindowsServer:WindowsServerSemiAnnual:Datacenter-Core-1803-with-Containers-smalldisk:1803.0.20180504 1803.0.20180504
WindowsServerSemiAnnual MicrosoftWindowsServer Datacenter-Core-1709-with-Containers-smalldisk MicrosoftWindowsServer:WindowsServerSemiAnnual:Datacenter-Core-1709-with-Containers-smalldisk:1709.0.20181017 1709.0.20181017
WindowsServerSemiAnnual MicrosoftWindowsServer Datacenter-Core-1803-with-Containers-smalldisk MicrosoftWindowsServer:WindowsServerSemiAnnual:Datacenter-Core-1803-with-Containers-smalldisk:1803.0.20181017 1803.0.20181017
WindowsServerSemiAnnual MicrosoftWindowsServer Datacenter-Core-1809-with-Containers-smalldisk MicrosoftWindowsServer:WindowsServerSemiAnnual:Datacenter-Core-1809-with-Containers-smalldisk:1809.0.20181107 1809.0.20181107
WindowsServer MicrosoftWindowsServer 2019-Datacenter-Core-with-Containers-smalldisk MicrosoftWindowsServer:WindowsServer:2019-Datacenter-Core-with-Containers-smalldisk:2019.0.20181107 2019.0.20181107
```

You can use the Offer, Publisher and Sku to pick a specific version by adding `windowsOffer`, `windowsPublisher`, `windowsSku` and (optionally) `imageVersion` to the `windowsProfile` section. In this example, the latest Windows Server version 1803 image would be deployed.
You can use the Offer, Publisher and Sku to pick a specific version by adding `windowsOffer`, `windowsPublisher`, `windowsSku` and (optionally) `imageVersion` to the `windowsProfile` section. In this example, the latest Windows Server version 1809 image would be deployed.

```json
"windowsProfile": {
"adminUsername": "azureuser",
"adminPassword": "...",
"windowsPublisher": "MicrosoftWindowsServer",
"windowsOffer": "WindowsServerSemiAnnual",
"windowsSku": "Datacenter-Core-1803-with-Containers-smalldisk"
"windowsSku": "Datacenter-Core-1809-with-Containers-smalldisk"
},
```

Expand Down
5 changes: 4 additions & 1 deletion examples/windows/kubernetes-windows-version.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
"windowsProfile": {
"adminUsername": "azureuser",
"adminPassword": "replacepassword1234$",
"imageVersion": "2016.127.20170510"
"windowsPublisher": "MicrosoftWindowsServer",
"windowsOffer": "WindowsServerSemiAnnual",
"windowsSku": "Datacenter-Core-1803-with-Containers-smalldisk",
"imageVersion": "1803.0.20181017"
},
"linuxProfile": {
"adminUsername": "azureuser",
Expand Down
3 changes: 1 addition & 2 deletions parts/k8s/windowskubeletfunc.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ New-InfraContainer
} elseif ($computerInfo.WindowsVersion -eq "1803") {
"microsoft/nanoserver:1803"
} elseif ($computerInfo.WindowsVersion -eq "1809") {
# TODO: unsure if 2019 will report 1809 or not
"microsoft/nanoserver:1809"
"mcr.microsoft.com/windows/nanoserver:1809"
} else {
"mcr.microsoft.com/nanoserver-insider"
}
Expand Down
2 changes: 1 addition & 1 deletion parts/windowsparams.t
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"type": "string"
},
"agentWindowsSku": {
"defaultValue": "Datacenter-Core-1803-with-Containers-smalldisk",
"defaultValue": "Datacenter-Core-1809-with-Containers-smalldisk",
"metadata": {
"description": "The SKU of windows image for the agent virtual machines."
},
Expand Down
4 changes: 1 addition & 3 deletions pkg/acsengine/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,8 @@ func getParameters(cs *api.ContainerService, generatorCode string, acsengineVers
if properties.WindowsProfile.WindowsOffer != "" {
addValue(parametersMap, "agentWindowsOffer", properties.WindowsProfile.WindowsOffer)
}
if properties.WindowsProfile.WindowsSku != "" {
addValue(parametersMap, "agentWindowsSku", properties.WindowsProfile.WindowsSku)
}

addValue(parametersMap, "agentWindowsSku", properties.WindowsProfile.GetWindowsSku())
addValue(parametersMap, "windowsDockerVersion", properties.WindowsProfile.GetWindowsDockerVersion())

for i, s := range properties.WindowsProfile.Secrets {
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ const (
DockerCEDockerComposeVersion = "1.14.0"
// KubernetesWindowsDockerVersion is the default version for docker on Windows nodes in kubernetes
KubernetesWindowsDockerVersion = "18.09.0"
// KubernetesDefaultWindowsSku is the default SKU for Windows VMs in kubernetes
KubernetesDefaultWindowsSku = "Datacenter-Core-1809-with-Containers-smalldisk"
)

// validation values
Expand Down
8 changes: 8 additions & 0 deletions pkg/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,14 @@ func (w *WindowsProfile) GetWindowsDockerVersion() string {
return KubernetesWindowsDockerVersion
}

// GetWindowsSku gets the marketplace sku specified (such as Datacenter-Core-1809-with-Containers-smalldisk) or returns default value
func (w *WindowsProfile) GetWindowsSku() string {
if w.WindowsSku != "" {
return w.WindowsSku
}
return KubernetesDefaultWindowsSku
}

// HasSecrets returns true if the customer specified secrets to install
func (l *LinuxProfile) HasSecrets() bool {
return len(l.Secrets) > 0
Expand Down
11 changes: 11 additions & 0 deletions pkg/api/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,11 @@ func TestWindowsProfile(t *testing.T) {
t.Fatalf("Expected GetWindowsDockerVersion() to equal default KubernetesWindowsDockerVersion, got %s", dv)
}

windowsSku := w.GetWindowsSku()
if windowsSku != KubernetesDefaultWindowsSku {
t.Fatalf("Expected GetWindowsSku() to equal default KubernetesDefaultWindowsSku, got %s", windowsSku)
}

w = WindowsProfile{
Secrets: []KeyVaultSecrets{
{
Expand All @@ -821,12 +826,18 @@ func TestWindowsProfile(t *testing.T) {

w = WindowsProfile{
WindowsDockerVersion: "18.03.1-ee-3",
WindowsSku: "Datacenter-Core-1809-with-Containers-smalldisk",
}

dv = w.GetWindowsDockerVersion()
if dv != "18.03.1-ee-3" {
t.Fatalf("Expected GetWindowsDockerVersion() to equal 18.03.1-ee-3, got %s", dv)
}

windowsSku = w.GetWindowsSku()
if windowsSku != "Datacenter-Core-1809-with-Containers-smalldisk" {
t.Fatalf("Expected GetWindowsSku() to equal Datacenter-Core-1809-with-Containers-smalldisk, got %s", windowsSku)
}
}

func TestLinuxProfile(t *testing.T) {
Expand Down
25 changes: 25 additions & 0 deletions test/e2e/engine/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,31 @@ func (e *Engine) HasWindowsAgents() bool {
return false
}

// WindowsTestImages holds the Windows container image names used in this test pass
type WindowsTestImages struct {
IIS string
ServerCore string
}

// GetWindowsTestImages will return the right list of container images for the Windows version used
func (e *Engine) GetWindowsTestImages() (*WindowsTestImages, error) {
if !e.HasWindowsAgents() {
return nil, errors.New("Can't guess a Windows version without Windows nodes in the cluster")
}

if strings.Contains(e.ExpandedDefinition.Properties.WindowsProfile.GetWindowsSku(), "1809") || strings.Contains(e.ExpandedDefinition.Properties.WindowsProfile.GetWindowsSku(), "2019") {
return &WindowsTestImages{IIS: "mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019",
ServerCore: "mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019"}, nil
} else if strings.Contains(e.ExpandedDefinition.Properties.WindowsProfile.GetWindowsSku(), "1803") {
return &WindowsTestImages{IIS: "microsoft/iis:windowsservercore-1803",
ServerCore: "microsoft/iis:windowsservercore-1803"}, nil
} else if strings.Contains(e.ExpandedDefinition.Properties.WindowsProfile.GetWindowsSku(), "1709") {
return nil, errors.New("Windows Server version 1709 hasn't been tested in a long time and is deprecated")
}

return nil, errors.New("Unknown Windows version. GetWindowsSku() = " + e.ExpandedDefinition.Properties.WindowsProfile.GetWindowsSku())
}

// HasAddon will return true if an addon is enabled
func (e *Engine) HasAddon(name string) (bool, api.KubernetesAddon) {
for _, addon := range e.ExpandedDefinition.Properties.OrchestratorProfile.KubernetesConfig.Addons {
Expand Down
Loading

0 comments on commit 51c9c95

Please sign in to comment.