From 09b517f82762208a7a24db84365386ccb8be1009 Mon Sep 17 00:00:00 2001 From: Gianluca Mardente Date: Sat, 13 Jun 2026 16:08:09 +0200 Subject: [PATCH] (chore) Prepare for release v1.11.1 --- .github/workflows/main.yaml | 8 ++-- .golangci.yaml | 12 +++--- Dockerfile | 2 +- Makefile | 8 ++-- config/default/manager_image_patch.yaml | 2 +- controllers/utils_test.go | 14 ++++--- go.mod | 22 +++++------ go.sum | 40 +++++++++---------- hack/tools/get-golangci-lint.sh | 22 ++++++++++- hack/tools/go.mod | 20 +++++----- hack/tools/go.sum | 40 +++++++++---------- manifest/manifest.yaml | 2 +- test/fv/clusterprofile_test.go | 12 +++--- test/fv/fv_suite_test.go | 52 ++++++++++++++++--------- 14 files changed, 145 insertions(+), 111 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index a34d212..37747ac 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -18,7 +18,7 @@ jobs: - name: Set up Go uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: - go-version: 1.26.3 + go-version: 1.26.4 - name: Build run: make build - name: FMT @@ -37,7 +37,7 @@ jobs: - name: Set up Go uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: - go-version: 1.26.3 + go-version: 1.26.4 - name: ut run: make test env: @@ -50,7 +50,7 @@ jobs: - name: Set up Go uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: - go-version: 1.26.3 + go-version: 1.26.4 - name: fv run: make create-cluster fv env: @@ -63,7 +63,7 @@ jobs: - name: Set up Go uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: - go-version: 1.26.3 + go-version: 1.26.4 - name: fv run: make create-cluster-fv fv-exec-plugin env: diff --git a/.golangci.yaml b/.golangci.yaml index a7f8c71..585e559 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -20,7 +20,7 @@ linters: - goconst - gocritic - gocyclo - - gomodguard + - gomodguard_v2 - goprintffuncname - gosec - govet @@ -72,12 +72,10 @@ linters: - style gocyclo: min-complexity: 20 - gomodguard: + gomodguard_v2: blocked: - modules: - - k8s.io/kubernetes: - reason: There is no good, avoidable reason to use this package and often leads to issues such as https://bit.ly/3dlKScY. However, if you disagree please include @ravchama in code review highlighting the reason. - local-replace-directives: true + - module: k8s.io/kubernetes + local-replace-directives: true govet: settings: printf: @@ -132,6 +130,7 @@ linters: - third_party$ - builtin$ - examples$ + - internal/test/helpers issues: max-issues-per-linter: 0 max-same-issues: 0 @@ -149,3 +148,4 @@ formatters: - third_party$ - builtin$ - examples$ + - internal/test/helpers diff --git a/Dockerfile b/Dockerfile index bc4461d..1223f9b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM golang:1.26.3 AS builder +FROM golang:1.26.4 AS builder ARG BUILDOS ARG TARGETARCH diff --git a/Makefile b/Makefile index cccfc38..fce1a6f 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Image URL to use all building/pushing image targets IMG ?= controller:latest # KUBEBUILDER_ENVTEST_KUBERNETES_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. -KUBEBUILDER_ENVTEST_KUBERNETES_VERSION = 1.35.0 +KUBEBUILDER_ENVTEST_KUBERNETES_VERSION = 1.36.0 # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) @@ -34,7 +34,7 @@ ARCH ?= amd64 OS ?= $(shell uname -s | tr A-Z a-z) K8S_LATEST_VER ?= $(shell curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt) export CONTROLLER_IMG ?= $(REGISTRY)/$(IMAGE_NAME) -TAG ?= main +TAG ?= v1.11.1 ## Tool Binaries CONTROLLER_GEN := $(TOOLS_BIN_DIR)/controller-gen @@ -49,7 +49,7 @@ SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest KIND := $(TOOLS_BIN_DIR)/kind KUBECTL := $(TOOLS_BIN_DIR)/kubectl -GOLANGCI_LINT_VERSION := "v2.11.4" +GOLANGCI_LINT_VERSION := "v2.12.1" KUSTOMIZE_VER := v5.8.0 KUSTOMIZE_BIN := kustomize @@ -136,7 +136,7 @@ endif # K8S_VERSION for the Kind cluster can be set as environment variable. If not defined, # this default value is used ifndef K8S_VERSION -K8S_VERSION := v1.35.0 +K8S_VERSION := v1.36.1 endif KIND_CONFIG ?= kind-cluster.yaml diff --git a/config/default/manager_image_patch.yaml b/config/default/manager_image_patch.yaml index ec513a5..d404ba8 100644 --- a/config/default/manager_image_patch.yaml +++ b/config/default/manager_image_patch.yaml @@ -8,5 +8,5 @@ spec: spec: containers: # Change the value of image field below to your controller image URL - - image: docker.io/projectsveltos/clusterinventory-controller:main + - image: docker.io/projectsveltos/clusterinventory-controller:v1.11.1 name: manager diff --git a/controllers/utils_test.go b/controllers/utils_test.go index 0e1ab6c..525c352 100644 --- a/controllers/utils_test.go +++ b/controllers/utils_test.go @@ -44,6 +44,8 @@ const ( secretReaderKeyField = "key" // srcSecretKey is the key name used in source Secrets in tests. srcSecretKey = "kubeconfig" + labelKeyEnv = "env" + labelEnvProd = "prod" ) var _ = Describe("Utils", func() { @@ -240,7 +242,7 @@ var _ = Describe("Utils", func() { It("copies ClusterProfile labels onto the SveltosCluster at creation", func() { cpName := randomString() cp := buildClusterProfile(cpName, namespace, "", nil) - cp.Labels = map[string]string{"env": "prod", "region": "us-east-1"} + cp.Labels = map[string]string{labelKeyEnv: labelEnvProd, "region": "us-east-1"} Expect(controller.ReconcileSveltosCluster(context.TODO(), testEnv.Client, cp, logger)).To(Succeed()) @@ -249,7 +251,7 @@ var _ = Describe("Utils", func() { return testEnv.Get(context.TODO(), types.NamespacedName{Namespace: namespace, Name: cpName}, sc) }, timeout, pollingInterval).Should(Succeed()) - Expect(sc.Labels["env"]).To(Equal("prod")) + Expect(sc.Labels[labelKeyEnv]).To(Equal(labelEnvProd)) Expect(sc.Labels["region"]).To(Equal("us-east-1")) Expect(sc.Labels[controller.ManagedByLabel]).To(Equal(controller.ManagedByValue)) }) @@ -257,14 +259,14 @@ var _ = Describe("Utils", func() { It("updates SveltosCluster labels when ClusterProfile labels change", func() { cpName := randomString() cp := buildClusterProfile(cpName, namespace, "", nil) - cp.Labels = map[string]string{"env": "staging"} + cp.Labels = map[string]string{labelKeyEnv: "staging"} Expect(controller.ReconcileSveltosCluster(context.TODO(), testEnv.Client, cp, logger)).To(Succeed()) Expect(waitForObject(context.TODO(), testEnv.Client, &libsveltosv1beta1.SveltosCluster{ ObjectMeta: metav1.ObjectMeta{Name: cpName, Namespace: namespace}, })).To(Succeed()) - cp.Labels = map[string]string{"env": "prod"} + cp.Labels = map[string]string{labelKeyEnv: labelEnvProd} Expect(controller.ReconcileSveltosCluster(context.TODO(), testEnv.Client, cp, logger)).To(Succeed()) sc := &libsveltosv1beta1.SveltosCluster{} @@ -273,8 +275,8 @@ var _ = Describe("Utils", func() { types.NamespacedName{Namespace: namespace, Name: cpName}, sc); err != nil { return "" } - return sc.Labels["env"] - }, timeout, pollingInterval).Should(Equal("prod")) + return sc.Labels[labelKeyEnv] + }, timeout, pollingInterval).Should(Equal(labelEnvProd)) }) It("is idempotent on repeated calls", func() { diff --git a/go.mod b/go.mod index f517a28..8644a73 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,13 @@ module github.com/projectsveltos/clusterinventory-controller -go 1.26.3 +go 1.26.4 require ( github.com/TwiN/go-color v1.4.1 github.com/go-logr/logr v1.4.3 - github.com/onsi/ginkgo/v2 v2.29.0 + github.com/onsi/ginkgo/v2 v2.30.0 github.com/onsi/gomega v1.41.0 - github.com/projectsveltos/libsveltos v1.10.1-0.20260521153750-a1f348424b3f + github.com/projectsveltos/libsveltos v1.11.1 github.com/spf13/pflag v1.0.10 k8s.io/api v0.36.1 k8s.io/apiextensions-apiserver v0.36.1 @@ -17,7 +17,7 @@ require ( k8s.io/klog/v2 v2.140.0 k8s.io/utils v0.0.0-20260507154919-ff6756f316d2 sigs.k8s.io/cluster-api v1.13.2 - sigs.k8s.io/cluster-inventory-api v0.1.2 + sigs.k8s.io/cluster-inventory-api v0.1.3 sigs.k8s.io/controller-runtime v0.24.1 sigs.k8s.io/yaml v1.6.0 ) @@ -83,15 +83,15 @@ require ( go.yaml.in/yaml/v2 v2.4.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 // indirect - golang.org/x/mod v0.35.0 // indirect - golang.org/x/net v0.53.0 // indirect + golang.org/x/mod v0.36.0 // indirect + golang.org/x/net v0.54.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect - golang.org/x/sync v0.20.0 // indirect - golang.org/x/sys v0.43.0 // indirect - golang.org/x/term v0.42.0 // indirect - golang.org/x/text v0.37.0 // indirect + golang.org/x/sync v0.21.0 // indirect + golang.org/x/sys v0.44.0 // indirect + golang.org/x/term v0.43.0 // indirect + golang.org/x/text v0.38.0 // indirect golang.org/x/time v0.15.0 // indirect - golang.org/x/tools v0.44.0 // indirect + golang.org/x/tools v0.45.0 // indirect gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 // indirect diff --git a/go.sum b/go.sum index a6bb773..f56c62f 100644 --- a/go.sum +++ b/go.sum @@ -127,8 +127,8 @@ github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFd github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/onsi/ginkgo/v2 v2.29.0 h1:rfh+ZFjgJhYWRoIqVf3Uwx/W20yLrcrE2h2GmYVRaag= -github.com/onsi/ginkgo/v2 v2.29.0/go.mod h1:+aXOY+vzZ5mu2iI2HpTZUPmM//oQfsNFX6gU9kNcA44= +github.com/onsi/ginkgo/v2 v2.30.0 h1:zxM/9XneXFIy64j6/wAmBIX4zRC7Hu6U8XFNZvDnCQc= +github.com/onsi/ginkgo/v2 v2.30.0/go.mod h1:+aXOY+vzZ5mu2iI2HpTZUPmM//oQfsNFX6gU9kNcA44= github.com/onsi/gomega v1.41.0 h1:OwKp4pXNgVxf6sCplzYo794OFNuoL2q2SBMU5NSWOjA= github.com/onsi/gomega v1.41.0/go.mod h1:M/Uqpu/8qTjtzCLUA2zJHX9Iilrau25x1PdoSRbWh5A= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -136,8 +136,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/projectsveltos/libsveltos v1.10.1-0.20260521153750-a1f348424b3f h1:XrgpnRRH59AwSkSEIcKPUDpAME0Sl4sXLeEhDIaYQMU= -github.com/projectsveltos/libsveltos v1.10.1-0.20260521153750-a1f348424b3f/go.mod h1:AzKBiyMTL3KSTLYMii5QdR3ieWyUKBHZCMFWIVCfm6A= +github.com/projectsveltos/libsveltos v1.11.1 h1:7Hjs7+6MEYgPzLjeYZkaRFZVPg1hJqOxml477Q6n23o= +github.com/projectsveltos/libsveltos v1.11.1/go.mod h1:B9tm32CB/AKIqmy/J02NmIUiwatec3NR1RcW5W/v0UM= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= @@ -202,24 +202,24 @@ go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 h1:fQsdNF2N+/YewlRZiricy4P1iimyPKZ/xwniHj8Q2a0= golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93/go.mod h1:EPRbTFwzwjXj9NpYyyrvenVh9Y+GFeEvMNh7Xuz7xgU= -golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM= -golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU= -golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= -golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= +golang.org/x/mod v0.36.0 h1:JJjpVx6myfUsUdAzZuOSTTmRE0PfZeNWzzvKrP7amb4= +golang.org/x/mod v0.36.0/go.mod h1:moc6ELqsWcOw5Ef3xVprK5ul/MvtVvkIXLziUOICjUQ= +golang.org/x/net v0.54.0 h1:2zJIZAxAHV/OHCDTCOHAYehQzLfSXuf/5SoL/Dv6w/w= +golang.org/x/net v0.54.0/go.mod h1:Sj4oj8jK6XmHpBZU/zWHw3BV3abl4Kvi+Ut7cQcY+cQ= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= -golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= -golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= -golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= -golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY= -golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY= -golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc= -golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38= +golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM= +golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sys v0.44.0 h1:ildZl3J4uzeKP07r2F++Op7E9B29JRUy+a27EibtBTQ= +golang.org/x/sys v0.44.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/term v0.43.0 h1:S4RLU2sB31O/NCl+zFN9Aru9A/Cq2aqKpTZJ6B+DwT4= +golang.org/x/term v0.43.0/go.mod h1:lrhlHNdQJHO+1qVYiHfFKVuVioJIheAc3fBSMFYEIsk= +golang.org/x/text v0.38.0 h1:sXmwo9DwP3OK9EZ7PqAdaooSGozfl/3a6/xJcbzPRhE= +golang.org/x/text v0.38.0/go.mod h1:YXZt3QhHUKYT53r2lLKFIVi6Ao1jdzrTR/KQ09qyxF4= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= -golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c= -golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI= +golang.org/x/tools v0.45.0 h1:18qN3FAooORvApf5XjCXgsuayZOEtXf6JK18I3+ONa8= +golang.org/x/tools v0.45.0/go.mod h1:LuUGqqaXcXMEFEruIVJVm5mgDD8vww/z/SR1gQ4uE/0= gomodules.xyz/jsonpatch/v2 v2.5.0 h1:JELs8RLM12qJGXU4u/TO3V25KW8GreMKl9pdkk14RM0= gomodules.xyz/jsonpatch/v2 v2.5.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= @@ -265,8 +265,8 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 h1:hSfpvjjTQXQY2 sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= sigs.k8s.io/cluster-api v1.13.2 h1:NVdbVLmh6IyfdtENQAi80AijJf/FjfQLODz/6caDjlc= sigs.k8s.io/cluster-api v1.13.2/go.mod h1:h7cyiUh+N7sIBkSerqU8cDkYMtRlXVO1c5RoJE1p5+g= -sigs.k8s.io/cluster-inventory-api v0.1.2 h1:rH8Xh6NW5u0WXarjDJeYLSrCLQkwJnSUnyb74eyAXFY= -sigs.k8s.io/cluster-inventory-api v0.1.2/go.mod h1:7J3M6srZ1I4snZR+p5zxgEBdXnia3tlHo5ODMHJpEUk= +sigs.k8s.io/cluster-inventory-api v0.1.3 h1:E7GY85hOIIPdALNdTO9Cbs2PXqjotWq6afe/NTwgCJo= +sigs.k8s.io/cluster-inventory-api v0.1.3/go.mod h1:7J3M6srZ1I4snZR+p5zxgEBdXnia3tlHo5ODMHJpEUk= sigs.k8s.io/controller-runtime v0.24.1 h1:miPEwrmirImAvgME1L9qebGHrOnGJoVmVdtOU9fRfo4= sigs.k8s.io/controller-runtime v0.24.1/go.mod h1:vFkfY5fGt5xAC/sKb8IBFKgWPNKG9OUG29dR8Y2wImw= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= diff --git a/hack/tools/get-golangci-lint.sh b/hack/tools/get-golangci-lint.sh index e67d4e5..d753eb8 100755 --- a/hack/tools/get-golangci-lint.sh +++ b/hack/tools/get-golangci-lint.sh @@ -2,5 +2,23 @@ set -euo pipefail -# Define the URL for downloading the golangci-lint archive -curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(pwd)/bin "$1" +VERSION="$1" +BINARY="$(pwd)/bin/golangci-lint" + +# Skip download if the binary already exists at the requested version. +if [[ -x "$BINARY" ]] && "$BINARY" --version 2>/dev/null | grep -qF "${VERSION#v}"; then + echo "golangci-lint ${VERSION} already installed, skipping download" + exit 0 +fi + +# Retry up to 3 times — the GitHub CDN occasionally returns 504. +for attempt in 1 2 3; do + if curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b "$(pwd)/bin" "$VERSION"; then + exit 0 + fi + echo "golangci-lint download attempt ${attempt} failed, retrying..." >&2 + sleep $((attempt * 5)) +done + +echo "golangci-lint download failed after 3 attempts" >&2 +exit 1 diff --git a/hack/tools/go.mod b/hack/tools/go.mod index 750d9f4..f5e761a 100644 --- a/hack/tools/go.mod +++ b/hack/tools/go.mod @@ -1,13 +1,13 @@ module github.com/projectsveltos/clusterinventory-controller/hack/tools -go 1.26.3 +go 1.26.4 require ( github.com/a8m/envsubst v1.4.3 - github.com/onsi/ginkgo/v2 v2.29.0 - golang.org/x/tools v0.45.0 + github.com/onsi/ginkgo/v2 v2.30.0 + golang.org/x/tools v0.46.0 sigs.k8s.io/controller-tools v0.21.0 - sigs.k8s.io/kind v0.31.0 + sigs.k8s.io/kind v0.32.0 ) require ( @@ -49,12 +49,12 @@ require ( github.com/x448/float16 v0.8.4 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect - golang.org/x/mod v0.36.0 // indirect - golang.org/x/net v0.54.0 // indirect - golang.org/x/sync v0.20.0 // indirect - golang.org/x/sys v0.44.0 // indirect - golang.org/x/telemetry v0.0.0-20260508192327-42602be52be6 // indirect - golang.org/x/text v0.37.0 // indirect + golang.org/x/mod v0.37.0 // indirect + golang.org/x/net v0.56.0 // indirect + golang.org/x/sync v0.21.0 // indirect + golang.org/x/sys v0.46.0 // indirect + golang.org/x/telemetry v0.0.0-20260610154732-fb80ec83bdd9 // indirect + golang.org/x/text v0.38.0 // indirect google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/hack/tools/go.sum b/hack/tools/go.sum index 29ad2b7..996867f 100644 --- a/hack/tools/go.sum +++ b/hack/tools/go.sum @@ -129,8 +129,8 @@ github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.29.0 h1:rfh+ZFjgJhYWRoIqVf3Uwx/W20yLrcrE2h2GmYVRaag= -github.com/onsi/ginkgo/v2 v2.29.0/go.mod h1:+aXOY+vzZ5mu2iI2HpTZUPmM//oQfsNFX6gU9kNcA44= +github.com/onsi/ginkgo/v2 v2.30.0 h1:zxM/9XneXFIy64j6/wAmBIX4zRC7Hu6U8XFNZvDnCQc= +github.com/onsi/ginkgo/v2 v2.30.0/go.mod h1:+aXOY+vzZ5mu2iI2HpTZUPmM//oQfsNFX6gU9kNcA44= github.com/onsi/gomega v1.40.0 h1:Vtol0e1MghCD2ZVIilPDIg44XSL9l2QAn8ZNaljWcJc= github.com/onsi/gomega v1.40.0/go.mod h1:M/Uqpu/8qTjtzCLUA2zJHX9Iilrau25x1PdoSRbWh5A= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= @@ -202,27 +202,27 @@ go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 h1:fQsdNF2N+/YewlRZiricy4P1iimyPKZ/xwniHj8Q2a0= golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93/go.mod h1:EPRbTFwzwjXj9NpYyyrvenVh9Y+GFeEvMNh7Xuz7xgU= -golang.org/x/mod v0.36.0 h1:JJjpVx6myfUsUdAzZuOSTTmRE0PfZeNWzzvKrP7amb4= -golang.org/x/mod v0.36.0/go.mod h1:moc6ELqsWcOw5Ef3xVprK5ul/MvtVvkIXLziUOICjUQ= -golang.org/x/net v0.54.0 h1:2zJIZAxAHV/OHCDTCOHAYehQzLfSXuf/5SoL/Dv6w/w= -golang.org/x/net v0.54.0/go.mod h1:Sj4oj8jK6XmHpBZU/zWHw3BV3abl4Kvi+Ut7cQcY+cQ= +golang.org/x/mod v0.37.0 h1:vF1DjpVEshcIqoEaauuHebaLk1O1forxjxBaVn884JQ= +golang.org/x/mod v0.37.0/go.mod h1:m8S8VeM9r4dzDwjrKO0a1sZP3YjeMamRRlD+fmR2Q/0= +golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o= +golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= -golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= -golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM= +golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.44.0 h1:ildZl3J4uzeKP07r2F++Op7E9B29JRUy+a27EibtBTQ= -golang.org/x/sys v0.44.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/telemetry v0.0.0-20260508192327-42602be52be6 h1:HjU6IWBiAgRIdAJ9/y1rwCn+UELEmwV+VsTLzj/W4sE= -golang.org/x/telemetry v0.0.0-20260508192327-42602be52be6/go.mod h1:Eqhaxk/wZsWEH8CRxLwj6xzEJbz7k1EFGqx7nyCoabE= -golang.org/x/term v0.43.0 h1:S4RLU2sB31O/NCl+zFN9Aru9A/Cq2aqKpTZJ6B+DwT4= -golang.org/x/term v0.43.0/go.mod h1:lrhlHNdQJHO+1qVYiHfFKVuVioJIheAc3fBSMFYEIsk= -golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc= -golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38= +golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw= +golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/telemetry v0.0.0-20260610154732-fb80ec83bdd9 h1:FjUup8XrRy7lv+XHONi6KKUSizeF2NnVrTnz/HhbohQ= +golang.org/x/telemetry v0.0.0-20260610154732-fb80ec83bdd9/go.mod h1:3AWMyWHS+caVoiEXpiq6+tzKA40J4vQT3MYr80ZtQpc= +golang.org/x/term v0.44.0 h1:0rLvDRCtNj0gZkyIXhCyOb2OAzEhLVqc4B+hrsBhrmc= +golang.org/x/term v0.44.0/go.mod h1:7ze4MdzUzLXpSAoFP1H0bOI9aXDqveSvatT5vKcFh2Y= +golang.org/x/text v0.38.0 h1:sXmwo9DwP3OK9EZ7PqAdaooSGozfl/3a6/xJcbzPRhE= +golang.org/x/text v0.38.0/go.mod h1:YXZt3QhHUKYT53r2lLKFIVi6Ao1jdzrTR/KQ09qyxF4= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= -golang.org/x/tools v0.45.0 h1:18qN3FAooORvApf5XjCXgsuayZOEtXf6JK18I3+ONa8= -golang.org/x/tools v0.45.0/go.mod h1:LuUGqqaXcXMEFEruIVJVm5mgDD8vww/z/SR1gQ4uE/0= +golang.org/x/tools v0.46.0 h1:7jTurBkPZu4moS/Uy4OQT1M+QBlsj3wejyZwsT8Z7rk= +golang.org/x/tools v0.46.0/go.mod h1:FrD85F8l+NWL+9XWBSyVSHO6Ne4jutsfIFba7AWQ5Ys= golang.org/x/tools/go/expect v0.1.1-deprecated h1:jpBZDwmgPhXsKZC6WhL20P4b/wmnpsEAGHaNy0n/rJM= golang.org/x/tools/go/expect v0.1.1-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY= golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated h1:1h2MnaIAIXISqTFKdENegdpAgUXz6NrPEsbIeWaBRvM= @@ -275,8 +275,8 @@ sigs.k8s.io/controller-tools v0.21.0 h1:KXDQza3bgjlPY6xLR63tI/40gzjhyUAvkCrwzd2/ sigs.k8s.io/controller-tools v0.21.0/go.mod h1:DLIypi3Q2+azVAP8jr/mHXJgveYYHFjhnNOUuBJ10JE= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= -sigs.k8s.io/kind v0.31.0 h1:UcT4nzm+YM7YEbqiAKECk+b6dsvc/HRZZu9U0FolL1g= -sigs.k8s.io/kind v0.31.0/go.mod h1:FSqriGaoTPruiXWfRnUXNykF8r2t+fHtK0P0m1AbGF8= +sigs.k8s.io/kind v0.32.0 h1:p9hscbj98u/qyrjVpjId86LI70nQmbSsipV7wCG10Xk= +sigs.k8s.io/kind v0.32.0/go.mod h1:FSqriGaoTPruiXWfRnUXNykF8r2t+fHtK0P0m1AbGF8= sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= sigs.k8s.io/structured-merge-diff/v6 v6.4.0 h1:qmp2e3ZfFi1/jJbDGpD4mt3wyp6PE1NfKHCYLqgNQJo= diff --git a/manifest/manifest.yaml b/manifest/manifest.yaml index 18a9531..6552fc5 100644 --- a/manifest/manifest.yaml +++ b/manifest/manifest.yaml @@ -154,7 +154,7 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace - image: docker.io/projectsveltos/clusterinventory-controller:main + image: docker.io/projectsveltos/clusterinventory-controller:v1.11.1 livenessProbe: failureThreshold: 3 httpGet: diff --git a/test/fv/clusterprofile_test.go b/test/fv/clusterprofile_test.go index af9a848..6ca49e1 100644 --- a/test/fv/clusterprofile_test.go +++ b/test/fv/clusterprofile_test.go @@ -84,7 +84,7 @@ var _ = Describe("ClusterProfile controller", Label("FV"), func() { Byf("Creating ClusterProfile %s/%s with kubeconfig-secretreader provider and initial labels", namespace, cpName) cp := buildFvClusterProfile(cpName, namespace) - cp.Labels = map[string]string{"env": "staging"} + cp.Labels = map[string]string{keyEnv: "staging"} Expect(k8sClient.Create(context.TODO(), cp)).To(Succeed()) err := retry.RetryOnConflict(retry.DefaultRetry, func() error { @@ -117,7 +117,7 @@ var _ = Describe("ClusterProfile controller", Label("FV"), func() { Expect(sc.Spec.KubeconfigKeyName).To(Equal("kubeconfig")) Byf("Verifying SveltosCluster has labels copied from ClusterProfile") - Expect(sc.Labels["env"]).To(Equal("staging")) + Expect(sc.Labels[keyEnv]).To(Equal("staging")) Byf("Waiting for SveltosCluster %s/%s to be ready", namespace, cpName) Eventually(func() bool { @@ -151,7 +151,7 @@ var _ = Describe("ClusterProfile controller", Label("FV"), func() { // The controller predicate returns true when labels change. Expect(k8sClient.Get(context.TODO(), types.NamespacedName{Namespace: namespace, Name: cpName}, cp)).To(Succeed()) - cp.Labels["env"] = "prod" + cp.Labels[keyEnv] = keyEnvProd Expect(k8sClient.Update(context.TODO(), cp)).To(Succeed()) Eventually(func() bool { @@ -170,8 +170,8 @@ var _ = Describe("ClusterProfile controller", Label("FV"), func() { types.NamespacedName{Namespace: namespace, Name: cpName}, current); err != nil { return "" } - return current.Labels["env"] - }, timeout, pollingInterval).Should(Equal("prod")) + return current.Labels[keyEnv] + }, timeout, pollingInterval).Should(Equal(keyEnvProd)) Byf("Deleting ClusterProfile and verifying SveltosCluster and managed Secret are removed") Expect(k8sClient.Get(context.TODO(), @@ -208,7 +208,7 @@ func buildFvClusterProfile(name, namespace string) *clusterinventoryv1alpha1.Clu func buildFvAccessProviderStatus(secretName, secretKey, namespace string) clusterinventoryv1alpha1.ClusterProfileStatus { extPayload := map[string]string{ - "name": secretName, + keyName: secretName, "key": secretKey, "namespace": namespace, } diff --git a/test/fv/fv_suite_test.go b/test/fv/fv_suite_test.go index cac3e65..a9bcafc 100644 --- a/test/fv/fv_suite_test.go +++ b/test/fv/fv_suite_test.go @@ -88,6 +88,20 @@ const ( workloadClusterSAName = "clusterinventory-fv-workload" workloadClusterSANamespace = "kube-system" + + execPluginBinaryVolume = "exec-plugin-binary" + execPluginProviderVolume = "exec-plugin-provider" + execPluginTokenVolume = "exec-plugin-token" //nolint:gosec // not a credential, just a volume name + + providerJSONKey = "provider.json" + tokenKey = "token" + rbacKindClusterRole = "ClusterRole" + rbacKindServiceAccount = "ServiceAccount" + rbacAPIGroup = "rbac.authorization.k8s.io" + clusterAdminRole = "cluster-admin" + keyName = "name" + keyEnv = "env" + keyEnvProd = "prod" ) func TestFv(t *testing.T) { @@ -189,11 +203,11 @@ func setupExecPluginInfrastructure(ctx context.Context, mgmtCfg, workloadCfg *re // 3. Create objects in the management cluster. if err := createOrUpdateConfigMap(ctx, execPluginProviderConfigMap, controllerDeploymentNamespace, - map[string]string{"provider.json": string(providerJSON)}, nil); err != nil { + map[string]string{providerJSONKey: string(providerJSON)}, nil); err != nil { return fmt.Errorf("creating provider ConfigMap: %w", err) } if err := createOrUpdateSecret(ctx, execPluginTokenSecret, controllerDeploymentNamespace, - map[string][]byte{"token": []byte(token)}); err != nil { + map[string][]byte{tokenKey: []byte(token)}); err != nil { return fmt.Errorf("creating token Secret: %w", err) } @@ -238,8 +252,8 @@ func buildWorkloadClusterToken(ctx context.Context, cfg *rest.Config) (string, e _, err = clientset.RbacV1().ClusterRoleBindings().Create(ctx, &rbacv1.ClusterRoleBinding{ ObjectMeta: metav1.ObjectMeta{Name: workloadClusterSAName + "-admin"}, - RoleRef: rbacv1.RoleRef{APIGroup: "rbac.authorization.k8s.io", Kind: "ClusterRole", Name: "cluster-admin"}, - Subjects: []rbacv1.Subject{{Kind: "ServiceAccount", Name: workloadClusterSAName, Namespace: workloadClusterSANamespace}}, + RoleRef: rbacv1.RoleRef{APIGroup: rbacAPIGroup, Kind: rbacKindClusterRole, Name: clusterAdminRole}, + Subjects: []rbacv1.Subject{{Kind: rbacKindServiceAccount, Name: workloadClusterSAName, Namespace: workloadClusterSANamespace}}, }, metav1.CreateOptions{}) if err != nil && !apierrors.IsAlreadyExists(err) { return "", fmt.Errorf("creating workload ClusterRoleBinding: %w", err) @@ -260,12 +274,12 @@ func buildProviderJSON() ([]byte, error) { provider := map[string]interface{}{ "providers": []map[string]interface{}{ { - "name": execPluginProviderName, + keyName: execPluginProviderName, "execConfig": map[string]interface{}{ "command": execPluginBinaryPath, "apiVersion": "client.authentication.k8s.io/v1", "args": []string{}, - "env": []interface{}{}, + keyEnv: []interface{}{}, "provideClusterInfo": false, }, }, @@ -325,7 +339,7 @@ func patchControllerDeployment(ctx context.Context) error { deploy.Spec.Template.Spec.Volumes = append(deploy.Spec.Template.Spec.Volumes, corev1.Volume{ // Binary is placed on the kind node by 'make create-cluster-fv' via docker cp. - Name: "exec-plugin-binary", + Name: execPluginBinaryVolume, VolumeSource: corev1.VolumeSource{ HostPath: &corev1.HostPathVolumeSource{ Path: execPluginBinaryPath, @@ -334,7 +348,7 @@ func patchControllerDeployment(ctx context.Context) error { }, }, corev1.Volume{ - Name: "exec-plugin-provider", + Name: execPluginProviderVolume, VolumeSource: corev1.VolumeSource{ ConfigMap: &corev1.ConfigMapVolumeSource{ LocalObjectReference: corev1.LocalObjectReference{Name: execPluginProviderConfigMap}, @@ -342,7 +356,7 @@ func patchControllerDeployment(ctx context.Context) error { }, }, corev1.Volume{ - Name: "exec-plugin-token", + Name: execPluginTokenVolume, VolumeSource: corev1.VolumeSource{ Secret: &corev1.SecretVolumeSource{ SecretName: execPluginTokenSecret, @@ -359,18 +373,18 @@ func patchControllerDeployment(ctx context.Context) error { } c.VolumeMounts = append(c.VolumeMounts, corev1.VolumeMount{ - Name: "exec-plugin-binary", + Name: execPluginBinaryVolume, MountPath: execPluginBinaryPath, }, corev1.VolumeMount{ - Name: "exec-plugin-provider", + Name: execPluginProviderVolume, MountPath: execPluginProviderPath, - SubPath: "provider.json", + SubPath: providerJSONKey, }, corev1.VolumeMount{ - Name: "exec-plugin-token", + Name: execPluginTokenVolume, MountPath: execPluginTokenPath, - SubPath: "token", + SubPath: tokenKey, }, ) c.Args = append(c.Args, "--clusterprofile-provider-file="+execPluginProviderPath) @@ -389,9 +403,9 @@ func restoreControllerDeployment(ctx context.Context) { // Remove our volumes. testVolumeNames := map[string]bool{ - "exec-plugin-binary": true, - "exec-plugin-provider": true, - "exec-plugin-token": true, + execPluginBinaryVolume: true, + execPluginProviderVolume: true, + execPluginTokenVolume: true, } filtered := deploy.Spec.Template.Spec.Volumes[:0] for i := range deploy.Spec.Template.Spec.Volumes { @@ -471,8 +485,8 @@ func buildInClusterKubeconfig(ctx context.Context, cfg *rest.Config) ([]byte, er _, err = clientset.RbacV1().ClusterRoleBindings().Create(ctx, &rbacv1.ClusterRoleBinding{ ObjectMeta: metav1.ObjectMeta{Name: "clusterinventory-fv-admin"}, - RoleRef: rbacv1.RoleRef{APIGroup: "rbac.authorization.k8s.io", Kind: "ClusterRole", Name: "cluster-admin"}, - Subjects: []rbacv1.Subject{{Kind: "ServiceAccount", Name: saName, Namespace: saNamespace}}, + RoleRef: rbacv1.RoleRef{APIGroup: rbacAPIGroup, Kind: rbacKindClusterRole, Name: clusterAdminRole}, + Subjects: []rbacv1.Subject{{Kind: rbacKindServiceAccount, Name: saName, Namespace: saNamespace}}, }, metav1.CreateOptions{}) if err != nil && !apierrors.IsAlreadyExists(err) { return nil, fmt.Errorf("creating clusterrolebinding: %w", err)