Skip to content

Commit 72bb374

Browse files
committed
Upgrade dependencies
Some Golang CVEs get flagged in the suc binary as it was built with an older golang version. Use go 1.22.6 Updating other go module deps. SLES update is required for libc compatiblity with latest ginkgo version. Update golangci-lint. Most gingko and gomega changes are to fix linting failures. Update sonobuoy docker bridge address is added to tls-san to avoid cert errors when using the client to connect the KUBEHOST. Drop deprecated version field in the docker compose manifests. It is recommended that the next release be v0.15.0 as 0.14.0 was already published and deleted in the past and gosumdb already has entries.
1 parent 57605e3 commit 72bb374

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+765
-1143
lines changed

.golangci.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
]
1212
},
1313
"run": {
14-
"skip-files": [
14+
"exclude-files": [
1515
"/zz_generated_"
1616
],
1717
"deadline": "5m"
1818
}
19-
}
19+
}

Dockerfile.dapper

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
ARG KUBECTL=rancher/kubectl:v1.25.4
1+
ARG KUBECTL=rancher/kubectl:v1.30.3
22
FROM ${KUBECTL} AS kubectl
33

4-
FROM registry.suse.com/bci/golang:1.20
4+
FROM registry.suse.com/bci/golang:1.22
55

66
COPY --from=kubectl /bin/kubectl /usr/local/bin/kubectl
77

88
ARG DAPPER_HOST_ARCH
99
ENV ARCH $DAPPER_HOST_ARCH
10-
ARG SONOBUOY_VERSION=0.56.16
11-
10+
ARG SONOBUOY_VERSION=0.57.1
1211
RUN zypper -n install expect git jq docker vim less file curl wget iproute2 gawk
1312
RUN if [ "${ARCH:-$(go env GOARCH)}" = "amd64" ]; then \
14-
curl -sL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.51.2; \
15-
curl -sL "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.0.3/kustomize_v5.0.3_linux_amd64.tar.gz" | tar -xz -C /usr/local/bin; \
16-
curl -sL "https://github.com/vmware-tanzu/sonobuoy/releases/download/v${SONOBUOY_VERSION}/sonobuoy_${SONOBUOY_VERSION}_linux_${ARCH}.tar.gz" | tar -xz -C /usr/local/bin; \
17-
curl -sL "https://github.com/docker/compose/releases/download/v2.17.3/docker-compose-linux-x86_64" -o /usr/local/bin/docker-compose && \
18-
chmod +x /usr/local/bin/docker-compose; \
13+
curl -sL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.59.1; \
14+
curl -sL "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.4.3/kustomize_v5.4.3_linux_amd64.tar.gz" | tar -xz -C /usr/local/bin; \
15+
curl -sL "https://github.com/vmware-tanzu/sonobuoy/releases/download/v${SONOBUOY_VERSION}/sonobuoy_${SONOBUOY_VERSION}_linux_${ARCH}.tar.gz" | tar -xz -C /usr/local/bin; \
16+
curl -sL "https://github.com/docker/compose/releases/download/v2.29.1/docker-compose-linux-x86_64" -o /usr/local/bin/docker-compose && \
17+
chmod +x /usr/local/bin/docker-compose; \
1918
fi
2019
RUN mkdir -p /usr/local/lib/docker/cli-plugins; \
21-
curl -o /usr/local/lib/docker/cli-plugins/docker-buildx -fsSL "https://github.com/docker/buildx/releases/download/v0.11.2/buildx-v0.11.2.linux-${ARCH}"; \
20+
curl -o /usr/local/lib/docker/cli-plugins/docker-buildx -fsSL "https://github.com/docker/buildx/releases/download/v0.16.2/buildx-v0.16.2.linux-${ARCH}"; \
2221
chmod +x /usr/local/lib/docker/cli-plugins/docker-buildx
2322
ENV DAPPER_ENV REPO TAG DRONE_TAG
2423
ENV DAPPER_SOURCE /go/src/github.com/rancher/system-upgrade-controller/

e2e/cluster/local/docker-compose.yaml

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: "3.7"
2-
31
volumes:
42
kubeconfig:
53
name: e2e-local-kubeconfig
@@ -13,7 +11,7 @@ services:
1311
context: ./images/k3s/.
1412
args:
1513
- ARCH=${ARCH}
16-
command: server --disable=traefik,metrics-server --disable-helm-controller
14+
command: server --disable=traefik,metrics-server --disable-helm-controller --tls-san 172.17.0.1
1715
environment:
1816
- K3S_TOKEN=e2e
1917
hostname: k3s-server-1

e2e/cluster/local/images/k3s/Dockerfile

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# Install the all-in-one binary so we can copy our run-time images into the image
22
# which helps avoid pulling them when running e2e tests.
3-
ARG BCI="registry.suse.com/bci/bci-base:15.5"
3+
ARG BCI="registry.suse.com/bci/bci-base:15.6"
44
FROM ${BCI} AS k3s
55
ARG ARCH
6-
ARG K3S_VERSION="v1.25.9+k3s1"
6+
ARG K3S_VERSION="v1.30.3+k3s1"
77
RUN set -x \
8-
&& zypper -n in \
9-
ca-certificates \
10-
curl \
11-
&& if [ "${ARCH?required}" != "amd64" ]; then \
12-
K3S_SUFFIX="-${ARCH}"; \
13-
fi \
14-
&& curl -fsSL "https://github.com/rancher/k3s/releases/download/${K3S_VERSION}/k3s${K3S_SUFFIX}" > /bin/k3s \
15-
&& chmod +x /bin/k3s \
16-
&& ln -s /bin/k3s /bin/kubectl \
17-
&& ln -s /bin/k3s /bin/ctr \
18-
&& k3s --version
8+
&& zypper -n in \
9+
ca-certificates \
10+
curl \
11+
&& if [ "${ARCH?required}" != "amd64" ]; then \
12+
K3S_SUFFIX="-${ARCH}"; \
13+
fi \
14+
&& curl -fsSL "https://github.com/rancher/k3s/releases/download/${K3S_VERSION}/k3s${K3S_SUFFIX}" > /bin/k3s \
15+
&& chmod +x /bin/k3s \
16+
&& ln -s /bin/k3s /bin/kubectl \
17+
&& ln -s /bin/k3s /bin/ctr \
18+
&& k3s --version
1919

2020
COPY scratch/*-${ARCH}.tar /var/lib/rancher/k3s/agent/images/
2121
#ADD https://github.com/rancher/k3s/releases/download/${K3S_VERSION}/k3s-airgap-images-${ARCH}.tar /var/lib/rancher/k3s/agent/images/

e2e/cluster/local/scripts/cluster-prepare

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ set -e
55
: "${ARCH?required}"
66
: "${DIST?required}"
77
: "${BCI_TAG:=15.4}"
8-
: "${KUBECTL_TAG:=v1.25.4}"
9-
: "${SONOBUOY_TAG:=v0.56.16}"
8+
: "${KUBECTL_TAG:=v1.30.3}"
9+
: "${SONOBUOY_TAG:=v0.57.1}"
1010

1111
docker-image-save() {
1212
echo "Pulling '$1:$2' ..."

e2e/framework/channel.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func ChannelServer(location string, statusCode int) *httptest.Server {
1313
Failf("cannot read hostname: %v", err)
1414
}
1515
server := &httptest.Server{
16-
Config: &http.Server{Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
16+
Config: &http.Server{Handler: http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
1717
w.Header().Set("Location", location)
1818
w.WriteHeader(statusCode)
1919
})},

e2e/framework/framework.go

+8-12
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,11 @@ func New(name string, opt ...Option) *Client {
6060
fn(options)
6161
}
6262
client := &Client{
63-
Framework: framework.Framework{
64-
BaseName: name,
65-
AddonResourceConstraints: make(map[string]framework.ResourceConstraint),
66-
NamespacePodSecurityEnforceLevel: admissionapi.LevelPrivileged,
67-
Options: options.Options,
68-
},
63+
Framework: *framework.NewFramework(name, options.Options, nil),
6964
}
65+
client.Framework.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
7066
ginkgo.BeforeEach(client.BeforeEach)
71-
ginkgo.AfterEach(client.AfterEach)
67+
//ginkgo.DeferCleanup(client.AfterEach)
7268
return client
7369
}
7470

@@ -161,14 +157,14 @@ func (c *Client) WaitForPlanJobs(plan *upgradeapiv1.Plan, count int, timeout tim
161157
})
162158
}
163159

164-
func (c *Client) BeforeEach() {
160+
func (c *Client) BeforeEach(ctx context.Context) {
165161
c.beforeFramework()
166-
c.Framework.BeforeEach()
162+
c.Framework.BeforeEach(ctx)
167163
c.setupController()
168164
}
169165

170-
func (c *Client) AfterEach() {
171-
c.Framework.AfterEach()
166+
func (c *Client) AfterEach(ctx context.Context) {
167+
c.Framework.AfterEach(ctx)
172168
}
173169

174170
func (c *Client) setupController() {
@@ -181,7 +177,7 @@ func (c *Client) setupController() {
181177
}, metav1.CreateOptions{})
182178
framework.ExpectNoError(err)
183179

184-
err = frameworkauth.BindClusterRole(c.ClientSet.RbacV1(), "cluster-admin", c.Namespace.Name, rbacv1.Subject{
180+
err = frameworkauth.BindClusterRole(context.TODO(), c.ClientSet.RbacV1(), "cluster-admin", c.Namespace.Name, rbacv1.Subject{
185181
Kind: rbacv1.ServiceAccountKind,
186182
Name: c.controllerServiceAccount.Name,
187183
Namespace: c.controllerServiceAccount.Namespace,

e2e/framework/logging.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"time"
66

77
"github.com/onsi/ginkgo/v2"
8-
"k8s.io/kubernetes/test/e2e/framework/ginkgowrapper"
8+
"k8s.io/kubernetes/test/e2e/framework"
99
)
1010

1111
// Logf logs the info.
@@ -35,7 +35,7 @@ func Failf(format string, args ...interface{}) {
3535
func FailfWithOffset(offset int, format string, args ...interface{}) {
3636
msg := fmt.Sprintf(format, args...)
3737
Logf("FAIL", msg)
38-
ginkgowrapper.Fail(nowStamp()+": "+msg, 1+offset)
38+
framework.Fail(nowStamp()+": "+msg, 1+offset)
3939
}
4040

4141
func nowStamp() string {

e2e/suite/channel_resolve_test.go

+21-21
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import (
55
"net/http"
66
"net/http/httptest"
77

8-
. "github.com/onsi/ginkgo/v2"
9-
. "github.com/onsi/gomega"
8+
"github.com/onsi/ginkgo/v2"
9+
"github.com/onsi/gomega"
1010
"github.com/rancher/system-upgrade-controller/e2e/framework"
1111
upgradeapiv1 "github.com/rancher/system-upgrade-controller/pkg/apis/upgrade.cattle.io/v1"
1212
upgradeplan "github.com/rancher/system-upgrade-controller/pkg/upgrade/plan"
1313
)
1414

15-
var _ = Describe("Resolve channel", func() {
15+
var _ = ginkgo.Describe("Resolve channel", func() {
1616
e2e := framework.New("channel")
1717

18-
When("passed url fails to resolve", func() {
18+
ginkgo.When("passed url fails to resolve", func() {
1919
var (
2020
err error
2121
plan *upgradeapiv1.Plan
@@ -25,45 +25,45 @@ var _ = Describe("Resolve channel", func() {
2525
clusterID string
2626
latest string
2727
)
28-
BeforeEach(func() {
28+
ginkgo.BeforeEach(func() {
2929
ctx, cancel = context.WithCancel(context.Background())
3030
plan = e2e.NewPlan("channel-", "", nil)
3131
})
32-
AfterEach(func() {
32+
ginkgo.AfterEach(func() {
3333
if channelSrv != nil {
3434
channelSrv.Close()
3535
}
3636
cancel()
3737
})
38-
It("channel server is up with correct address", func() {
38+
ginkgo.It("channel server is up with correct address", func() {
3939
channelSrv = framework.ChannelServer("/local", http.StatusFound)
4040
plan.Spec.Channel = channelSrv.URL
41-
Expect(plan.Spec.Channel).ToNot(BeEmpty())
41+
gomega.Expect(plan.Spec.Channel).ToNot(gomega.BeEmpty())
4242
plan, err = e2e.CreatePlan(plan)
43-
Expect(err).ToNot(HaveOccurred())
43+
gomega.Expect(err).ToNot(gomega.HaveOccurred())
4444
latest, err = upgradeplan.ResolveChannel(ctx, plan.Spec.Channel, plan.Status.LatestVersion, clusterID)
45-
Expect(err).ToNot(HaveOccurred())
46-
Expect(latest).NotTo(BeEmpty())
45+
gomega.Expect(err).ToNot(gomega.HaveOccurred())
46+
gomega.Expect(latest).NotTo(gomega.BeEmpty())
4747
})
48-
It("channel server is up but url not found", func() {
48+
ginkgo.It("channel server is up but url not found", func() {
4949
channelSrv = framework.ChannelServer("/local", http.StatusNotFound)
5050
plan.Spec.Channel = channelSrv.URL
51-
Expect(plan.Spec.Channel).ToNot(BeEmpty())
51+
gomega.Expect(plan.Spec.Channel).ToNot(gomega.BeEmpty())
5252
plan, err = e2e.CreatePlan(plan)
53-
Expect(err).ToNot(HaveOccurred())
53+
gomega.Expect(err).ToNot(gomega.HaveOccurred())
5454
latest, err = upgradeplan.ResolveChannel(ctx, plan.Spec.Channel, plan.Status.LatestVersion, clusterID)
55-
Expect(err).To(HaveOccurred())
56-
Expect(latest).To(BeEmpty())
55+
gomega.Expect(err).To(gomega.HaveOccurred())
56+
gomega.Expect(latest).To(gomega.BeEmpty())
5757
})
58-
It("Service Unavailable", func() {
58+
ginkgo.It("Service Unavailable", func() {
5959
channelSrv = framework.ChannelServer("/local", http.StatusServiceUnavailable)
6060
plan.Spec.Channel = channelSrv.URL
61-
Expect(plan.Spec.Channel).ToNot(BeEmpty())
61+
gomega.Expect(plan.Spec.Channel).ToNot(gomega.BeEmpty())
6262
plan, err = e2e.CreatePlan(plan)
63-
Expect(err).ToNot(HaveOccurred())
63+
gomega.Expect(err).ToNot(gomega.HaveOccurred())
6464
latest, err = upgradeplan.ResolveChannel(ctx, plan.Spec.Channel, plan.Status.LatestVersion, clusterID)
65-
Expect(err).To(HaveOccurred())
66-
Expect(latest).To(BeEmpty())
65+
gomega.Expect(err).To(gomega.HaveOccurred())
66+
gomega.Expect(latest).To(gomega.BeEmpty())
6767
})
6868
})
6969
})

0 commit comments

Comments
 (0)