mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Use CNI plugins v0.8.0 release.
This commit is contained in:
parent
c14106ad12
commit
5d669f2946
@ -123,9 +123,10 @@ function Validate-SHA1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Attempts to download the file from URLs, trying each URL until it succeeds.
|
# Attempts to download the file from URLs, trying each URL until it succeeds.
|
||||||
# It will loop through the URLs list forever until it has a success.
|
# It will loop through the URLs list forever until it has a success. If
|
||||||
# If successful, it will write the file to OutFile. You can optionally provide a SHA1 Hash
|
# successful, it will write the file to OutFile. You can optionally provide a
|
||||||
# argument, in which case it will attempt to validate the downloaded file against the hash.
|
# SHA1 Hash argument, in which case it will attempt to validate the downloaded
|
||||||
|
# file against the hash.
|
||||||
function MustDownload-File {
|
function MustDownload-File {
|
||||||
param (
|
param (
|
||||||
[parameter(Mandatory=$false)] [string]$Hash,
|
[parameter(Mandatory=$false)] [string]$Hash,
|
||||||
|
@ -811,14 +811,32 @@ Import-Module -Name $modulePath'.replace('K8S_DIR', ${env:K8S_DIR})
|
|||||||
# CLUSTER_IP_RANGE
|
# CLUSTER_IP_RANGE
|
||||||
# SERVICE_CLUSTER_IP_RANGE
|
# SERVICE_CLUSTER_IP_RANGE
|
||||||
function Configure-CniNetworking {
|
function Configure-CniNetworking {
|
||||||
|
$CNI_RELEASE_VERSION = 'v0.8.0'
|
||||||
if ((ShouldWrite-File ${env:CNI_DIR}\win-bridge.exe) -or
|
if ((ShouldWrite-File ${env:CNI_DIR}\win-bridge.exe) -or
|
||||||
(ShouldWrite-File ${env:CNI_DIR}\host-local.exe)) {
|
(ShouldWrite-File ${env:CNI_DIR}\host-local.exe)) {
|
||||||
MustDownload-File -OutFile ${env:CNI_DIR}\windows-cni-plugins.zip `
|
$tmp_dir = 'C:\cni_tmp'
|
||||||
-URLs "https://github.com/yujuhong/gce-k8s-windows-testing/raw/master/windows-cni-plugins.zip"
|
New-Item $tmp_dir -ItemType 'directory' -Force | Out-Null
|
||||||
rm ${env:CNI_DIR}\*.exe
|
|
||||||
Expand-Archive ${env:CNI_DIR}\windows-cni-plugins.zip ${env:CNI_DIR}
|
$release_url = ('https://github.com/containernetworking/plugins/releases/' +
|
||||||
mv ${env:CNI_DIR}\bin\*.exe ${env:CNI_DIR}\
|
'download/' + $CNI_RELEASE_VERSION + '/')
|
||||||
rmdir ${env:CNI_DIR}\bin
|
$sha_url = ($release_url +
|
||||||
|
"cni-plugins-windows-amd64-$CNI_RELEASE_VERSION.tgz.sha1")
|
||||||
|
$tgz_url = ($release_url +
|
||||||
|
"cni-plugins-windows-amd64-$CNI_RELEASE_VERSION.tgz")
|
||||||
|
MustDownload-File -URLs $sha_url -OutFile $tmp_dir\cni-plugins.sha1
|
||||||
|
$sha1_val = ($(Get-Content $tmp_dir\cni-plugins.sha1) -split ' ',2)[0]
|
||||||
|
MustDownload-File `
|
||||||
|
-URLs $tgz_url `
|
||||||
|
-OutFile $tmp_dir\cni-plugins.tgz `
|
||||||
|
-Hash $sha1_val
|
||||||
|
|
||||||
|
Push-Location $tmp_dir
|
||||||
|
# tar can only extract in the current directory.
|
||||||
|
tar -xvf $tmp_dir\cni-plugins.tgz
|
||||||
|
Move-Item -Force host-local.exe ${env:CNI_DIR}\
|
||||||
|
Move-Item -Force win-bridge.exe ${env:CNI_DIR}\
|
||||||
|
Pop-Location
|
||||||
|
Remove-Item -Force -Recurse $tmp_dir
|
||||||
}
|
}
|
||||||
if (-not ((Test-Path ${env:CNI_DIR}\win-bridge.exe) -and `
|
if (-not ((Test-Path ${env:CNI_DIR}\win-bridge.exe) -and `
|
||||||
(Test-Path ${env:CNI_DIR}\host-local.exe))) {
|
(Test-Path ${env:CNI_DIR}\host-local.exe))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user