@@ -811,14 +811,32 @@ Import-Module -Name $modulePath'.replace('K8S_DIR', ${env:K8S_DIR})
811
811
# CLUSTER_IP_RANGE
812
812
# SERVICE_CLUSTER_IP_RANGE
813
813
function Configure-CniNetworking {
814
+ $CNI_RELEASE_VERSION = ' v0.8.0'
814
815
if ((ShouldWrite- File ${env: CNI_DIR} \win-bridge.exe ) -or
815
816
(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
822
840
}
823
841
if (-not ((Test-Path ${env: CNI_DIR} \win-bridge.exe ) -and `
824
842
(Test-Path ${env: CNI_DIR} \host-local.exe ))) {
0 commit comments