Skip to content

Commit

Permalink
latest testdata
Browse files Browse the repository at this point in the history
  • Loading branch information
djsly committed Oct 11, 2024
1 parent cc3dace commit 60df472
Show file tree
Hide file tree
Showing 344 changed files with 3,010 additions and 5,160 deletions.
2 changes: 1 addition & 1 deletion pkg/agent/testdata/AKSUbuntu1604+Containerd/CSECommand

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pkg/agent/testdata/AKSUbuntu1604+Containerd/CustomData

Large diffs are not rendered by default.

87 changes: 31 additions & 56 deletions pkg/agent/testdata/AKSUbuntu1604+Containerd/line40.sh
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ installCrictl() {
CPU_ARCH=$(getCPUArch)
currentVersion=$(crictl --version 2>/dev/null | sed 's/crictl version //g')
if [[ "${currentVersion}" != "" ]]; then
echo "version ${currentVersion} of crictl already installed. skipping installCrictl of target version ${KUBERNETES_VERSION%.*}.0"
echo "version ${currentVersion} of crictl already installed. skipping installCrictl of target version ${1%.*}.0"
else
CRICTL_TGZ_TEMP="crictl-v${CRICTL_VERSION}-linux-${CPU_ARCH}.tar.gz"
if [[ ! -f "$CRICTL_DOWNLOAD_DIR/${CRICTL_TGZ_TEMP}" ]]; then
Expand All @@ -371,7 +371,7 @@ installCrictl() {
return 1
fi
echo "Unpacking crictl into ${CRICTL_BIN_DIR}"
tar zxvf "$CRICTL_DOWNLOAD_DIR/${CRICTL_TGZ_TEMP}" -C ${CRICTL_BIN_DIR}
tar zxvf "$CRICTL_DOWNLOAD_DIR/${CRICTL_TGZ_TEMP}" -C ${CRICTL_BIN_DIR} || exit $ERR_CRICTL_OPERATION_ERROR
chown root:root $CRICTL_BIN_DIR/crictl
chmod 755 $CRICTL_BIN_DIR/crictl
fi
Expand Down Expand Up @@ -573,29 +573,29 @@ installKubeletKubectlAndKubeProxy() {
}

pullContainerImage() {
CLI_TOOL=$1
CONTAINER_IMAGE_URL=$2
echo "pulling the image ${CONTAINER_IMAGE_URL} using ${CLI_TOOL}"
if [[ ${CLI_TOOL} == "ctr" ]]; then
logs_to_events "AKS.CSE.imagepullctr.${CONTAINER_IMAGE_URL}" "retrycmd_if_failure 2 1 120 ctr --namespace k8s.io image pull $CONTAINER_IMAGE_URL" || (echo "timed out pulling image ${CONTAINER_IMAGE_URL} via ctr" && exit $ERR_CONTAINERD_CTR_IMG_PULL_TIMEOUT)
elif [[ ${CLI_TOOL} == "crictl" ]]; then
logs_to_events "AKS.CSE.imagepullcrictl.${CONTAINER_IMAGE_URL}" "retrycmd_if_failure 2 1 120 crictl pull $CONTAINER_IMAGE_URL" || (echo "timed out pulling image ${CONTAINER_IMAGE_URL} via crictl" && exit $ERR_CONTAINERD_CRICTL_IMG_PULL_TIMEOUT)
local cliTool=$1
local containerImageURL=$2
echo "pulling the image ${containerImageURL} using ${cliTool}"
if [[ ${cliTool} == "ctr" ]]; then
logs_to_events "AKS.CSE.imagepullctr.${containerImageURL}" "retrycmd_if_failure 2 1 120 ctr --namespace k8s.io image pull $containerImageURL" || (echo "timed out pulling image ${containerImageURL} via ctr" && exit $ERR_CONTAINERD_CTR_IMG_PULL_TIMEOUT)
elif [[ ${cliTool} == "crictl" ]]; then
logs_to_events "AKS.CSE.imagepullcrictl.${containerImageURL}" "retrycmd_if_failure 2 1 120 crictl pull $containerImageURL" || (echo "timed out pulling image ${containerImageURL} via crictl" && exit $ERR_CONTAINERD_CRICTL_IMG_PULL_TIMEOUT)
else
logs_to_events "AKS.CSE.imagepull.${CONTAINER_IMAGE_URL}" "retrycmd_if_failure 2 1 120 docker pull $CONTAINER_IMAGE_URL" || (echo "timed out pulling image ${CONTAINER_IMAGE_URL} via docker" && exit $ERR_DOCKER_IMG_PULL_TIMEOUT)
logs_to_events "AKS.CSE.imagepull.${containerImageURL}" "retrycmd_if_failure 2 1 120 docker pull $containerImageURL" || (echo "timed out pulling image ${containerImageURL} via docker" && exit $ERR_DOCKER_IMG_PULL_TIMEOUT)
fi
}

retagContainerImage() {
CLI_TOOL=$1
CONTAINER_IMAGE_URL=$2
RETAG_IMAGE_URL=$3
echo "retagging from ${CONTAINER_IMAGE_URL} to ${RETAG_IMAGE_URL} using ${CLI_TOOL}"
if [[ ${CLI_TOOL} == "ctr" ]]; then
ctr --namespace k8s.io image tag $CONTAINER_IMAGE_URL $RETAG_IMAGE_URL
elif [[ ${CLI_TOOL} == "crictl" ]]; then
crictl image tag $CONTAINER_IMAGE_URL $RETAG_IMAGE_URL
local cliTool=$1
local containerImageURL=$2
local retagImageURL=$3
echo "retagging from ${containerImageURL} to ${retagImageURL} using ${cliTool}"
if [[ ${cliTool} == "ctr" ]]; then
ctr --namespace k8s.io image tag $containerImageURL $retagImageURL
elif [[ ${cliTool} == "crictl" ]]; then
crictl image tag $containerImageURL $retagImageURL
else
docker image tag $CONTAINER_IMAGE_URL $RETAG_IMAGE_URL
docker image tag $containerImageURL $retagImageURL
fi
}

Expand All @@ -620,21 +620,21 @@ retagMCRImagesForChina() {
}

removeContainerImage() {
CLI_TOOL=$1
CONTAINER_IMAGE_URL=$2
if [[ "${CLI_TOOL}" == "docker" ]]; then
docker image rm $CONTAINER_IMAGE_URL
local cliTool=$1
local containerImageURL=$2
if [[ "${cliTool}" == "docker" ]]; then
docker image rm $containerImageURL
else
crictl rmi $CONTAINER_IMAGE_URL
crictl rmi $containerImageURL
fi
}

cleanUpImages() {
local targetImage=$1
export targetImage
function cleanupImagesRun() {
local cliTool=$1
local targetImage=$2
if [ "${NEEDS_CONTAINERD}" == "true" ]; then
if [[ "${CLI_TOOL}" == "crictl" ]]; then
if [[ "${cliTool}" == "crictl" ]]; then
images_to_delete=$(crictl images | awk '{print $1":"$2}' | grep -vE "${KUBERNETES_VERSION}$|${KUBERNETES_VERSION}.[0-9]+$|${KUBERNETES_VERSION}-|${KUBERNETES_VERSION}_" | grep ${targetImage} | tr ' ' '\n')
else
images_to_delete=$(ctr --namespace k8s.io images list | awk '{print $1}' | grep -vE "${KUBERNETES_VERSION}$|${KUBERNETES_VERSION}.[0-9]+$|${KUBERNETES_VERSION}-|${KUBERNETES_VERSION}_" | grep ${targetImage} | tr ' ' '\n')
Expand All @@ -648,51 +648,26 @@ cleanUpImages() {
elif [[ "${images_to_delete}" != "" ]]; then
echo "${images_to_delete}" | while read image; do
if [ "${NEEDS_CONTAINERD}" == "true" ]; then
removeContainerImage ${CLI_TOOL} ${image}
removeContainerImage ${cliTool} ${image}
else
removeContainerImage "docker" ${image}
fi
done
fi
}

export -f cleanupImagesRun
retrycmd_if_failure 10 5 120 bash -c cleanupImagesRun
retrycmd_if_failure 10 5 120 bash -c cleanupImagesRun ${1} ${2}
}

cleanUpKubeProxyImages() {
echo $(date),$(hostname), startCleanUpKubeProxyImages
cleanUpImages "kube-proxy"
cleanUpImages "ctr" "kube-proxy"
echo $(date),$(hostname), endCleanUpKubeProxyImages
}

cleanupRetaggedImages() {
if [[ "${TARGET_CLOUD}" != "AzureChinaCloud" ]]; then
if [ "${NEEDS_CONTAINERD}" == "true" ]; then
if [[ "${CLI_TOOL}" == "crictl" ]]; then
images_to_delete=$(crictl images | awk '{print $1":"$2}' | grep '^mcr.azk8s.cn/' | tr ' ' '\n')
else
images_to_delete=$(ctr --namespace k8s.io images list | awk '{print $1}' | grep '^mcr.azk8s.cn/' | tr ' ' '\n')
fi
else
images_to_delete=$(docker images --format '{{.Repository}}:{{.Tag}}' | grep '^mcr.azk8s.cn/' | tr ' ' '\n')
fi
if [[ "${images_to_delete}" != "" ]]; then
echo "${images_to_delete}" | while read image; do
if [ "${NEEDS_CONTAINERD}" == "true" ]; then
removeContainerImage "ctr" ${image}
else
removeContainerImage "docker" ${image}
fi
done
fi
else
echo "skipping container cleanup for AzureChinaCloud"
fi
}

cleanUpContainerImages() {
export KUBERNETES_VERSION
export CLI_TOOL
export -f retrycmd_if_failure
export -f removeContainerImage
export -f cleanUpImages
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/testdata/AKSUbuntu1604+Containerd/line70.sh
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ configGPUDrivers() {
if [[ $OS == $UBUNTU_OS_NAME ]]; then
mkdir -p /opt/{actions,gpu}
if [[ "${CONTAINER_RUNTIME}" == "containerd" ]]; then
ctr image pull $NVIDIA_DRIVER_IMAGE:$NVIDIA_DRIVER_IMAGE_TAG
pullContainerImage "crictl" $NVIDIA_DRIVER_IMAGE:$NVIDIA_DRIVER_IMAGE_TAG
retrycmd_if_failure 5 10 600 bash -c "$CTR_GPU_INSTALL_CMD $NVIDIA_DRIVER_IMAGE:$NVIDIA_DRIVER_IMAGE_TAG gpuinstall /entrypoint.sh install"
ret=$?
if [[ "$ret" != "0" ]]; then
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ installCrictl() {
CPU_ARCH=$(getCPUArch)
currentVersion=$(crictl --version 2>/dev/null | sed 's/crictl version //g')
if [[ "${currentVersion}" != "" ]]; then
echo "version ${currentVersion} of crictl already installed. skipping installCrictl of target version ${KUBERNETES_VERSION%.*}.0"
echo "version ${currentVersion} of crictl already installed. skipping installCrictl of target version ${1%.*}.0"
else
CRICTL_TGZ_TEMP="crictl-v${CRICTL_VERSION}-linux-${CPU_ARCH}.tar.gz"
if [[ ! -f "$CRICTL_DOWNLOAD_DIR/${CRICTL_TGZ_TEMP}" ]]; then
Expand All @@ -371,7 +371,7 @@ installCrictl() {
return 1
fi
echo "Unpacking crictl into ${CRICTL_BIN_DIR}"
tar zxvf "$CRICTL_DOWNLOAD_DIR/${CRICTL_TGZ_TEMP}" -C ${CRICTL_BIN_DIR}
tar zxvf "$CRICTL_DOWNLOAD_DIR/${CRICTL_TGZ_TEMP}" -C ${CRICTL_BIN_DIR} || exit $ERR_CRICTL_OPERATION_ERROR
chown root:root $CRICTL_BIN_DIR/crictl
chmod 755 $CRICTL_BIN_DIR/crictl
fi
Expand Down Expand Up @@ -573,29 +573,29 @@ installKubeletKubectlAndKubeProxy() {
}

pullContainerImage() {
CLI_TOOL=$1
CONTAINER_IMAGE_URL=$2
echo "pulling the image ${CONTAINER_IMAGE_URL} using ${CLI_TOOL}"
if [[ ${CLI_TOOL} == "ctr" ]]; then
logs_to_events "AKS.CSE.imagepullctr.${CONTAINER_IMAGE_URL}" "retrycmd_if_failure 2 1 120 ctr --namespace k8s.io image pull $CONTAINER_IMAGE_URL" || (echo "timed out pulling image ${CONTAINER_IMAGE_URL} via ctr" && exit $ERR_CONTAINERD_CTR_IMG_PULL_TIMEOUT)
elif [[ ${CLI_TOOL} == "crictl" ]]; then
logs_to_events "AKS.CSE.imagepullcrictl.${CONTAINER_IMAGE_URL}" "retrycmd_if_failure 2 1 120 crictl pull $CONTAINER_IMAGE_URL" || (echo "timed out pulling image ${CONTAINER_IMAGE_URL} via crictl" && exit $ERR_CONTAINERD_CRICTL_IMG_PULL_TIMEOUT)
local cliTool=$1
local containerImageURL=$2
echo "pulling the image ${containerImageURL} using ${cliTool}"
if [[ ${cliTool} == "ctr" ]]; then
logs_to_events "AKS.CSE.imagepullctr.${containerImageURL}" "retrycmd_if_failure 2 1 120 ctr --namespace k8s.io image pull $containerImageURL" || (echo "timed out pulling image ${containerImageURL} via ctr" && exit $ERR_CONTAINERD_CTR_IMG_PULL_TIMEOUT)
elif [[ ${cliTool} == "crictl" ]]; then
logs_to_events "AKS.CSE.imagepullcrictl.${containerImageURL}" "retrycmd_if_failure 2 1 120 crictl pull $containerImageURL" || (echo "timed out pulling image ${containerImageURL} via crictl" && exit $ERR_CONTAINERD_CRICTL_IMG_PULL_TIMEOUT)
else
logs_to_events "AKS.CSE.imagepull.${CONTAINER_IMAGE_URL}" "retrycmd_if_failure 2 1 120 docker pull $CONTAINER_IMAGE_URL" || (echo "timed out pulling image ${CONTAINER_IMAGE_URL} via docker" && exit $ERR_DOCKER_IMG_PULL_TIMEOUT)
logs_to_events "AKS.CSE.imagepull.${containerImageURL}" "retrycmd_if_failure 2 1 120 docker pull $containerImageURL" || (echo "timed out pulling image ${containerImageURL} via docker" && exit $ERR_DOCKER_IMG_PULL_TIMEOUT)
fi
}

retagContainerImage() {
CLI_TOOL=$1
CONTAINER_IMAGE_URL=$2
RETAG_IMAGE_URL=$3
echo "retagging from ${CONTAINER_IMAGE_URL} to ${RETAG_IMAGE_URL} using ${CLI_TOOL}"
if [[ ${CLI_TOOL} == "ctr" ]]; then
ctr --namespace k8s.io image tag $CONTAINER_IMAGE_URL $RETAG_IMAGE_URL
elif [[ ${CLI_TOOL} == "crictl" ]]; then
crictl image tag $CONTAINER_IMAGE_URL $RETAG_IMAGE_URL
local cliTool=$1
local containerImageURL=$2
local retagImageURL=$3
echo "retagging from ${containerImageURL} to ${retagImageURL} using ${cliTool}"
if [[ ${cliTool} == "ctr" ]]; then
ctr --namespace k8s.io image tag $containerImageURL $retagImageURL
elif [[ ${cliTool} == "crictl" ]]; then
crictl image tag $containerImageURL $retagImageURL
else
docker image tag $CONTAINER_IMAGE_URL $RETAG_IMAGE_URL
docker image tag $containerImageURL $retagImageURL
fi
}

Expand All @@ -620,21 +620,21 @@ retagMCRImagesForChina() {
}

removeContainerImage() {
CLI_TOOL=$1
CONTAINER_IMAGE_URL=$2
if [[ "${CLI_TOOL}" == "docker" ]]; then
docker image rm $CONTAINER_IMAGE_URL
local cliTool=$1
local containerImageURL=$2
if [[ "${cliTool}" == "docker" ]]; then
docker image rm $containerImageURL
else
crictl rmi $CONTAINER_IMAGE_URL
crictl rmi $containerImageURL
fi
}

cleanUpImages() {
local targetImage=$1
export targetImage
function cleanupImagesRun() {
local cliTool=$1
local targetImage=$2
if [ "${NEEDS_CONTAINERD}" == "true" ]; then
if [[ "${CLI_TOOL}" == "crictl" ]]; then
if [[ "${cliTool}" == "crictl" ]]; then
images_to_delete=$(crictl images | awk '{print $1":"$2}' | grep -vE "${KUBERNETES_VERSION}$|${KUBERNETES_VERSION}.[0-9]+$|${KUBERNETES_VERSION}-|${KUBERNETES_VERSION}_" | grep ${targetImage} | tr ' ' '\n')
else
images_to_delete=$(ctr --namespace k8s.io images list | awk '{print $1}' | grep -vE "${KUBERNETES_VERSION}$|${KUBERNETES_VERSION}.[0-9]+$|${KUBERNETES_VERSION}-|${KUBERNETES_VERSION}_" | grep ${targetImage} | tr ' ' '\n')
Expand All @@ -648,51 +648,26 @@ cleanUpImages() {
elif [[ "${images_to_delete}" != "" ]]; then
echo "${images_to_delete}" | while read image; do
if [ "${NEEDS_CONTAINERD}" == "true" ]; then
removeContainerImage ${CLI_TOOL} ${image}
removeContainerImage ${cliTool} ${image}
else
removeContainerImage "docker" ${image}
fi
done
fi
}

export -f cleanupImagesRun
retrycmd_if_failure 10 5 120 bash -c cleanupImagesRun
retrycmd_if_failure 10 5 120 bash -c cleanupImagesRun ${1} ${2}
}

cleanUpKubeProxyImages() {
echo $(date),$(hostname), startCleanUpKubeProxyImages
cleanUpImages "kube-proxy"
cleanUpImages "ctr" "kube-proxy"
echo $(date),$(hostname), endCleanUpKubeProxyImages
}

cleanupRetaggedImages() {
if [[ "${TARGET_CLOUD}" != "AzureChinaCloud" ]]; then
if [ "${NEEDS_CONTAINERD}" == "true" ]; then
if [[ "${CLI_TOOL}" == "crictl" ]]; then
images_to_delete=$(crictl images | awk '{print $1":"$2}' | grep '^mcr.azk8s.cn/' | tr ' ' '\n')
else
images_to_delete=$(ctr --namespace k8s.io images list | awk '{print $1}' | grep '^mcr.azk8s.cn/' | tr ' ' '\n')
fi
else
images_to_delete=$(docker images --format '{{.Repository}}:{{.Tag}}' | grep '^mcr.azk8s.cn/' | tr ' ' '\n')
fi
if [[ "${images_to_delete}" != "" ]]; then
echo "${images_to_delete}" | while read image; do
if [ "${NEEDS_CONTAINERD}" == "true" ]; then
removeContainerImage "ctr" ${image}
else
removeContainerImage "docker" ${image}
fi
done
fi
else
echo "skipping container cleanup for AzureChinaCloud"
fi
}

cleanUpContainerImages() {
export KUBERNETES_VERSION
export CLI_TOOL
export -f retrycmd_if_failure
export -f removeContainerImage
export -f cleanUpImages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ configGPUDrivers() {
if [[ $OS == $UBUNTU_OS_NAME ]]; then
mkdir -p /opt/{actions,gpu}
if [[ "${CONTAINER_RUNTIME}" == "containerd" ]]; then
ctr image pull $NVIDIA_DRIVER_IMAGE:$NVIDIA_DRIVER_IMAGE_TAG
pullContainerImage "crictl" $NVIDIA_DRIVER_IMAGE:$NVIDIA_DRIVER_IMAGE_TAG
retrycmd_if_failure 5 10 600 bash -c "$CTR_GPU_INSTALL_CMD $NVIDIA_DRIVER_IMAGE:$NVIDIA_DRIVER_IMAGE_TAG gpuinstall /entrypoint.sh install"
ret=$?
if [[ "$ret" != "0" ]]; then
Expand Down
Loading

0 comments on commit 60df472

Please sign in to comment.