Merge pull request #100980 from ibabou/update-containerd-path

Update the containerd runtime binary path - gce
This commit is contained in:
Kubernetes Prow Robot 2021-04-11 06:21:59 -07:00 committed by GitHub
commit dd95f3ab5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1541,21 +1541,16 @@ function Install_Containerd {
return return
} }
# TODO(random-liu): Change this to official release path after testing.
$CONTAINERD_GCS_BUCKET = "cri-containerd-staging/windows"
$tmp_dir = 'C:\containerd_tmp' $tmp_dir = 'C:\containerd_tmp'
New-Item $tmp_dir -ItemType 'directory' -Force | Out-Null New-Item $tmp_dir -ItemType 'directory' -Force | Out-Null
$version_url = "https://storage.googleapis.com/$CONTAINERD_GCS_BUCKET/latest" # TODO(ibrahimab) Change this to a gcs bucket with CI maintained and accessible by community.
MustDownload-File -URLs $version_url -OutFile $tmp_dir\version $version = '1.4.4'
$version = $(Get-Content $tmp_dir\version) $tar_url = ("https://github.com/containerd/containerd/releases/download/v${version}/" +
"cri-containerd-cni-${version}-windows-amd64.tar.gz")
$tar_url = ("https://storage.googleapis.com/$CONTAINERD_GCS_BUCKET/" + $sha_url = $tar_url + ".sha256sum"
"cri-containerd-cni-$version.windows-amd64.tar.gz") MustDownload-File -URLs $sha_url -OutFile $tmp_dir\sha256sum
$sha_url = $tar_url + ".sha256" $sha = $(Get-Content $tmp_dir\sha256sum).Split(" ")[0].ToUpper()
MustDownload-File -URLs $sha_url -OutFile $tmp_dir\sha256
$sha = $(Get-Content $tmp_dir\sha256)
MustDownload-File ` MustDownload-File `
-URLs $tar_url ` -URLs $tar_url `
@ -1564,9 +1559,12 @@ function Install_Containerd {
-Algorithm SHA256 -Algorithm SHA256
tar xzvf $tmp_dir\containerd.tar.gz -C $tmp_dir tar xzvf $tmp_dir\containerd.tar.gz -C $tmp_dir
Move-Item -Force $tmp_dir\cni\*.exe ${env:CNI_DIR}\ Move-Item -Force $tmp_dir\cni\*.exe "${env:CNI_DIR}\"
Move-Item -Force $tmp_dir\*.exe ${env:NODE_DIR}\ Move-Item -Force $tmp_dir\*.exe "${env:NODE_DIR}\"
Remove-Item -Force -Recurse $tmp_dir Remove-Item -Force -Recurse $tmp_dir
# Exclusion for Defender.
Add-MpPreference -ExclusionProcess "${env:NODE_DIR}\containerd.exe"
} }
# Lookup the path of containerd config if exists, else returns a default. # Lookup the path of containerd config if exists, else returns a default.
@ -1574,7 +1572,7 @@ function Get_Containerd_ConfigPath {
$service = Get-WMIObject -Class Win32_Service -Filter "Name='containerd'" $service = Get-WMIObject -Class Win32_Service -Filter "Name='containerd'"
if (!($service -eq $null) -and if (!($service -eq $null) -and
$service.PathName -match ".*\s--config\s*(\S+).*" -and $service.PathName -match ".*\s--config\s*(\S+).*" -and
$matches.Length -eq 2) { $matches.Count -eq 2) {
return $matches[1] return $matches[1]
} else { } else {
return 'C:\Program Files\containerd\config.toml' return 'C:\Program Files\containerd\config.toml'
@ -1601,8 +1599,8 @@ function Configure_Containerd {
bin_dir = 'CNI_BIN_DIR' bin_dir = 'CNI_BIN_DIR'
conf_dir = 'CNI_CONF_DIR' conf_dir = 'CNI_CONF_DIR'
"@.replace('INFRA_CONTAINER_IMAGE', ${env:INFRA_CONTAINER}).` "@.replace('INFRA_CONTAINER_IMAGE', ${env:INFRA_CONTAINER}).`
replace('CNI_BIN_DIR', ${env:CNI_DIR}).` replace('CNI_BIN_DIR', "${env:CNI_DIR}").`
replace('CNI_CONF_DIR', ${env:CNI_CONFIG_DIR}) replace('CNI_CONF_DIR', "${env:CNI_CONFIG_DIR}")
} }
# Register if needed and start containerd service. # Register if needed and start containerd service.