Skip to content

Commit c48c3f4

Browse files
authored
Merge pull request kubernetes#77954 from pjh/cni-release-v0.8.0
Windows GCE nodes: use CNI plugins v0.8.0 release.
2 parents 2741095 + 5d669f2 commit c48c3f4

File tree

2 files changed

+28
-9
lines changed

2 files changed

+28
-9
lines changed

cluster/gce/windows/common.psm1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,10 @@ function Validate-SHA1 {
123123
}
124124

125125
# Attempts to download the file from URLs, trying each URL until it succeeds.
126-
# It will loop through the URLs list forever until it has a success.
127-
# If successful, it will write the file to OutFile. You can optionally provide a SHA1 Hash
128-
# argument, in which case it will attempt to validate the downloaded file against the hash.
126+
# It will loop through the URLs list forever until it has a success. If
127+
# successful, it will write the file to OutFile. You can optionally provide a
128+
# SHA1 Hash argument, in which case it will attempt to validate the downloaded
129+
# file against the hash.
129130
function MustDownload-File {
130131
param (
131132
[parameter(Mandatory=$false)] [string]$Hash,

cluster/gce/windows/k8s-node-setup.psm1

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -811,14 +811,32 @@ Import-Module -Name $modulePath'.replace('K8S_DIR', ${env:K8S_DIR})
811811
# CLUSTER_IP_RANGE
812812
# SERVICE_CLUSTER_IP_RANGE
813813
function Configure-CniNetworking {
814+
$CNI_RELEASE_VERSION = 'v0.8.0'
814815
if ((ShouldWrite-File ${env:CNI_DIR}\win-bridge.exe) -or
815816
(ShouldWrite-File ${env:CNI_DIR}\host-local.exe)) {
816-
MustDownload-File -OutFile ${env:CNI_DIR}\windows-cni-plugins.zip `
817-
-URLs "https://github.com/yujuhong/gce-k8s-windows-testing/raw/master/windows-cni-plugins.zip"
818-
rm ${env:CNI_DIR}\*.exe
819-
Expand-Archive ${env:CNI_DIR}\windows-cni-plugins.zip ${env:CNI_DIR}
820-
mv ${env:CNI_DIR}\bin\*.exe ${env:CNI_DIR}\
821-
rmdir ${env:CNI_DIR}\bin
817+
$tmp_dir = 'C:\cni_tmp'
818+
New-Item $tmp_dir -ItemType 'directory' -Force | Out-Null
819+
820+
$release_url = ('https://github.com/containernetworking/plugins/releases/' +
821+
'download/' + $CNI_RELEASE_VERSION + '/')
822+
$sha_url = ($release_url +
823+
"cni-plugins-windows-amd64-$CNI_RELEASE_VERSION.tgz.sha1")
824+
$tgz_url = ($release_url +
825+
"cni-plugins-windows-amd64-$CNI_RELEASE_VERSION.tgz")
826+
MustDownload-File -URLs $sha_url -OutFile $tmp_dir\cni-plugins.sha1
827+
$sha1_val = ($(Get-Content $tmp_dir\cni-plugins.sha1) -split ' ',2)[0]
828+
MustDownload-File `
829+
-URLs $tgz_url `
830+
-OutFile $tmp_dir\cni-plugins.tgz `
831+
-Hash $sha1_val
832+
833+
Push-Location $tmp_dir
834+
# tar can only extract in the current directory.
835+
tar -xvf $tmp_dir\cni-plugins.tgz
836+
Move-Item -Force host-local.exe ${env:CNI_DIR}\
837+
Move-Item -Force win-bridge.exe ${env:CNI_DIR}\
838+
Pop-Location
839+
Remove-Item -Force -Recurse $tmp_dir
822840
}
823841
if (-not ((Test-Path ${env:CNI_DIR}\win-bridge.exe) -and `
824842
(Test-Path ${env:CNI_DIR}\host-local.exe))) {

0 commit comments

Comments
 (0)