Skip to content

Commit 95075c5

Browse files
committed
Add customdata
1 parent 4735901 commit 95075c5

99 files changed

Lines changed: 314 additions & 310 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

parts/linux/cloud-init/artifacts/cse_install.sh

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ installContainerdWithComponentsJson() {
5757
else
5858
os_version="${UBUNTU_RELEASE}"
5959
fi
60-
60+
6161
containerdPackage=$(jq ".Packages" "$COMPONENTS_FILEPATH" | jq ".[] | select(.name == \"containerd\")") || exit $ERR_CONTAINERD_VERSION_INVALID
6262
PACKAGE_VERSIONS=()
6363
if isMariner "${OS}" && [ "${IS_KATA}" = "true" ]; then
@@ -67,7 +67,7 @@ installContainerdWithComponentsJson() {
6767
os=${AZURELINUX_KATA_OS_NAME}
6868
fi
6969
updatePackageVersions "${containerdPackage}" "${os}" "${os_version}"
70-
70+
7171
#Containerd's versions array is expected to have only one element.
7272
#If it has more than one element, we will install the last element in the array.
7373
# shellcheck disable=SC3010
@@ -103,7 +103,7 @@ installContainerdWithComponentsJson() {
103103
}
104104

105105
# containerd versions definitions are only available in the manifest file before the centralized packages changes, before around early July 2024.
106-
# After the centralized packages changes, the containerd versions are only available in the components.json.
106+
# After the centralized packages changes, the containerd versions are only available in the components.json.
107107
installContainerdWithManifestJson() {
108108
local containerd_version
109109
if [ -f "$MANIFEST_FILEPATH" ]; then
@@ -144,16 +144,16 @@ installNetworkPlugin() {
144144
installAzureCNI
145145
fi
146146
installCNI #reference plugins. Mostly for kubenet but loopback plugin is used by containerd until containerd 2
147-
rm -rf $CNI_DOWNLOADS_DIR &
147+
rm -rf $CNI_DOWNLOADS_DIR &
148148
}
149149

150-
# downloadCredentialProvider is always called during build time by install-dependencies.sh.
150+
# downloadCredentialProvider is always called during build time by install-dependencies.sh.
151151
# It can also be called during node provisioning by cse_config.sh, meaning CREDENTIAL_PROVIDER_DOWNLOAD_URL is set by a passed in linuxCredentialProviderURL.
152152
downloadCredentialProvider() {
153153
CREDENTIAL_PROVIDER_DOWNLOAD_URL="${CREDENTIAL_PROVIDER_DOWNLOAD_URL:=}"
154154
if [ -n "${CREDENTIAL_PROVIDER_DOWNLOAD_URL}" ]; then
155155
# CREDENTIAL_PROVIDER_DOWNLOAD_URL is set by linuxCredentialProviderURL
156-
# The version in the URL is unknown. An acs-mirror or registry URL could be passed meaning the version must be extracted from the URL.
156+
# The version in the URL is unknown. An acs-mirror or registry URL could be passed meaning the version must be extracted from the URL.
157157
cred_version_for_oras=$(echo "$CREDENTIAL_PROVIDER_DOWNLOAD_URL" | grep -oP 'v\d+(\.\d+)*' | sed 's/^v//' | head -n 1)
158158
fi
159159

@@ -175,7 +175,7 @@ downloadCredentialProvider() {
175175
local credential_provider_download_url_for_oras="${BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER}/${K8S_REGISTRY_REPO}/azure-acr-credential-provider:v${cred_version_for_oras}-linux-${CPU_ARCH}"
176176
CREDENTIAL_PROVIDER_TGZ_TMP="${CREDENTIAL_PROVIDER_DOWNLOAD_URL##*/}" # Use bash builtin ## to remove all chars ("*") up to the final "/"
177177
retrycmd_get_tarball_from_registry_with_oras 120 5 "$CREDENTIAL_PROVIDER_DOWNLOAD_DIR/$CREDENTIAL_PROVIDER_TGZ_TMP" "${credential_provider_download_url_for_oras}" || exit $ERR_ORAS_PULL_CREDENTIAL_PROVIDER
178-
return
178+
return
179179
elif isRegistryUrl "${CREDENTIAL_PROVIDER_DOWNLOAD_URL}"; then
180180
# if the URL is a registry URL, then download the credential provider using oras
181181
# extract version v1.30.0 from format like mcr.microsoft.com/oss/binaries/kubernetes/azure-acr-credential-provider:v1.30.0-linux-amd64
@@ -290,7 +290,7 @@ evalPackageDownloadURL() {
290290

291291
downloadAzureCNI() {
292292
mkdir -p ${1-$:CNI_DOWNLOADS_DIR}
293-
# At VHD build time, the VNET_CNI_PLUGINS_URL is usually not set.
293+
# At VHD build time, the VNET_CNI_PLUGINS_URL is usually not set.
294294
# So, we will get the URL passed from install-depenencies.sh which is actually from components.json
295295
# At node provisioning time, if AKS-RP sets the VNET_CNI_PLUGINS_URL, then we will use that.
296296
VNET_CNI_PLUGINS_URL=${2:-$VNET_CNI_PLUGINS_URL}
@@ -389,24 +389,24 @@ setupCNIDirs() {
389389

390390
# Reference CNI plugins is used by kubenet and the loopback plugin used by containerd 1.0 (dependency gone in 2.0)
391391
# The version used to be deteremined by RP/toggle but are now just hadcoded in vhd as they rarely change and require a node image upgrade anyways
392-
# Latest VHD should have the untar, older should have the tgz. And who knows will have neither.
392+
# Latest VHD should have the untar, older should have the tgz. And who knows will have neither.
393393
installCNI() {
394394
# Old versions of VHDs will not have components.json. If it does not exist, we will fall back to the hardcoded download for CNI.
395395
# Network Isolated Cluster / Bring Your Own ACR will not work with a vhd that requres a hardcoded CNI download.
396396
if [ ! -f "$COMPONENTS_FILEPATH" ] || ! jq '.Packages[] | select(.name == "cni-plugins")' < $COMPONENTS_FILEPATH > /dev/null; then
397-
echo "WARNING: no cni-plugins components present falling back to hard coded download of 1.4.1. This should error eventually"
397+
echo "WARNING: no cni-plugins components present falling back to hard coded download of 1.4.1. This should error eventually"
398398
# could we fail if not Ubuntu2204Gen2ContainerdPrivateKubePkg vhd? Are there others?
399399
# definitely not handling arm here.
400400
retrycmd_get_tarball 120 5 "${CNI_DOWNLOADS_DIR}/refcni.tar.gz" "https://${PACKAGE_DOWNLOAD_BASE_URL}/cni-plugins/v1.4.1/binaries/cni-plugins-linux-amd64-v1.4.1.tgz" || exit $ERR_CNI_DOWNLOAD_TIMEOUT
401401
extract_tarball "${CNI_DOWNLOADS_DIR}/refcni.tar.gz" "$CNI_BIN_DIR"
402-
return
402+
return
403403
fi
404404

405405
#always just use what is listed in components.json so we don't have to sync.
406406
cniPackage=$(jq ".Packages" "$COMPONENTS_FILEPATH" | jq ".[] | select(.name == \"cni-plugins\")") || exit $ERR_CNI_VERSION_INVALID
407-
407+
408408
#CNI doesn't really care about this but wanted to reuse updatePackageVersions which requires it.
409-
os=${UBUNTU_OS_NAME}
409+
os=${UBUNTU_OS_NAME}
410410
if [ -z "$UBUNTU_RELEASE" ]; then
411411
os=${OS}
412412
os_version="current"
@@ -417,7 +417,7 @@ installCNI() {
417417
fi
418418
PACKAGE_VERSIONS=()
419419
updatePackageVersions "${cniPackage}" "${os}" "${os_version}"
420-
420+
421421
#should change to ne
422422
# shellcheck disable=SC3010
423423
if [[ ${#PACKAGE_VERSIONS[@]} -gt 1 ]]; then
@@ -427,15 +427,15 @@ installCNI() {
427427
packageVersion=${PACKAGE_VERSIONS[0]}
428428

429429
# Is there a ${arch} variable I can use instead of the iff
430-
if [ "$(isARM64)" -eq 1 ]; then
430+
if [ "$(isARM64)" -eq 1 ]; then
431431
CNI_DIR_TMP="cni-plugins-linux-arm64-v${packageVersion}"
432-
else
432+
else
433433
CNI_DIR_TMP="cni-plugins-linux-amd64-v${packageVersion}"
434434
fi
435-
435+
436436
if [ -d "$CNI_DOWNLOADS_DIR/${CNI_DIR_TMP}" ]; then
437-
#not clear to me when this would ever happen. assume its related to the line above Latest VHD should have the untar, older should have the tgz.
438-
mv ${CNI_DOWNLOADS_DIR}/${CNI_DIR_TMP}/* $CNI_BIN_DIR
437+
#not clear to me when this would ever happen. assume its related to the line above Latest VHD should have the untar, older should have the tgz.
438+
mv ${CNI_DOWNLOADS_DIR}/${CNI_DIR_TMP}/* $CNI_BIN_DIR
439439
else
440440
echo "CNI tarball should already be unzipped by components.json"
441441
exit $ERR_CNI_VERSION_INVALID
@@ -507,7 +507,7 @@ extractKubeBinaries() {
507507
else
508508
k8s_tgz_tmp="${k8s_downloads_dir}/${k8s_tgz_tmp_filename}"
509509
mkdir -p ${k8s_downloads_dir}
510-
510+
511511
# if the url is a registry url, use oras to pull the artifact instead of curl
512512
if isRegistryUrl "${kube_binary_url}"; then
513513
echo "detect kube_binary_url, ${kube_binary_url}, as registry url, will use oras to pull artifact binary"
@@ -553,11 +553,11 @@ installKubeletKubectlFromURL() {
553553
# if the custom url is not specified and the required kubectl/kubelet-version via private url is not installed, install using the default url/package
554554
if [ ! -f "/usr/local/bin/kubectl-${KUBERNETES_VERSION}" ] || [ ! -f "/usr/local/bin/kubelet-${KUBERNETES_VERSION}" ]; then
555555
if [ "$install_default_if_missing" = "true" ]; then
556-
if [ -n "${BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER}" ]; then
556+
if [ -n "${BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER}" ]; then
557557
# network isolated cluster
558558
echo "Detect Bootstrap profile artifact is Cache, will use oras to pull artifact binary"
559559
updateKubeBinaryRegistryURL
560-
560+
561561
K8S_DOWNLOADS_TEMP_DIR_FROM_REGISTRY="/tmp/kubernetes/downloads" # /opt folder will return permission error
562562
logs_to_events "AKS.CSE.installKubeletKubectlFromURL.extractKubeBinaries" extractKubeBinaries ${KUBERNETES_VERSION} "${KUBE_BINARY_REGISTRY_URL:-}" false ${K8S_DOWNLOADS_TEMP_DIR_FROM_REGISTRY}
563563
# no egress traffic, default install will fail
@@ -610,7 +610,7 @@ pullContainerImage() {
610610
return $ERR_CONTAINERD_DOCKER_IMG_PULL_TIMEOUT
611611
fi
612612
fi
613-
613+
614614
echo "successfully pulled image ${CONTAINER_IMAGE_URL} using ${CLI_TOOL}"
615615
}
616616

@@ -676,6 +676,8 @@ removeContainerImage() {
676676
cleanUpImages() {
677677
local targetImage=$1
678678
export targetImage
679+
680+
# shellcheck disable=SC2329
679681
function cleanupImagesRun() {
680682
if [ "${NEEDS_CONTAINERD}" = "true" ]; then
681683
if [ "${CLI_TOOL}" = "crictl" ]; then
@@ -770,10 +772,10 @@ getInstallModeAndCleanupContainerImages() {
770772
echo "detected golden image pre-install"
771773
logs_to_events "AKS.CSE.cleanUpContainerImages" cleanUpContainerImages
772774
FULL_INSTALL_REQUIRED=false
773-
else
775+
else
774776
echo "the file $VHD_LOGS_FILEPATH does not exist and IS_VHD is "${IS_VHD,,}", full install requred"
775777
fi
776-
778+
777779
echo "${FULL_INSTALL_REQUIRED,,}"
778780
}
779781

parts/linux/cloud-init/artifacts/mariner/cse_install_mariner.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ installCredentialProviderFromPMC() {
172172
updateDnfWithNvidiaPkg() {
173173
local readonly nvidia_repo_path="/etc/yum.repos.d/nvidia-built-azurelinux.repo"
174174

175+
# shellcheck disable=SC1048
175176
if [ "$OS_VERSION" != "3.0" ]; then
176177
# TODO
177178
# Error out?

parts/linux/cloud-init/artifacts/ubuntu/cse_install_ubuntu.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ updateAptWithNvidiaPkg() {
8585
local repo_arch=""
8686
local nvidia_ubuntu_release=""
8787

88+
# shellcheck disable=SC1048
8889
if [ "$cpu_arch" = "amd64" ]; then
8990
repo_arch="x86_64"
9091
elif [ "$cpu_arch" = "arm64" ]; then

0 commit comments

Comments
 (0)