Skip to content

Commit

Permalink
review feedback - remove unused kube-proxy and cni logic from kind-up…
Browse files Browse the repository at this point in the history
…grade.sh script
  • Loading branch information
aaron-prindle committed Feb 13, 2025
1 parent 636c64d commit e3f7425
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,10 @@ signal_handler() {
}
trap signal_handler INT TERM

# build kubernetes / node image, e2e binaries
# build kubectl, kubernetes e2e test binaries, and ginkgo
build() {
# build the node image w/ kubernetes (NOT USED FOR INITIAL CLUSTER, but for upgrade)

# Ginkgo v1 is used by Kubernetes 1.24 and earlier, fallback if v2 is not available.
GINKGO_SRC_DIR="vendor/github.com/onsi/ginkgo/v2/ginkgo"
if [ ! -d "$GINKGO_SRC_DIR" ]; then
GINKGO_SRC_DIR="vendor/github.com/onsi/ginkgo/ginkgo"
fi

# make sure we have e2e requirements
make all WHAT="cmd/kubectl test/e2e/e2e.test ${GINKGO_SRC_DIR}"

Expand Down Expand Up @@ -283,20 +278,20 @@ run_tests() {
}

upgrade_cluster_components() {
# upgrade cluster components excluding kube-proxy and kubelet
# upgrade cluster components excluding the kubelet

# Get the retry attempts, defaulting to 5 if not set
RETRY_ATTEMPTS="${RETRY_ATTEMPTS:-5}"

local attempt=1
local success=false

echo "Attempt $attempt of $RETRY_ATTEMPTS to upgrade cluster..."
bash -x "${UPGRADE_SCRIPT}" --no-kproxy --no-kubelet | tee "${ARTIFACTS}/upgrade-output-1.txt"
bash -x "${UPGRADE_SCRIPT}" --no-kproxy --no-kubelet | tee "${ARTIFACTS}/upgrade-output-2.txt"
bash -x "${UPGRADE_SCRIPT}" --no-kubelet | tee "${ARTIFACTS}/upgrade-output-1.txt"
bash -x "${UPGRADE_SCRIPT}" --no-kubelet | tee "${ARTIFACTS}/upgrade-output-2.txt"
# Run the script twice, is necessary for fully updating the binaries

while [ "$attempt" -le "$RETRY_ATTEMPTS" ]; do
echo "Attempt $attempt of $RETRY_ATTEMPTS to upgrade cluster..."
# Check if kubectl version reports the current version
kind export kubeconfig --name kind
if kubectl version | grep "Server Version:"| grep -q "$CURRENT_VERSION"; then
Expand Down
40 changes: 3 additions & 37 deletions experiment/compatibility-versions/kind-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,6 @@ update_kubelet() {
done
}

update_kube_proxy() {
for n in $NODES; do
kind load image-archive ${IMAGES_PATH}/kube-proxy.tar --name ${CLUSTER_NAME}
done
# RollingUpdate
kubectl set image ds/kube-proxy kube-proxy=${DOCKER_REGISTRY}/kube-proxy-amd64:${DOCKER_TAG} -n kube-system
kubectl rollout status ds/kube-proxy -n kube-system -w
echo "Updated kube-proxy"
}

update_cni() {
for n in $NODES; do
kind load image-archive ${CNI_IMAGE} --name ${CLUSTER_NAME}
done
# RollingUpdate
kubectl set image ds/kindnet kindnet-cni=${CNI_IMAGE} -n kube-system
kubectl rollout status ds/kindnet -n kube-system -w
echo "Updated kindnet"
}

update_control_plane(){
# TODO allow to configure node and control plane components
for n in $CONTROL_PLANE_NODES; do
Expand All @@ -68,8 +48,8 @@ update_control_plane(){

usage()
{
echo "usage: kind_upgrade.sh [-n|--name <cluster_name>] [--cni <cni_image>]"
echo " [--no-kproxy] [--no-control-plane] [--no-kubelet]"
echo "usage: kind_upgrade.sh [-n|--name <cluster_name>]"
echo " [--no-control-plane] [--no-kubelet]"
echo ""
}

Expand All @@ -80,11 +60,6 @@ parse_args()
-n | --name ) shift
CLUSTER_NAME=$1
;;
--cni-image ) shift
CNI_IMAGE=$1
;;
--no-kproxy ) UPDATE_KUBE_PROXY=false
;;
--no-kubelet ) UPDATE_KUBELET=false
;;
--no-control-plane ) UPDATE_CONTROL_PLANE=false
Expand Down Expand Up @@ -117,7 +92,7 @@ KUBE_ROOT="."
source "${KUBE_ROOT}/hack/lib/version.sh"
kube::version::get_version_vars
DOCKER_TAG=${KUBE_GIT_VERSION/+/_}
DOCKER_REGISTRY=${KUBE_DOCKER_REGISTRY:-k8s.gcr.io}
DOCKER_REGISTRY=${KUBE_DOCKER_REGISTRY:-registry.k8s.io}
export GOFLAGS="-tags=providerless"
export KUBE_BUILD_CONFORMANCE=n

Expand All @@ -139,15 +114,6 @@ if [[ "$UPDATE_KUBELET" == "true" ]]; then
update_kubelet
fi

if [[ "$UPDATE_KUBE_PROXY" == "true" ]]; then
update_kube_proxy
fi

# If CNI_IMAGE set update the CNI
if [[ ! -z ${CNI_IMAGE} ]]; then
update_cni
fi

if kubectl get nodes | grep NoReady; then
echo "Error: KIND cluster $CLUSTER_NAME NOT READY"
exit 1
Expand Down

0 comments on commit e3f7425

Please sign in to comment.