Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Strip version to Major.Minor.Build format so checks using (#3135)
Browse files Browse the repository at this point in the history
System.Version won't fail for K8s versions like x.y.z-alpha
  • Loading branch information
adelina-t authored and jackfrancis committed Jun 1, 2018
1 parent d8d3ba6 commit d9bd63b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions parts/k8s/kuberneteswindowssetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,10 @@ Write-KubernetesStartFiles($podCIDR)
$KubeletCommandLine = @"
c:\k\kubelet.exe --hostname-override=`$env:computername --pod-infra-container-image=kubletwin/pause --resolv-conf="" --allow-privileged=true --enable-debugging-handlers --cluster-dns=`$global:KubeDnsServiceIp --cluster-domain=cluster.local --kubeconfig=c:\k\config --hairpin-mode=promiscuous-bridge --v=2 --azure-container-registry-config=c:\k\azure.json --runtime-request-timeout=10m --cloud-provider=azure --cloud-config=c:\k\azure.json
"@

if ([System.Version]$global:KubeBinariesVersion -lt [System.Version]"1.8.0")
# Regex to strip version to Major.Minor.Build format such that the following check does not crash for version like x.y.z-alpha
[regex]$regex = "^[0-9.]+"
$KubeBinariesVersionStripped = $regex.Matches($global:KubeBinariesVersion).Value
if ([System.Version]$KubeBinariesVersionStripped -lt [System.Version]"1.8.0")
{
# --api-server deprecates from 1.8.0
$KubeletArgList += "--api-servers=https://`${global:MasterIP}:443"
Expand Down

0 comments on commit d9bd63b

Please sign in to comment.