Skip to content
Permalink
Browse files

Address comments.

  • Loading branch information
Random-Liu committed Nov 22, 2019
1 parent 58d39f6 commit 10181a0b477e92ad836fc9d1440ddaada14a7a49
Showing with 27 additions and 17 deletions.
  1. +1 −4 cluster/gce/windows/common.psm1
  2. +2 −12 cluster/gce/windows/configure.ps1
  3. +24 −1 cluster/gce/windows/k8s-node-setup.psm1
@@ -132,15 +132,12 @@ function Validate-SHA {
function MustDownload-File {
param (
[parameter(Mandatory=$false)] [string]$Hash,
[parameter(Mandatory=$false)] [string]$Algorithm,
[parameter(Mandatory=$false)] [string]$Algorithm = 'SHA1',
[parameter(Mandatory=$true)] [string]$OutFile,
[parameter(Mandatory=$true)] [System.Collections.Generic.List[String]]$URLs,
[parameter(Mandatory=$false)] [System.Collections.IDictionary]$Headers = @{}
)

if (!$Algorithm) {
$Algorithm = "SHA1"
}
While($true) {
ForEach($url in $URLs) {
# If the URL is for GCS and the node has dev storage scope, add the
@@ -132,24 +132,14 @@ try {
Download-HelperScripts

DownloadAndInstall-Crictl
if (${env:CONTAINER_RUNTIME} -eq "containerd") {
Install-Containerd
Start-Containerd
} else {
Create-DockerRegistryKey
Configure-Dockerd
}
Setup-ContainerRuntime
DownloadAndInstall-KubernetesBinaries
Create-NodePki
Create-KubeletKubeconfig
Create-KubeproxyKubeconfig
Set-PodCidr
Configure-HostNetworkingService
if (${env:CONTAINER_RUNTIME} -eq "containerd") {
Configure-Containerd-CniNetworking
} else {
Configure-CniNetworking
}
Configure-CniNetworking
Configure-HostDnsConf
Configure-GcePdTools
Configure-Kubelet
@@ -347,6 +347,7 @@ function DownloadAndInstall-KubernetesBinaries {

# Change the directory to the parent directory of ${env:K8S_DIR} and untar.
# This (over-)writes ${dest_dir}/kubernetes/node/bin/*.exe files.
# TODO(pjh): clean this up, files not guaranteed to end up in NODE_DIR
$dest_dir = (Get-Item ${env:K8S_DIR}).Parent.Fullname
tar xzf ${tmp_dir}\${filename} -C ${dest_dir}

@@ -839,6 +840,16 @@ Unblock-File $modulePath
Import-Module -Name $modulePath'.replace('K8S_DIR', ${env:K8S_DIR})
}

# Setup cni network. This function supports both Docker
# and containerd.
function Configure-CniNetworking {
if (${env:CONTAINER_RUNTIME} -eq "containerd") {
Configure-Containerd-CniNetworking
} else {
Configure-Dockerd-CniNetworking
}
}

# Downloads the Windows CNI binaries and writes a CNI config file under
# $env:CNI_CONFIG_DIR.
#
@@ -853,7 +864,7 @@ Import-Module -Name $modulePath'.replace('K8S_DIR', ${env:K8S_DIR})
# DNS_DOMAIN
# CLUSTER_IP_RANGE
# SERVICE_CLUSTER_IP_RANGE
function Configure-CniNetworking {
function Configure-Dockerd-CniNetworking {
$CNI_RELEASE_VERSION = 'v0.8.2-gke.0'
if ((ShouldWrite-File ${env:CNI_DIR}\win-bridge.exe) -or
(ShouldWrite-File ${env:CNI_DIR}\host-local.exe)) {
@@ -1177,6 +1188,18 @@ function Pull-InfraContainer {
Log-Output "Infra/pause container:`n$inspect"
}

# Setup the container runtime on the node. It supports both
# Docker and containerd.
function Setup-ContainerRuntime {
if (${env:CONTAINER_RUNTIME} -eq "containerd") {
Install-Containerd
Start-Containerd
} else {
Create-DockerRegistryKey
Configure-Dockerd
}
}

# Add a registry key for docker in EventLog so that log messages are mapped
# correctly. This is a workaround since the key is missing in the base image.
# https://github.com/MicrosoftDocs/Virtualization-Documentation/pull/503

0 comments on commit 10181a0

Please sign in to comment.
You can’t perform that action at this time.