Default to Windows Server version 1809 for Windows nodes.

Removes all references to 1803, including moving "win1803" directory to
just "windows". A single Windows directory suffices for now, if
necessary in the future we can shard it into directories for each
Windows version.

We've been running tests with Windows 1809 nodes for a couple days in
our fork without major problems:
https://testgrid.k8s.io/google-windows#windows-prototype&width=20.
Testing on Azure is already using 1809:
https://testgrid.k8s.io/sig-windows#Conformance%20acs-engine%20on%20Azure&width=20.
This commit is contained in:
Peter Hornyack 2019-02-12 16:38:49 -08:00
parent ec1d83b82d
commit 6d78f2b666
11 changed files with 32 additions and 25 deletions

View File

@ -65,7 +65,7 @@ MIG_WAIT_UNTIL_STABLE_TIMEOUT=${MIG_WAIT_UNTIL_STABLE_TIMEOUT:-1800}
MASTER_OS_DISTRIBUTION=${KUBE_MASTER_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}} MASTER_OS_DISTRIBUTION=${KUBE_MASTER_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}} NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
WINDOWS_NODE_OS_DISTRIBUTION=${WINDOWS_NODE_OS_DISTRIBUTION:-win1803} WINDOWS_NODE_OS_DISTRIBUTION=${WINDOWS_NODE_OS_DISTRIBUTION:-win1809}
if [[ "${MASTER_OS_DISTRIBUTION}" == "cos" ]]; then if [[ "${MASTER_OS_DISTRIBUTION}" == "cos" ]]; then
MASTER_OS_DISTRIBUTION="gci" MASTER_OS_DISTRIBUTION="gci"
@ -478,4 +478,4 @@ fi
# Taint Windows nodes by default to prevent Linux workloads from being # Taint Windows nodes by default to prevent Linux workloads from being
# scheduled onto them. # scheduled onto them.
WINDOWS_NODE_TAINTS="${WINDOWS_NODE_TAINTS:-node.kubernetes.io/os=windows:NoSchedule}" WINDOWS_NODE_TAINTS="${WINDOWS_NODE_TAINTS:-node.kubernetes.io/os=win1809:NoSchedule}"

View File

@ -68,7 +68,7 @@ MIG_WAIT_UNTIL_STABLE_TIMEOUT=${MIG_WAIT_UNTIL_STABLE_TIMEOUT:-1800}
MASTER_OS_DISTRIBUTION=${KUBE_MASTER_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}} MASTER_OS_DISTRIBUTION=${KUBE_MASTER_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}} NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
WINDOWS_NODE_OS_DISTRIBUTION=${WINDOWS_NODE_OS_DISTRIBUTION:-win1803} WINDOWS_NODE_OS_DISTRIBUTION=${WINDOWS_NODE_OS_DISTRIBUTION:-win1809}
if [[ "${MASTER_OS_DISTRIBUTION}" == "cos" ]]; then if [[ "${MASTER_OS_DISTRIBUTION}" == "cos" ]]; then
MASTER_OS_DISTRIBUTION="gci" MASTER_OS_DISTRIBUTION="gci"
@ -498,4 +498,4 @@ fi
# Taint Windows nodes by default to prevent Linux workloads from being # Taint Windows nodes by default to prevent Linux workloads from being
# scheduled onto them. # scheduled onto them.
WINDOWS_NODE_TAINTS="${WINDOWS_NODE_TAINTS:-node.kubernetes.io/os=windows:NoSchedule}" WINDOWS_NODE_TAINTS="${WINDOWS_NODE_TAINTS:-node.kubernetes.io/os=win1809:NoSchedule}"

View File

@ -32,7 +32,7 @@ else
exit 1 exit 1
fi fi
source "${KUBE_ROOT}/cluster/gce/${WINDOWS_NODE_OS_DISTRIBUTION}/node-helper.sh" source "${KUBE_ROOT}/cluster/gce/windows/node-helper.sh"
if [[ "${MASTER_OS_DISTRIBUTION}" == "trusty" || "${MASTER_OS_DISTRIBUTION}" == "gci" || "${MASTER_OS_DISTRIBUTION}" == "ubuntu" ]]; then if [[ "${MASTER_OS_DISTRIBUTION}" == "trusty" || "${MASTER_OS_DISTRIBUTION}" == "gci" || "${MASTER_OS_DISTRIBUTION}" == "ubuntu" ]]; then
source "${KUBE_ROOT}/cluster/gce/${MASTER_OS_DISTRIBUTION}/master-helper.sh" source "${KUBE_ROOT}/cluster/gce/${MASTER_OS_DISTRIBUTION}/master-helper.sh"
@ -87,9 +87,7 @@ function set-linux-node-image() {
# WINDOWS_NODE_IMAGE_PROJECT # WINDOWS_NODE_IMAGE_PROJECT
function set-windows-node-image() { function set-windows-node-image() {
WINDOWS_NODE_IMAGE_PROJECT="windows-cloud" WINDOWS_NODE_IMAGE_PROJECT="windows-cloud"
if [[ "${WINDOWS_NODE_OS_DISTRIBUTION}" == "win1803" ]]; then if [[ "${WINDOWS_NODE_OS_DISTRIBUTION}" == "win2019" ]]; then
WINDOWS_NODE_IMAGE_FAMILY="windows-1803-core-for-containers"
elif [[ "${WINDOWS_NODE_OS_DISTRIBUTION}" == "win2019" ]]; then
WINDOWS_NODE_IMAGE_FAMILY="windows-2019-core-for-containers" WINDOWS_NODE_IMAGE_FAMILY="windows-2019-core-for-containers"
elif [[ "${WINDOWS_NODE_OS_DISTRIBUTION}" == "win1809" ]]; then elif [[ "${WINDOWS_NODE_OS_DISTRIBUTION}" == "win1809" ]]; then
WINDOWS_NODE_IMAGE_FAMILY="windows-1809-core-for-containers" WINDOWS_NODE_IMAGE_FAMILY="windows-1809-core-for-containers"

View File

@ -99,7 +99,7 @@ Invoke this script to run a smoke test that verifies that the cluster has been
brought up correctly: brought up correctly:
``` ```
cluster/gce/win1803/smoke-test.sh cluster/gce/windows/smoke-test.sh
``` ```
## Running tests against the cluster ## Running tests against the cluster

View File

@ -27,10 +27,10 @@
[Net.ServicePointManager]::SecurityProtocol = ` [Net.ServicePointManager]::SecurityProtocol = `
[Net.SecurityProtocolType]::Tls12 [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest ` Invoke-WebRequest `
https://github.com/kubernetes/kubernetes/raw/windows-up/cluster/gce/win1803/k8s-node-setup.psm1 ` https://github.com/kubernetes/kubernetes/raw/master/cluster/gce/windows/k8s-node-setup.psm1 `
-OutFile C:\k8s-node-setup.psm1 -OutFile C:\k8s-node-setup.psm1
Invoke-WebRequest ` Invoke-WebRequest `
https://github.com/kubernetes/kubernetes/raw/windows-up/cluster/gce/win1803/configure.ps1 ` https://github.com/kubernetes/kubernetes/raw/master/cluster/gce/windows/configure.ps1 `
-OutFile C:\configure.ps1 -OutFile C:\configure.ps1
Import-Module -Force C:\k8s-node-setup.psm1 # -Force to override existing Import-Module -Force C:\k8s-node-setup.psm1 # -Force to override existing
# Execute functions manually or run configure.ps1. # Execute functions manually or run configure.ps1.
@ -111,8 +111,8 @@ function WaitFor_GceMetadataServerRouteToBeRemoved {
# Adds a route to the GCE metadata server to every network interface. # Adds a route to the GCE metadata server to every network interface.
function Add_GceMetadataServerRoute { function Add_GceMetadataServerRoute {
# Before setting up HNS the 1803 VM has a "vEthernet (nat)" interface and a # Before setting up HNS the Windows VM has a "vEthernet (nat)" interface and
# "Ethernet" interface, and the route to the metadata server exists on the # a "Ethernet" interface, and the route to the metadata server exists on the
# Ethernet interface. After adding the HNS network a "vEthernet (Ethernet)" # Ethernet interface. After adding the HNS network a "vEthernet (Ethernet)"
# interface is added, and it seems to subsume the routes of the "Ethernet" # interface is added, and it seems to subsume the routes of the "Ethernet"
# interface (trying to add routes on the Ethernet interface at this point just # interface (trying to add routes on the Ethernet interface at this point just
@ -259,17 +259,14 @@ function Download-HelperScripts {
} }
# Takes the Windows version string from the cluster bash scripts (e.g. # Takes the Windows version string from the cluster bash scripts (e.g.
# 'win1803') and returns the correct label to use for containers on this # 'win1809') and returns the correct label to use for containers on this
# version of Windows. Returns $null if $WinVersion is unknown. # version of Windows. Returns $null if $WinVersion is unknown.
function Get_ContainerVersionLabel { function Get_ContainerVersionLabel {
param ( param (
[parameter(Mandatory=$true)] [string]$WinVersion [parameter(Mandatory=$true)] [string]$WinVersion
) )
# -match does regular expression matching. # -match does regular expression matching.
if ($WinVersion -match '1803') { if ($WinVersion -match '1809') {
return '1803'
}
elseif ($WinVersion -match '1809') {
return '1809' return '1809'
} }
elseif ($WinVersion -match '2019') { elseif ($WinVersion -match '2019') {
@ -281,8 +278,16 @@ function Get_ContainerVersionLabel {
# Builds the pause image with name $INFRA_CONTAINER. # Builds the pause image with name $INFRA_CONTAINER.
function Create-PauseImage { function Create-PauseImage {
$version_label = Get_ContainerVersionLabel ` $win_version = $(Get-InstanceMetadataValue 'win-version')
$(Get-InstanceMetadataValue 'win-version') if ($win_version -match '2019') {
# TODO(pjh): update this function to properly support 2019 vs. 1809 vs.
# future Windows versions. For example, Windows Server 2019 does not
# support the nanoserver container
# (https://blogs.technet.microsoft.com/virtualization/2018/11/13/windows-server-2019-now-available/).
Log_NotImplemented "Need to update Create-PauseImage for WS2019"
}
$version_label = Get_ContainerVersionLabel $win_version
$pause_dir = "${env:K8S_DIR}\pauseimage" $pause_dir = "${env:K8S_DIR}\pauseimage"
$dockerfile = "$pause_dir\Dockerfile" $dockerfile = "$pause_dir\Dockerfile"
mkdir -Force $pause_dir mkdir -Force $pause_dir
@ -290,7 +295,7 @@ function Create-PauseImage {
New-Item -Force -ItemType file $dockerfile | Out-Null New-Item -Force -ItemType file $dockerfile | Out-Null
Set-Content ` Set-Content `
$dockerfile ` $dockerfile `
("FROM microsoft/nanoserver:${version_label}`n`n" + ("FROM mcr.microsoft.com/windows/nanoserver:${version_label}`n`n" +
"CMD cmd /c ping -t localhost > nul") "CMD cmd /c ping -t localhost > nul")
} }
@ -300,6 +305,10 @@ function Create-PauseImage {
return return
} }
docker build -t ${INFRA_CONTAINER} $pause_dir docker build -t ${INFRA_CONTAINER} $pause_dir
if ($LastExitCode -ne 0) {
Log-Output -Fatal `
"docker build -t ${INFRA_CONTAINER} $pause_dir failed"
}
} }
# Downloads the Kubernetes binaries from kube-env's NODE_BINARY_TAR_URL and # Downloads the Kubernetes binaries from kube-env's NODE_BINARY_TAR_URL and

View File

@ -24,10 +24,10 @@ function get-windows-node-instance-metadata-from-file {
# To get startup script output run "gcloud compute instances # To get startup script output run "gcloud compute instances
# get-serial-port-output <instance>" from the location where you're running # get-serial-port-output <instance>" from the location where you're running
# kube-up. # kube-up.
metadata+="windows-startup-script-ps1=${KUBE_ROOT}/cluster/gce/${WINDOWS_NODE_OS_DISTRIBUTION}/configure.ps1," metadata+="windows-startup-script-ps1=${KUBE_ROOT}/cluster/gce/windows/configure.ps1,"
metadata+="common-psm1=${KUBE_ROOT}/cluster/gce/${WINDOWS_NODE_OS_DISTRIBUTION}/common.psm1," metadata+="common-psm1=${KUBE_ROOT}/cluster/gce/windows/common.psm1,"
metadata+="k8s-node-setup-psm1=${KUBE_ROOT}/cluster/gce/${WINDOWS_NODE_OS_DISTRIBUTION}/k8s-node-setup.psm1," metadata+="k8s-node-setup-psm1=${KUBE_ROOT}/cluster/gce/windows/k8s-node-setup.psm1,"
metadata+="user-profile-psm1=${KUBE_ROOT}/cluster/gce/${WINDOWS_NODE_OS_DISTRIBUTION}/user-profile.psm1," metadata+="user-profile-psm1=${KUBE_ROOT}/cluster/gce/windows/user-profile.psm1,"
metadata+="${NODE_EXTRA_METADATA}" metadata+="${NODE_EXTRA_METADATA}"
echo "${metadata}" echo "${metadata}"
} }