Skip to content

Commit

Permalink
testdata
Browse files Browse the repository at this point in the history
  • Loading branch information
fseldow committed Jan 20, 2025
1 parent efa4184 commit 26a022f
Show file tree
Hide file tree
Showing 261 changed files with 3,828 additions and 348 deletions.
4 changes: 2 additions & 2 deletions pkg/agent/testdata/AKSUbuntu1604+Containerd/CustomData

Large diffs are not rendered by default.

24 changes: 22 additions & 2 deletions pkg/agent/testdata/AKSUbuntu1604+Containerd/line40.sh
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,11 @@ installKubeletKubectlAndKubeProxy() {
if [[ "$install_default_if_missing" == true ]]; then
if [[ ! -z ${BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER} ]]; then
echo "Detect Bootstrap profile artifact is Cache, will use oras to pull artifact binary"
registry_url="${BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER}/${K8S_REGISTRY_REPO}/kubernetes-node:v${KUBERNETES_VERSION}-linux-${CPU_ARCH}"
KUBE_BINARY_REGISTRY_URL=""
updateKubeBinaryRegistryURL

K8S_DOWNLOADS_TEMP_DIR_FROM_REGISTRY="/tmp/kubernetes/downloads"
logs_to_events "AKS.CSE.installKubeletKubectlAndKubeProxy.extractKubeBinaries" extractKubeBinaries ${KUBERNETES_VERSION} $registry_url false ${K8S_DOWNLOADS_TEMP_DIR_FROM_REGISTRY}
logs_to_events "AKS.CSE.installKubeletKubectlAndKubeProxy.extractKubeBinaries" extractKubeBinaries ${KUBERNETES_VERSION} $KUBE_BINARY_REGISTRY_URL false ${K8S_DOWNLOADS_TEMP_DIR_FROM_REGISTRY}

#TODO: remove the condition check on KUBE_BINARY_URL once RP change is released
elif (($(echo ${KUBERNETES_VERSION} | cut -d"." -f2) >= 17)) && [ -n "${KUBE_BINARY_URL}" ]; then
Expand All @@ -578,6 +580,24 @@ installKubeletKubectlAndKubeProxy() {
rm -rf /usr/local/bin/kubelet-* /usr/local/bin/kubectl-* /home/hyperkube-downloads &
}

generateKubeBinaryRegistryURL() {
if [[ -n "${KUBE_BINARY_URL}" ]] && isRegistryUrl "${KUBE_BINARY_URL}"; then
echo "KUBE_BINARY_URL is a registry url, will use it to pull the kube binary"
registry_url="${KUBE_BINARY_URL}"
else
url_regex='https://[^/]+/kubernetes/v[0-9]+\.[0-9]+\..+/binaries/.+'
if [[ -n ${KUBE_BINARY_URL} ]]; then
binary_version="v${KUBERNETES_VERSION}"
if [[ ${KUBE_BINARY_URL} =~ $url_regex ]]; then
version_with_prefix="${KUBE_BINARY_URL#*kubernetes/}"
binary_version="${version_with_prefix%%/*}"
echo "Extracted version: $binary_version from KUBE_BINARY_URL: ${KUBE_BINARY_URL}"
fi
fi
registry_url="${BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER}/${K8S_REGISTRY_REPO}/kubernetes-node:${binary_version}-linux-${CPU_ARCH}"
fi
}

pullContainerImage() {
CLI_TOOL=$1
CONTAINER_IMAGE_URL=$2
Expand Down
20 changes: 20 additions & 0 deletions pkg/agent/testdata/AKSUbuntu1604+Containerd/line9.sh
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,26 @@ removeKubeletNodeLabel() {
fi
}

updateKubeBinaryRegistryURL() {
if [[ -n "${KUBE_BINARY_URL}" ]] && isRegistryUrl "${KUBE_BINARY_URL}"; then
echo "KUBE_BINARY_URL is a registry url, will use it to pull the kube binary"
KUBE_BINARY_REGISTRY_URL="${KUBE_BINARY_URL}"
else
url_regex='https://[^/]+/kubernetes/v[0-9]+\.[0-9]+\..+/binaries/.+'
if [[ -n ${KUBE_BINARY_URL} ]]; then
binary_version="v${KUBERNETES_VERSION}"
if [[ ${KUBE_BINARY_URL} =~ $url_regex ]]; then
version_with_prefix="${KUBE_BINARY_URL#*kubernetes/}"
binary_version="${version_with_prefix%%/*}"
echo "Extracted version: $binary_version from KUBE_BINARY_URL: ${KUBE_BINARY_URL}"
else
echo "KUBE_BINARY_URL is formatted unexpectedly, will use the kubernetes version as binary version: $binary_version"
fi
fi
KUBE_BINARY_REGISTRY_URL="${BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER}/${K8S_REGISTRY_REPO}/kubernetes-node:${binary_version}-linux-${CPU_ARCH}"
fi
}

removeKubeletFlag() {
local FLAG_STRING=$1
if grep -e ",${FLAG_STRING}" <<< "$KUBELET_FLAGS" > /dev/null 2>&1; then
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,11 @@ installKubeletKubectlAndKubeProxy() {
if [[ "$install_default_if_missing" == true ]]; then
if [[ ! -z ${BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER} ]]; then
echo "Detect Bootstrap profile artifact is Cache, will use oras to pull artifact binary"
registry_url="${BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER}/${K8S_REGISTRY_REPO}/kubernetes-node:v${KUBERNETES_VERSION}-linux-${CPU_ARCH}"
KUBE_BINARY_REGISTRY_URL=""
updateKubeBinaryRegistryURL

K8S_DOWNLOADS_TEMP_DIR_FROM_REGISTRY="/tmp/kubernetes/downloads"
logs_to_events "AKS.CSE.installKubeletKubectlAndKubeProxy.extractKubeBinaries" extractKubeBinaries ${KUBERNETES_VERSION} $registry_url false ${K8S_DOWNLOADS_TEMP_DIR_FROM_REGISTRY}
logs_to_events "AKS.CSE.installKubeletKubectlAndKubeProxy.extractKubeBinaries" extractKubeBinaries ${KUBERNETES_VERSION} $KUBE_BINARY_REGISTRY_URL false ${K8S_DOWNLOADS_TEMP_DIR_FROM_REGISTRY}

#TODO: remove the condition check on KUBE_BINARY_URL once RP change is released
elif (($(echo ${KUBERNETES_VERSION} | cut -d"." -f2) >= 17)) && [ -n "${KUBE_BINARY_URL}" ]; then
Expand All @@ -578,6 +580,24 @@ installKubeletKubectlAndKubeProxy() {
rm -rf /usr/local/bin/kubelet-* /usr/local/bin/kubectl-* /home/hyperkube-downloads &
}

generateKubeBinaryRegistryURL() {
if [[ -n "${KUBE_BINARY_URL}" ]] && isRegistryUrl "${KUBE_BINARY_URL}"; then
echo "KUBE_BINARY_URL is a registry url, will use it to pull the kube binary"
registry_url="${KUBE_BINARY_URL}"
else
url_regex='https://[^/]+/kubernetes/v[0-9]+\.[0-9]+\..+/binaries/.+'
if [[ -n ${KUBE_BINARY_URL} ]]; then
binary_version="v${KUBERNETES_VERSION}"
if [[ ${KUBE_BINARY_URL} =~ $url_regex ]]; then
version_with_prefix="${KUBE_BINARY_URL#*kubernetes/}"
binary_version="${version_with_prefix%%/*}"
echo "Extracted version: $binary_version from KUBE_BINARY_URL: ${KUBE_BINARY_URL}"
fi
fi
registry_url="${BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER}/${K8S_REGISTRY_REPO}/kubernetes-node:${binary_version}-linux-${CPU_ARCH}"
fi
}

pullContainerImage() {
CLI_TOOL=$1
CONTAINER_IMAGE_URL=$2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,26 @@ removeKubeletNodeLabel() {
fi
}

updateKubeBinaryRegistryURL() {
if [[ -n "${KUBE_BINARY_URL}" ]] && isRegistryUrl "${KUBE_BINARY_URL}"; then
echo "KUBE_BINARY_URL is a registry url, will use it to pull the kube binary"
KUBE_BINARY_REGISTRY_URL="${KUBE_BINARY_URL}"
else
url_regex='https://[^/]+/kubernetes/v[0-9]+\.[0-9]+\..+/binaries/.+'
if [[ -n ${KUBE_BINARY_URL} ]]; then
binary_version="v${KUBERNETES_VERSION}"
if [[ ${KUBE_BINARY_URL} =~ $url_regex ]]; then
version_with_prefix="${KUBE_BINARY_URL#*kubernetes/}"
binary_version="${version_with_prefix%%/*}"
echo "Extracted version: $binary_version from KUBE_BINARY_URL: ${KUBE_BINARY_URL}"
else
echo "KUBE_BINARY_URL is formatted unexpectedly, will use the kubernetes version as binary version: $binary_version"
fi
fi
KUBE_BINARY_REGISTRY_URL="${BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER}/${K8S_REGISTRY_REPO}/kubernetes-node:${binary_version}-linux-${CPU_ARCH}"
fi
}

removeKubeletFlag() {
local FLAG_STRING=$1
if grep -e ",${FLAG_STRING}" <<< "$KUBELET_FLAGS" > /dev/null 2>&1; then
Expand Down
Loading

0 comments on commit 26a022f

Please sign in to comment.