Skip to content

Commit

Permalink
Merge pull request #4202 from k8s-infra-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…4141-to-release-1.11

[release-1.11] Update custom-builds.yaml template to UAMI
  • Loading branch information
k8s-ci-robot authored Oct 30, 2023
2 parents f177cf0 + a9589c8 commit 203a5b8
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 6 deletions.
34 changes: 31 additions & 3 deletions templates/test/dev/cluster-template-custom-builds.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
- op: add
path: /spec/template/spec/files/-
value:
content: |
Write-Host "Installing Azure CLI"
$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://azcliprod.blob.core.windows.net/msi/azure-cli-2.53.0.msi -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; Remove-Item .\AzureCLI.msi
# Need to add manually AZ to PATH as it is not added without a reset
Write-Host "Adding AZ to path:"
$env:PATH +=";C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin"
Write-Host "Version Azure CLI:"
az version
path: C:/install-az-cli.ps1
permissions: "0744"
- op: add
path: /spec/template/spec/files/-
value:
Expand All @@ -9,12 +22,18 @@
$$KUBE_GIT_VERSION="${KUBE_GIT_VERSION}"
if($$KUBE_GIT_VERSION -ne "")
{
# Need to add manually AZ to PATH as it is not added without a reset
Write-Host "Adding AZ to path:"
$env:PATH +=";C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin"
# Install Binaries
$$binaries=@("kubeadm", "kubectl", "kubelet", "kube-proxy")
$$ci_url="https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/windows/amd64"
echo "running az login via identity"
az login --identity
foreach ( $$binary in $$binaries )
{
echo "downloading binary: $$ci_url/$$binary.exe"
curl.exe --retry 10 --retry-delay 5 "$$ci_url/$$binary.exe" --output "c:/k/$$binary.exe"
az storage blob download --blob-url "$$ci_url/$$binary.exe" --file "c:/k/$$binary.exe" --auth-mode login
}
}
Expand All @@ -29,6 +48,10 @@
kube-proxy.exe --version
path: C:/replace-pr-binaries.ps1
permissions: "0744"
- op: add
path: /spec/template/spec/preKubeadmCommands/-
value:
powershell C:/install-az-cli.ps1
- op: add
path: /spec/template/spec/preKubeadmCommands/-
value:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
systemctl stop kubelet
declare -a BINARIES=("kubeadm" "kubectl" "kubelet")
az login --identity
for BINARY in "$${BINARIES[@]}"; do
echo "* installing package: $${BINARY} ${KUBE_GIT_VERSION}"
curl --retry 10 --retry-delay 5 "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/linux/amd64/$${BINARY}" --output "/usr/bin/$${BINARY}"
az storage blob download --blob-url "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/linux/amd64/$${BINARY}" -f "/usr/bin/$${BINARY}" --auth-mode login
done
systemctl restart kubelet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
systemctl stop kubelet
declare -a BINARIES=("kubeadm" "kubectl" "kubelet")
az login --identity
for BINARY in "$${BINARIES[@]}"; do
echo "* installing package: $${BINARY} ${KUBE_GIT_VERSION}"
curl --retry 10 --retry-delay 5 "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/linux/amd64/$${BINARY}" --output "/usr/bin/$${BINARY}"
az storage blob download --blob-url "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/linux/amd64/$${BINARY}" -f "/usr/bin/$${BINARY}" --auth-mode login
done
systemctl restart kubelet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
spec:
template:
spec:
identity: UserAssigned
userAssignedIdentities:
- providerID: /subscriptions/${AZURE_SUBSCRIPTION_ID}/resourceGroups/${CI_RG:=capz-ci}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/${USER_IDENTITY:=cloud-provider-user-identity}
image:
# we use the latest image as a workaround there is no published marketplace image for k8s CI versions.
# latest binaries and images will get replaced to the desired version by the script above.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ metadata:
spec:
template:
spec:
identity: UserAssigned
userAssignedIdentities:
- providerID: /subscriptions/${AZURE_SUBSCRIPTION_ID}/resourceGroups/${CI_RG:=capz-ci}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/${USER_IDENTITY:=cloud-provider-user-identity}
image:
# we use the latest image as a workaround there is no published marketplace image for k8s CI versions.
# latest binaries and images will get replaced to the desired version by the script above.
Expand All @@ -21,6 +24,9 @@ metadata:
spec:
template:
spec:
identity: UserAssigned
userAssignedIdentities:
- providerID: /subscriptions/${AZURE_SUBSCRIPTION_ID}/resourceGroups/${CI_RG:=capz-ci}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/${USER_IDENTITY:=cloud-provider-user-identity}
image:
# we use the latest image as a workaround there is no published marketplace image for k8s CI versions.
# latest binaries and images will get replaced to the desired version by the script above.
Expand Down

0 comments on commit 203a5b8

Please sign in to comment.