Skip to content

Commit f7a6b0a

Browse files
authored
Merge pull request kubernetes#74103 from pjh/gce-windows-cluster-1809
Default to Windows Server version 1809 for Windows nodes.
2 parents 105c9c3 + 6d78f2b commit f7a6b0a

File tree

11 files changed

+32
-25
lines changed

11 files changed

+32
-25
lines changed

cluster/gce/config-default.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ MIG_WAIT_UNTIL_STABLE_TIMEOUT=${MIG_WAIT_UNTIL_STABLE_TIMEOUT:-1800}
6565

6666
MASTER_OS_DISTRIBUTION=${KUBE_MASTER_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
6767
NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
68-
WINDOWS_NODE_OS_DISTRIBUTION=${WINDOWS_NODE_OS_DISTRIBUTION:-win1803}
68+
WINDOWS_NODE_OS_DISTRIBUTION=${WINDOWS_NODE_OS_DISTRIBUTION:-win1809}
6969

7070
if [[ "${MASTER_OS_DISTRIBUTION}" == "cos" ]]; then
7171
MASTER_OS_DISTRIBUTION="gci"
@@ -478,4 +478,4 @@ fi
478478

479479
# Taint Windows nodes by default to prevent Linux workloads from being
480480
# scheduled onto them.
481-
WINDOWS_NODE_TAINTS="${WINDOWS_NODE_TAINTS:-node.kubernetes.io/os=windows:NoSchedule}"
481+
WINDOWS_NODE_TAINTS="${WINDOWS_NODE_TAINTS:-node.kubernetes.io/os=win1809:NoSchedule}"

cluster/gce/config-test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ MIG_WAIT_UNTIL_STABLE_TIMEOUT=${MIG_WAIT_UNTIL_STABLE_TIMEOUT:-1800}
6868

6969
MASTER_OS_DISTRIBUTION=${KUBE_MASTER_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
7070
NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
71-
WINDOWS_NODE_OS_DISTRIBUTION=${WINDOWS_NODE_OS_DISTRIBUTION:-win1803}
71+
WINDOWS_NODE_OS_DISTRIBUTION=${WINDOWS_NODE_OS_DISTRIBUTION:-win1809}
7272

7373
if [[ "${MASTER_OS_DISTRIBUTION}" == "cos" ]]; then
7474
MASTER_OS_DISTRIBUTION="gci"
@@ -498,4 +498,4 @@ fi
498498

499499
# Taint Windows nodes by default to prevent Linux workloads from being
500500
# scheduled onto them.
501-
WINDOWS_NODE_TAINTS="${WINDOWS_NODE_TAINTS:-node.kubernetes.io/os=windows:NoSchedule}"
501+
WINDOWS_NODE_TAINTS="${WINDOWS_NODE_TAINTS:-node.kubernetes.io/os=win1809:NoSchedule}"

cluster/gce/util.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ else
3232
exit 1
3333
fi
3434

35-
source "${KUBE_ROOT}/cluster/gce/${WINDOWS_NODE_OS_DISTRIBUTION}/node-helper.sh"
35+
source "${KUBE_ROOT}/cluster/gce/windows/node-helper.sh"
3636

3737
if [[ "${MASTER_OS_DISTRIBUTION}" == "trusty" || "${MASTER_OS_DISTRIBUTION}" == "gci" || "${MASTER_OS_DISTRIBUTION}" == "ubuntu" ]]; then
3838
source "${KUBE_ROOT}/cluster/gce/${MASTER_OS_DISTRIBUTION}/master-helper.sh"
@@ -87,9 +87,7 @@ function set-linux-node-image() {
8787
# WINDOWS_NODE_IMAGE_PROJECT
8888
function set-windows-node-image() {
8989
WINDOWS_NODE_IMAGE_PROJECT="windows-cloud"
90-
if [[ "${WINDOWS_NODE_OS_DISTRIBUTION}" == "win1803" ]]; then
91-
WINDOWS_NODE_IMAGE_FAMILY="windows-1803-core-for-containers"
92-
elif [[ "${WINDOWS_NODE_OS_DISTRIBUTION}" == "win2019" ]]; then
90+
if [[ "${WINDOWS_NODE_OS_DISTRIBUTION}" == "win2019" ]]; then
9391
WINDOWS_NODE_IMAGE_FAMILY="windows-2019-core-for-containers"
9492
elif [[ "${WINDOWS_NODE_OS_DISTRIBUTION}" == "win1809" ]]; then
9593
WINDOWS_NODE_IMAGE_FAMILY="windows-1809-core-for-containers"
File renamed without changes.

cluster/gce/win1803/README-GCE-Windows-kube-up.md renamed to cluster/gce/windows/README-GCE-Windows-kube-up.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Invoke this script to run a smoke test that verifies that the cluster has been
9999
brought up correctly:
100100

101101
```
102-
cluster/gce/win1803/smoke-test.sh
102+
cluster/gce/windows/smoke-test.sh
103103
```
104104

105105
## Running tests against the cluster
File renamed without changes.
File renamed without changes.

cluster/gce/win1803/k8s-node-setup.psm1 renamed to cluster/gce/windows/k8s-node-setup.psm1

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
[Net.ServicePointManager]::SecurityProtocol = `
2828
[Net.SecurityProtocolType]::Tls12
2929
Invoke-WebRequest `
30-
https://github.com/kubernetes/kubernetes/raw/windows-up/cluster/gce/win1803/k8s-node-setup.psm1 `
30+
https://github.com/kubernetes/kubernetes/raw/master/cluster/gce/windows/k8s-node-setup.psm1 `
3131
-OutFile C:\k8s-node-setup.psm1
3232
Invoke-WebRequest `
33-
https://github.com/kubernetes/kubernetes/raw/windows-up/cluster/gce/win1803/configure.ps1 `
33+
https://github.com/kubernetes/kubernetes/raw/master/cluster/gce/windows/configure.ps1 `
3434
-OutFile C:\configure.ps1
3535
Import-Module -Force C:\k8s-node-setup.psm1 # -Force to override existing
3636
# Execute functions manually or run configure.ps1.
@@ -111,8 +111,8 @@ function WaitFor_GceMetadataServerRouteToBeRemoved {
111111

112112
# Adds a route to the GCE metadata server to every network interface.
113113
function Add_GceMetadataServerRoute {
114-
# Before setting up HNS the 1803 VM has a "vEthernet (nat)" interface and a
115-
# "Ethernet" interface, and the route to the metadata server exists on the
114+
# Before setting up HNS the Windows VM has a "vEthernet (nat)" interface and
115+
# a "Ethernet" interface, and the route to the metadata server exists on the
116116
# Ethernet interface. After adding the HNS network a "vEthernet (Ethernet)"
117117
# interface is added, and it seems to subsume the routes of the "Ethernet"
118118
# interface (trying to add routes on the Ethernet interface at this point just
@@ -259,17 +259,14 @@ function Download-HelperScripts {
259259
}
260260

261261
# Takes the Windows version string from the cluster bash scripts (e.g.
262-
# 'win1803') and returns the correct label to use for containers on this
262+
# 'win1809') and returns the correct label to use for containers on this
263263
# version of Windows. Returns $null if $WinVersion is unknown.
264264
function Get_ContainerVersionLabel {
265265
param (
266266
[parameter(Mandatory=$true)] [string]$WinVersion
267267
)
268268
# -match does regular expression matching.
269-
if ($WinVersion -match '1803') {
270-
return '1803'
271-
}
272-
elseif ($WinVersion -match '1809') {
269+
if ($WinVersion -match '1809') {
273270
return '1809'
274271
}
275272
elseif ($WinVersion -match '2019') {
@@ -281,16 +278,24 @@ function Get_ContainerVersionLabel {
281278

282279
# Builds the pause image with name $INFRA_CONTAINER.
283280
function Create-PauseImage {
284-
$version_label = Get_ContainerVersionLabel `
285-
$(Get-InstanceMetadataValue 'win-version')
281+
$win_version = $(Get-InstanceMetadataValue 'win-version')
282+
if ($win_version -match '2019') {
283+
# TODO(pjh): update this function to properly support 2019 vs. 1809 vs.
284+
# future Windows versions. For example, Windows Server 2019 does not
285+
# support the nanoserver container
286+
# (https://blogs.technet.microsoft.com/virtualization/2018/11/13/windows-server-2019-now-available/).
287+
Log_NotImplemented "Need to update Create-PauseImage for WS2019"
288+
}
289+
290+
$version_label = Get_ContainerVersionLabel $win_version
286291
$pause_dir = "${env:K8S_DIR}\pauseimage"
287292
$dockerfile = "$pause_dir\Dockerfile"
288293
mkdir -Force $pause_dir
289294
if (ShouldWrite-File $dockerfile) {
290295
New-Item -Force -ItemType file $dockerfile | Out-Null
291296
Set-Content `
292297
$dockerfile `
293-
("FROM microsoft/nanoserver:${version_label}`n`n" +
298+
("FROM mcr.microsoft.com/windows/nanoserver:${version_label}`n`n" +
294299
"CMD cmd /c ping -t localhost > nul")
295300
}
296301

@@ -300,6 +305,10 @@ function Create-PauseImage {
300305
return
301306
}
302307
docker build -t ${INFRA_CONTAINER} $pause_dir
308+
if ($LastExitCode -ne 0) {
309+
Log-Output -Fatal `
310+
"docker build -t ${INFRA_CONTAINER} $pause_dir failed"
311+
}
303312
}
304313

305314
# Downloads the Kubernetes binaries from kube-env's NODE_BINARY_TAR_URL and

cluster/gce/win1803/node-helper.sh renamed to cluster/gce/windows/node-helper.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ function get-windows-node-instance-metadata-from-file {
2424
# To get startup script output run "gcloud compute instances
2525
# get-serial-port-output <instance>" from the location where you're running
2626
# kube-up.
27-
metadata+="windows-startup-script-ps1=${KUBE_ROOT}/cluster/gce/${WINDOWS_NODE_OS_DISTRIBUTION}/configure.ps1,"
28-
metadata+="common-psm1=${KUBE_ROOT}/cluster/gce/${WINDOWS_NODE_OS_DISTRIBUTION}/common.psm1,"
29-
metadata+="k8s-node-setup-psm1=${KUBE_ROOT}/cluster/gce/${WINDOWS_NODE_OS_DISTRIBUTION}/k8s-node-setup.psm1,"
30-
metadata+="user-profile-psm1=${KUBE_ROOT}/cluster/gce/${WINDOWS_NODE_OS_DISTRIBUTION}/user-profile.psm1,"
27+
metadata+="windows-startup-script-ps1=${KUBE_ROOT}/cluster/gce/windows/configure.ps1,"
28+
metadata+="common-psm1=${KUBE_ROOT}/cluster/gce/windows/common.psm1,"
29+
metadata+="k8s-node-setup-psm1=${KUBE_ROOT}/cluster/gce/windows/k8s-node-setup.psm1,"
30+
metadata+="user-profile-psm1=${KUBE_ROOT}/cluster/gce/windows/user-profile.psm1,"
3131
metadata+="${NODE_EXTRA_METADATA}"
3232
echo "${metadata}"
3333
}
File renamed without changes.

0 commit comments

Comments
 (0)