Skip to content

Commit

Permalink
Update to v1.26.9 and go to v1.20.8 (#8357)
Browse files Browse the repository at this point in the history
* Update to v1.26.9

Signed-off-by: Johnatas <johnatasr@hotmail.com>

* Bump containerd and stargz versions

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>

* Print message on upgrade fail

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>

* Send Bad Gateway instead of Service Unavailable when tunnel dial fails

Works around new handling for Service Unavailable by apiserver aggregation added in kubernetes/kubernetes#119870

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>

* Add 60 seconds to server upgrade wait to account for delays in apiserver readiness

Also change cleanup helper to ensure upgrade test doesn't pollute the
images for the rest of the tests.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>

---------

Signed-off-by: Johnatas <johnatasr@hotmail.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Co-authored-by: Brad Davidson <brad.davidson@rancher.com>
  • Loading branch information
Johnatas and brandond committed Sep 19, 2023
1 parent 38cbe2d commit 4e21728
Show file tree
Hide file tree
Showing 13 changed files with 372 additions and 292 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '1.20.7'
go-version: '1.20.8'
check-latest: true
cache: true
cache-dependency-path: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unitcoverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '1.20.7'
go-version: '1.20.8'
check-latest: true
cache: true
cache-dependency-path: |
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dapper
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG GOLANG=golang:1.20.7-alpine3.18
ARG GOLANG=golang:1.20.8-alpine3.18
FROM ${GOLANG}

ARG http_proxy=$http_proxy
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.manifest
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG GOLANG=golang:1.20.7-alpine3.18
ARG GOLANG=golang:1.20.8-alpine3.18
FROM ${GOLANG}

COPY --from=plugins/manifest:1.2.3 /bin/* /bin/
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG GOLANG=golang:1.20.7-alpine3.18
ARG GOLANG=golang:1.20.8-alpine3.18
FROM ${GOLANG} as test-base

RUN apk -U --no-cache add bash jq
Expand Down
157 changes: 79 additions & 78 deletions go.mod

Large diffs are not rendered by default.

452 changes: 252 additions & 200 deletions go.sum

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion pkg/daemons/control/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/yl2chen/cidranger"
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apiserver/pkg/endpoints/handlers/responsewriters"
"k8s.io/apiserver/pkg/endpoints/request"
Expand Down Expand Up @@ -173,7 +174,7 @@ func (t *TunnelServer) serveConnect(resp http.ResponseWriter, req *http.Request)
bconn, err := t.dialBackend(req.Context(), req.Host)
if err != nil {
responsewriters.ErrorNegotiated(
apierrors.NewServiceUnavailable(err.Error()),
newBadGateway(err.Error()),
scheme.Codecs.WithoutConversion(), schema.GroupVersion{}, resp, req,
)
return
Expand Down Expand Up @@ -300,3 +301,14 @@ func (crw *connReadWriteCloser) Close() (err error) {
crw.once.Do(func() { err = crw.conn.Close() })
return
}

func newBadGateway(message string) *apierrors.StatusError {
return &apierrors.StatusError{
ErrStatus: metav1.Status{
Status: metav1.StatusFailure,
Code: http.StatusBadGateway,
Reason: metav1.StatusReasonInternalError,
Message: message,
},
}
}
3 changes: 1 addition & 2 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ GO=${GO-go}

PKG="github.com/k3s-io/k3s"
PKG_CONTAINERD="github.com/containerd/containerd"
PKG_K3S_CONTAINERD="github.com/k3s-io/containerd"
PKG_CRICTL="github.com/kubernetes-sigs/cri-tools/pkg"
PKG_K8S_BASE="k8s.io/component-base"
PKG_K8S_CLIENT="k8s.io/client-go/pkg"
Expand Down Expand Up @@ -37,7 +36,7 @@ VERSIONFLAGS="
-X ${PKG_CRICTL}/version.Version=${VERSION_CRICTL}
-X ${PKG_CONTAINERD}/version.Version=${VERSION_CONTAINERD}
-X ${PKG_CONTAINERD}/version.Package=${PKG_K3S_CONTAINERD}
-X ${PKG_CONTAINERD}/version.Package=${PKG_CONTAINERD_K3S}
-X ${PKG_CNI_PLUGINS}/pkg/utils/buildversion.BuildVersion=${VERSION_CNIPLUGINS}
-X ${PKG_CNI_PLUGINS}/plugins/meta/flannel.Program=flannel
Expand Down
2 changes: 1 addition & 1 deletion scripts/download
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ curl --compressed -sfL https://github.com/k3s-io/k3s-root/releases/download/${VE

git clone --single-branch --branch=${VERSION_RUNC} --depth=1 https://github.com/opencontainers/runc ${RUNC_DIR}

git clone --single-branch --branch=${VERSION_CONTAINERD} --depth=1 https://github.com/k3s-io/containerd ${CONTAINERD_DIR}
git clone --single-branch --branch=${VERSION_CONTAINERD} --depth=1 https://${PKG_CONTAINERD_K3S} ${CONTAINERD_DIR}

for CHART_FILE in $(grep -rlF HelmChart manifests/ | xargs yq eval --no-doc .spec.chart | xargs -n1 basename); do
CHART_NAME=$(echo $CHART_FILE | grep -oE '^(-*[a-z])+')
Expand Down
4 changes: 2 additions & 2 deletions scripts/test-helpers
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,8 @@ cleanup-test-env(){
export SERVER_ARGS=''
export WAIT_SERVICES="${all_services[*]}"

unset AGENT_1_ARGS AGENT_2_ARGS AGENT_3_ARGS AGENT_DOCKER_ARGS
unset SERVER_1_ARGS SERVER_2_ARGS SERVER_3_ARGS SERVER_DOCKER_ARGS
unset AGENT_1_ARGS AGENT_2_ARGS AGENT_3_ARGS AGENT_DOCKER_ARGS K3S_IMAGE_AGENT
unset SERVER_1_ARGS SERVER_2_ARGS SERVER_3_ARGS SERVER_DOCKER_ARGS K3S_IMAGE_SERVER

unset -f server-pre-hook server-post-hook agent-pre-hook agent-post-hook cluster-pre-hook cluster-post-hook test-post-hook test-cleanup-hook
}
Expand Down
17 changes: 14 additions & 3 deletions scripts/test-run-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ server-pre-hook(){
local testID=$(basename $TEST_DIR)
export SERVER_DOCKER_ARGS="\
--mount type=volume,src=k3s-server-$1-${testID,,}-rancher,dst=/var/lib/rancher/k3s \
--mount type=volume,src=k3s-server-$1-${testID,,}-log,dst=/var/log \
--mount type=volume,src=k3s-server-$1-${testID,,}-etc,dst=/etc/rancher"
}
export -f server-pre-hook
Expand All @@ -33,6 +34,7 @@ agent-pre-hook(){
local testID=$(basename $TEST_DIR)
export AGENT_DOCKER_ARGS="\
--mount type=volume,src=k3s-agent-$1-${testID,,}-rancher,dst=/var/lib/rancher/k3s \
--mount type=volume,src=k3s-agent-$1-${testID,,}-log,dst=/var/log \
--mount type=volume,src=k3s-agent-$1-${testID,,}-etc,dst=/etc/rancher"
}
export -f agent-pre-hook
Expand All @@ -42,9 +44,11 @@ start-test() {
kubectl get node -o wide
kubectl create -f scripts/airgap/volume-test.yaml

# Add post-hook sleeps to give the kubelet time to update the version after startup
# Add post-hook sleeps to give the kubelet time to update the version after startup.
# Server gets an extra 60 seconds to handle the metrics-server service being unavailable:
# https://github.com/kubernetes/kubernetes/issues/120739
server-post-hook(){
sleep 15
sleep 75
}
export -f server-post-hook
agent-post-hook(){
Expand All @@ -69,8 +73,15 @@ start-test() {

# Confirm that the nodes are running the current build and that the pod we created earlier is still there
. ./scripts/version.sh || true
kubectl get node -o wide | grep -F $VERSION

verify-valid-versions $(cat $TEST_DIR/servers/1/metadata/name)

kubectl get pod -n kube-system volume-test -o wide

if ! kubectl get node -o wide | grep -qF $VERSION; then
echo "Expected version $VERSION not found in node list"
return 1
fi
}
export -f start-test

Expand Down
5 changes: 5 additions & 0 deletions scripts/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ get-module-version(){
go list -m -f '{{if .Replace}}{{.Replace.Version}}{{else}}{{.Version}}{{end}}' $1
}

get-module-path(){
go list -m -f '{{if .Replace}}{{.Replace.Path}}{{else}}{{.Path}}{{end}}' $1
}

PKG_CONTAINERD_K3S=$(get-module-path github.com/containerd/containerd)
VERSION_CONTAINERD=$(get-module-version github.com/containerd/containerd)
if [ -z "$VERSION_CONTAINERD" ]; then
VERSION_CONTAINERD="v0.0.0"
Expand Down

0 comments on commit 4e21728

Please sign in to comment.