GCE Windows: Do not install docker when containerd CRI is selected.

This commit is contained in:
Jeremy Edwards 2021-05-05 19:16:33 +00:00
parent aab19d4299
commit daa5be1d01
2 changed files with 20 additions and 15 deletions

View File

@ -88,13 +88,13 @@ function set-linux-node-image() {
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}" == "win2019" ]]; then if [[ "${WINDOWS_NODE_OS_DISTRIBUTION}" == "win2019" ]]; then
WINDOWS_NODE_IMAGE="windows-server-2019-dc-core-v20210112" WINDOWS_NODE_IMAGE="windows-server-2019-dc-core-v20210413"
elif [[ "${WINDOWS_NODE_OS_DISTRIBUTION}" == "win1909" ]]; then elif [[ "${WINDOWS_NODE_OS_DISTRIBUTION}" == "win1909" ]]; then
WINDOWS_NODE_IMAGE="windows-server-1909-dc-core-v20210112" WINDOWS_NODE_IMAGE="windows-server-1909-dc-core-v20210413"
elif [[ "${WINDOWS_NODE_OS_DISTRIBUTION}" == "win2004" ]]; then elif [[ "${WINDOWS_NODE_OS_DISTRIBUTION}" == "win2004" ]]; then
WINDOWS_NODE_IMAGE="windows-server-2004-dc-core-v20210112" WINDOWS_NODE_IMAGE="windows-server-2004-dc-core-v20210413"
elif [[ "${WINDOWS_NODE_OS_DISTRIBUTION,,}" == "win20h2" ]]; then elif [[ "${WINDOWS_NODE_OS_DISTRIBUTION,,}" == "win20h2" ]]; then
WINDOWS_NODE_IMAGE="windows-server-20h2-dc-core-v20210112" WINDOWS_NODE_IMAGE="windows-server-20h2-dc-core-v20210413"
else else
echo "Unknown WINDOWS_NODE_OS_DISTRIBUTION ${WINDOWS_NODE_OS_DISTRIBUTION}" >&2 echo "Unknown WINDOWS_NODE_OS_DISTRIBUTION ${WINDOWS_NODE_OS_DISTRIBUTION}" >&2
exit 1 exit 1

View File

@ -126,19 +126,25 @@ try {
exit 0 exit 0
} }
if (-not (Test-DockerIsInstalled)) { $kube_env = Fetch-KubeEnv
Install-Docker Set-EnvironmentVars
}
# For some reason the docker service may not be started automatically on the # Install Docker if the select CRI is not containerd and docker is not already
# first reboot, although it seems to work fine on subsequent reboots. # installed.
Restart-Service docker if (${env:CONTAINER_RUNTIME} -ne "containerd") {
Start-Sleep 5 if (-not (Test-DockerIsInstalled)) {
if (-not (Test-DockerIsRunning)) { Install-Docker
throw "docker service failed to start or stay running" }
# For some reason the docker service may not be started automatically on the
# first reboot, although it seems to work fine on subsequent reboots.
Restart-Service docker
Start-Sleep 5
if (-not (Test-DockerIsRunning)) {
throw "docker service failed to start or stay running"
}
} }
Set-PrerequisiteOptions Set-PrerequisiteOptions
$kube_env = Fetch-KubeEnv
if (Test-IsTestCluster $kube_env) { if (Test-IsTestCluster $kube_env) {
Log-Output 'Test cluster detected, installing OpenSSH.' Log-Output 'Test cluster detected, installing OpenSSH.'
@ -147,7 +153,6 @@ try {
StartProcess-WriteSshKeys StartProcess-WriteSshKeys
} }
Set-EnvironmentVars
Create-Directories Create-Directories
Download-HelperScripts Download-HelperScripts