Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.11] Update custom-builds.yaml template to UAMI #4202

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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