Unverified Commit 6330a5b4 authored by Johnatas's avatar Johnatas Committed by GitHub

Update to v1.28.2 and go v1.20.8 (#8364)

* Update to v1.28.2 Signed-off-by: 's avatarJohnatas <johnatasr@hotmail.com> * Bump containerd and stargz versions Signed-off-by: 's avatarBrad Davidson <brad.davidson@rancher.com> * Print message on upgrade fail Signed-off-by: 's avatarBrad 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: 's avatarBrad 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: 's avatarBrad Davidson <brad.davidson@rancher.com> --------- Signed-off-by: 's avatarJohnatas <johnatasr@hotmail.com> Signed-off-by: 's avatarBrad Davidson <brad.davidson@rancher.com> Co-authored-by: 's avatarBrad Davidson <brad.davidson@rancher.com>
parent 550dd057
...@@ -48,7 +48,7 @@ jobs: ...@@ -48,7 +48,7 @@ jobs:
- name: Install Go - name: Install Go
uses: actions/setup-go@v4 uses: actions/setup-go@v4
with: with:
go-version: '1.20.7' go-version: '1.20.8'
check-latest: true check-latest: true
cache: true cache: true
cache-dependency-path: | cache-dependency-path: |
......
...@@ -41,7 +41,7 @@ jobs: ...@@ -41,7 +41,7 @@ jobs:
- name: Install Go - name: Install Go
uses: actions/setup-go@v4 uses: actions/setup-go@v4
with: with:
go-version: '1.20.7' go-version: '1.20.8'
check-latest: true check-latest: true
cache: true cache: true
cache-dependency-path: | cache-dependency-path: |
......
ARG GOLANG=golang:1.20.7-alpine3.18 ARG GOLANG=golang:1.20.8-alpine3.18
FROM ${GOLANG} FROM ${GOLANG}
ARG http_proxy=$http_proxy ARG http_proxy=$http_proxy
......
ARG GOLANG=golang:1.20.7-alpine3.18 ARG GOLANG=golang:1.20.8-alpine3.18
FROM ${GOLANG} as infra FROM ${GOLANG} as infra
ARG http_proxy=$http_proxy ARG http_proxy=$http_proxy
......
ARG GOLANG=golang:1.20.7-alpine3.18 ARG GOLANG=golang:1.20.8-alpine3.18
FROM ${GOLANG} FROM ${GOLANG}
COPY --from=plugins/manifest:1.2.3 /bin/* /bin/ COPY --from=plugins/manifest:1.2.3 /bin/* /bin/
......
ARG GOLANG=golang:1.20.7-alpine3.18 ARG GOLANG=golang:1.20.8-alpine3.18
FROM ${GOLANG} as test-base FROM ${GOLANG} as test-base
RUN apk -U --no-cache add bash jq RUN apk -U --no-cache add bash jq
...@@ -44,7 +44,7 @@ RUN vagrant box add generic/ubuntu2004 --provider libvirt --force ...@@ -44,7 +44,7 @@ RUN vagrant box add generic/ubuntu2004 --provider libvirt --force
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"; \ RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"; \
chmod +x ./kubectl; \ chmod +x ./kubectl; \
mv ./kubectl /usr/local/bin/kubectl mv ./kubectl /usr/local/bin/kubectl
RUN GO_VERSION=go1.20.7; \ RUN GO_VERSION=go1.20.8; \
curl -O -L "https://golang.org/dl/${GO_VERSION}.linux-amd64.tar.gz"; \ curl -O -L "https://golang.org/dl/${GO_VERSION}.linux-amd64.tar.gz"; \
rm -rf /usr/local/go; \ rm -rf /usr/local/go; \
tar -C /usr/local -xzf ${GO_VERSION}.linux-amd64.tar.gz; tar -C /usr/local -xzf ${GO_VERSION}.linux-amd64.tar.gz;
......
...@@ -23,6 +23,7 @@ import ( ...@@ -23,6 +23,7 @@ import (
"github.com/yl2chen/cidranger" "github.com/yl2chen/cidranger"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors" apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apiserver/pkg/endpoints/handlers/responsewriters" "k8s.io/apiserver/pkg/endpoints/handlers/responsewriters"
"k8s.io/apiserver/pkg/endpoints/request" "k8s.io/apiserver/pkg/endpoints/request"
...@@ -173,7 +174,7 @@ func (t *TunnelServer) serveConnect(resp http.ResponseWriter, req *http.Request) ...@@ -173,7 +174,7 @@ func (t *TunnelServer) serveConnect(resp http.ResponseWriter, req *http.Request)
bconn, err := t.dialBackend(req.Context(), req.Host) bconn, err := t.dialBackend(req.Context(), req.Host)
if err != nil { if err != nil {
responsewriters.ErrorNegotiated( responsewriters.ErrorNegotiated(
apierrors.NewServiceUnavailable(err.Error()), newBadGateway(err.Error()),
scheme.Codecs.WithoutConversion(), schema.GroupVersion{}, resp, req, scheme.Codecs.WithoutConversion(), schema.GroupVersion{}, resp, req,
) )
return return
...@@ -300,3 +301,14 @@ func (crw *connReadWriteCloser) Close() (err error) { ...@@ -300,3 +301,14 @@ func (crw *connReadWriteCloser) Close() (err error) {
crw.once.Do(func() { err = crw.conn.Close() }) crw.once.Do(func() { err = crw.conn.Close() })
return return
} }
func newBadGateway(message string) *apierrors.StatusError {
return &apierrors.StatusError{
ErrStatus: metav1.Status{
Status: metav1.StatusFailure,
Code: http.StatusBadGateway,
Reason: metav1.StatusReasonInternalError,
Message: message,
},
}
}
...@@ -9,7 +9,6 @@ GO=${GO-go} ...@@ -9,7 +9,6 @@ GO=${GO-go}
PKG="github.com/k3s-io/k3s" PKG="github.com/k3s-io/k3s"
PKG_CONTAINERD="github.com/containerd/containerd" PKG_CONTAINERD="github.com/containerd/containerd"
PKG_K3S_CONTAINERD="github.com/k3s-io/containerd"
PKG_CRICTL="github.com/kubernetes-sigs/cri-tools/pkg" PKG_CRICTL="github.com/kubernetes-sigs/cri-tools/pkg"
PKG_K8S_BASE="k8s.io/component-base" PKG_K8S_BASE="k8s.io/component-base"
PKG_K8S_CLIENT="k8s.io/client-go/pkg" PKG_K8S_CLIENT="k8s.io/client-go/pkg"
...@@ -37,7 +36,7 @@ VERSIONFLAGS=" ...@@ -37,7 +36,7 @@ VERSIONFLAGS="
-X ${PKG_CRICTL}/version.Version=${VERSION_CRICTL} -X ${PKG_CRICTL}/version.Version=${VERSION_CRICTL}
-X ${PKG_CONTAINERD}/version.Version=${VERSION_CONTAINERD} -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}/pkg/utils/buildversion.BuildVersion=${VERSION_CNIPLUGINS}
-X ${PKG_CNI_PLUGINS}/plugins/meta/flannel.Program=flannel -X ${PKG_CNI_PLUGINS}/plugins/meta/flannel.Program=flannel
......
...@@ -24,7 +24,7 @@ curl --compressed -sfL https://github.com/k3s-io/k3s-root/releases/download/${VE ...@@ -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_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 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])+') CHART_NAME=$(echo $CHART_FILE | grep -oE '^(-*[a-z])+')
......
...@@ -534,8 +534,8 @@ cleanup-test-env(){ ...@@ -534,8 +534,8 @@ cleanup-test-env(){
export SERVER_ARGS='' export SERVER_ARGS=''
export WAIT_SERVICES="${all_services[*]}" export WAIT_SERVICES="${all_services[*]}"
unset AGENT_1_ARGS AGENT_2_ARGS AGENT_3_ARGS AGENT_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 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 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
} }
......
...@@ -25,6 +25,7 @@ server-pre-hook(){ ...@@ -25,6 +25,7 @@ server-pre-hook(){
local testID=$(basename $TEST_DIR) local testID=$(basename $TEST_DIR)
export SERVER_DOCKER_ARGS="\ 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,,}-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" --mount type=volume,src=k3s-server-$1-${testID,,}-etc,dst=/etc/rancher"
} }
export -f server-pre-hook export -f server-pre-hook
...@@ -33,6 +34,7 @@ agent-pre-hook(){ ...@@ -33,6 +34,7 @@ agent-pre-hook(){
local testID=$(basename $TEST_DIR) local testID=$(basename $TEST_DIR)
export AGENT_DOCKER_ARGS="\ 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,,}-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" --mount type=volume,src=k3s-agent-$1-${testID,,}-etc,dst=/etc/rancher"
} }
export -f agent-pre-hook export -f agent-pre-hook
...@@ -42,9 +44,11 @@ start-test() { ...@@ -42,9 +44,11 @@ start-test() {
kubectl get node -o wide kubectl get node -o wide
kubectl create -f scripts/airgap/volume-test.yaml 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(){ server-post-hook(){
sleep 15 sleep 75
} }
export -f server-post-hook export -f server-post-hook
agent-post-hook(){ agent-post-hook(){
...@@ -69,8 +73,15 @@ start-test() { ...@@ -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 # Confirm that the nodes are running the current build and that the pod we created earlier is still there
. ./scripts/version.sh || true . ./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 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 export -f start-test
......
...@@ -26,6 +26,11 @@ get-module-version(){ ...@@ -26,6 +26,11 @@ get-module-version(){
go list -m -f '{{if .Replace}}{{.Replace.Version}}{{else}}{{.Version}}{{end}}' $1 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) VERSION_CONTAINERD=$(get-module-version github.com/containerd/containerd)
if [ -z "$VERSION_CONTAINERD" ]; then if [ -z "$VERSION_CONTAINERD" ]; then
VERSION_CONTAINERD="v0.0.0" VERSION_CONTAINERD="v0.0.0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment