27
27
[Net.ServicePointManager]::SecurityProtocol = `
28
28
[Net.SecurityProtocolType]::Tls12
29
29
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 `
31
31
-OutFile C:\k8s-node-setup.psm1
32
32
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 `
34
34
-OutFile C:\configure.ps1
35
35
Import-Module -Force C:\k8s-node-setup.psm1 # -Force to override existing
36
36
# Execute functions manually or run configure.ps1.
@@ -111,8 +111,8 @@ function WaitFor_GceMetadataServerRouteToBeRemoved {
111
111
112
112
# Adds a route to the GCE metadata server to every network interface.
113
113
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
116
116
# Ethernet interface. After adding the HNS network a "vEthernet (Ethernet)"
117
117
# interface is added, and it seems to subsume the routes of the "Ethernet"
118
118
# interface (trying to add routes on the Ethernet interface at this point just
@@ -259,17 +259,14 @@ function Download-HelperScripts {
259
259
}
260
260
261
261
# 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
263
263
# version of Windows. Returns $null if $WinVersion is unknown.
264
264
function Get_ContainerVersionLabel {
265
265
param (
266
266
[parameter (Mandatory = $true )] [string ]$WinVersion
267
267
)
268
268
# -match does regular expression matching.
269
- if ($WinVersion -match ' 1803' ) {
270
- return ' 1803'
271
- }
272
- elseif ($WinVersion -match ' 1809' ) {
269
+ if ($WinVersion -match ' 1809' ) {
273
270
return ' 1809'
274
271
}
275
272
elseif ($WinVersion -match ' 2019' ) {
@@ -281,16 +278,24 @@ function Get_ContainerVersionLabel {
281
278
282
279
# Builds the pause image with name $INFRA_CONTAINER.
283
280
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
286
291
$pause_dir = " ${env: K8S_DIR} \pauseimage"
287
292
$dockerfile = " $pause_dir \Dockerfile"
288
293
mkdir - Force $pause_dir
289
294
if (ShouldWrite- File $dockerfile ) {
290
295
New-Item - Force - ItemType file $dockerfile | Out-Null
291
296
Set-Content `
292
297
$dockerfile `
293
- (" FROM microsoft/nanoserver:${version_label} `n`n " +
298
+ (" FROM mcr. microsoft.com/windows /nanoserver:${version_label} `n`n " +
294
299
" CMD cmd /c ping -t localhost > nul" )
295
300
}
296
301
@@ -300,6 +305,10 @@ function Create-PauseImage {
300
305
return
301
306
}
302
307
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
+ }
303
312
}
304
313
305
314
# Downloads the Kubernetes binaries from kube-env's NODE_BINARY_TAR_URL and
0 commit comments