-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
61 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
Function Get-KubernetesKubectl { | ||
<# | ||
.SYNOPSIS | ||
Returns the available Kubernetes Kubectl versions. | ||
.NOTES | ||
Author: BornToBeRoot | ||
Twitter: @_BornToBeRoot | ||
#> | ||
[OutputType([System.Management.Automation.PSObject])] | ||
[CmdletBinding(SupportsShouldProcess = $False)] | ||
param ( | ||
[Parameter(Mandatory = $False, Position = 0)] | ||
[ValidateNotNull()] | ||
[System.Management.Automation.PSObject] | ||
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) | ||
) | ||
|
||
# Get the latest version for kubectl | ||
$Version = Invoke-RestMethod -Uri $res.Get.Update.Uri | ||
# Build the download links for each platform & architecture | ||
foreach ($DownloadUri in $res.Get.Download.Uri.GetEnumerator()) { | ||
[pscustomobject] @{ | ||
Version = $Version | ||
Architecture = $DownloadUri.Name.Split("_")[1] | ||
Platform = $DownloadUri.Name.Split("_")[0] | ||
URI = $DownloadUri.Value -replace $res.Get.Download.ReplaceVersionText, $Version | ||
} | ||
} | ||
} | ||
function Get-KubernetesKubectl { | ||
<# | ||
.SYNOPSIS | ||
Returns the available Kubernetes Kubectl versions. | ||
.NOTES | ||
Author: BornToBeRoot | ||
Twitter: @_BornToBeRoot | ||
#> | ||
[OutputType([System.Management.Automation.PSObject])] | ||
[CmdletBinding(SupportsShouldProcess = $False)] | ||
param ( | ||
[Parameter(Mandatory = $False, Position = 0)] | ||
[ValidateNotNull()] | ||
[System.Management.Automation.PSObject] | ||
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) | ||
) | ||
|
||
# Get the latest version for kubectl | ||
$Version = Invoke-RestMethod -Uri $res.Get.Update.Uri | ||
|
||
# Build the download links for each platform & architecture | ||
foreach ($DownloadUri in $res.Get.Download.Uri.GetEnumerator()) { | ||
[PSCustomObject] @{ | ||
Version = $Version | ||
Architecture = $DownloadUri.Name.Split("_")[1] | ||
Platform = $DownloadUri.Name.Split("_")[0] | ||
URI = $DownloadUri.Value -replace $res.Get.Download.ReplaceVersionText, $Version | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,30 @@ | ||
{ | ||
"Name": "Kubernetes Kubectl", | ||
"Source": "https://kubernetes.io/", | ||
"Get": { | ||
"Update": { | ||
"Uri": "https://cdn.dl.k8s.io/release/stable.txt" | ||
}, | ||
"Download": { | ||
"Uri": { | ||
"Windows_x64": "https://dl.k8s.io/release/#version/bin/windows/amd64/kubectl.exe", | ||
"Windows_x86": "https://dl.k8s.io/release/#version/bin/windows/386/kubectl.exe", | ||
"Windows_arm64": "https://dl.k8s.io/release/#version/bin/windows/arm64/kubectl.exe", | ||
"Linux_x64": "https://dl.k8s.io/release/#version/bin/linux/amd64/kubectl", | ||
"Linux_arm64": "https://dl.k8s.io/release/#version/bin/linux/arm64/kubectl", | ||
"Darwin_x64": "https://dl.k8s.io/release/#version/bin/darwin/amd64/kubectl", | ||
"Darwin_arm64": "https://dl.k8s.io/release/#version/bin/darwin/arm64/kubectl" | ||
}, | ||
"ReplaceVersionText": "#version" | ||
} | ||
}, | ||
"Install": { | ||
"Setup": { | ||
"Windows": "kubectl.exe", | ||
"Linux" : "kubectl", | ||
"Darwin" : "kubectl" | ||
}, | ||
"Physical": { | ||
"Arguments": "", | ||
"PostInstall": [] | ||
}, | ||
"Virtual": { | ||
"Arguments": "", | ||
"PostInstall": [] | ||
} | ||
} | ||
} | ||
{ | ||
"Name": "Kubernetes Kubectl", | ||
"Source": "https://kubernetes.io/", | ||
"Get": { | ||
"Update": { | ||
"Uri": "https://cdn.dl.k8s.io/release/stable.txt" | ||
}, | ||
"Download": { | ||
"Uri": { | ||
"Windows_x64": "https://dl.k8s.io/release/#version/bin/windows/amd64/kubectl.exe", | ||
"Windows_x86": "https://dl.k8s.io/release/#version/bin/windows/386/kubectl.exe", | ||
"Windows_arm64": "https://dl.k8s.io/release/#version/bin/windows/arm64/kubectl.exe" | ||
}, | ||
"ReplaceVersionText": "#version" | ||
} | ||
}, | ||
"Install": { | ||
"Setup": { | ||
"Windows": "kubectl.exe" | ||
}, | ||
"Physical": { | ||
"Arguments": "", | ||
"PostInstall": [] | ||
}, | ||
"Virtual": { | ||
"Arguments": "", | ||
"PostInstall": [] | ||
} | ||
} | ||
} |