diff --git a/.github/workflows/cicd-pull-request.yml b/.github/workflows/cicd-pull-request.yml index c11de4c68..1b01044aa 100644 --- a/.github/workflows/cicd-pull-request.yml +++ b/.github/workflows/cicd-pull-request.yml @@ -7,7 +7,7 @@ on: env: GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} BASE_BRANCH: origin/main - GO_VERSION: "1.24" + GO_VERSION: "1.25" jobs: trigger-mode: @@ -62,7 +62,7 @@ jobs: - name: Install golangci-lint run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.8 + curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.8.0 - name: make module run: | diff --git a/.github/workflows/cicd-push.yml b/.github/workflows/cicd-push.yml index 23265718c..24e57f143 100644 --- a/.github/workflows/cicd-push.yml +++ b/.github/workflows/cicd-push.yml @@ -11,7 +11,7 @@ on: env: GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} BASE_BRANCH: origin/main - GO_VERSION: "1.24" + GO_VERSION: "1.25" jobs: trigger-mode: @@ -139,7 +139,7 @@ jobs: - name: Install golangci-lint run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.8 + curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.8.0 - name: make module run: | diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index ece6d4162..ba170e03a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -8,7 +8,7 @@ on: env: BASE_BRANCH: origin/main - GO_VERSION: "1.24" + GO_VERSION: "1.25" jobs: trigger-mode: diff --git a/.github/workflows/release-kbcli.yml b/.github/workflows/release-kbcli.yml index fd4fd5f67..0d512a64e 100644 --- a/.github/workflows/release-kbcli.yml +++ b/.github/workflows/release-kbcli.yml @@ -9,7 +9,7 @@ env: GH_TOKEN: ${{ github.token }} GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} TAG_NAME: ${{ github.ref_name }} - GO_VERSION: "1.24" + GO_VERSION: "1.25" CLI_NAME: 'kbcli' JIHULAB_KBCLI_PROJECT_ID: 85948 JIHULAB_ACCESS_TOKEN: ${{ secrets.GITLAB_ACCESS_TOKEN }} diff --git a/.golangci.yaml b/.golangci.yaml index 59ada0b79..fd91a56aa 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,52 +1,39 @@ -# options for analysis running +version: "2" run: - # default concurrency is a available CPU number concurrency: 4 - - # timeout for analysis, e.g. 30s, 5m, default is 1m - deadline: 15m - - timeout: 30m - - skip-files: - - "^zz_generated.*" - build-tags: - containers_image_openpgp - -output: - # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" - format: colored-line-number - - # print lines of code with issue, default is true - print-issued-lines: true - - # print linter name in the end of issue text, default is true - print-linter-name: true - -# check available linters @ https://golangci-lint.run/usage/linters/ linters: - disable-all: true - enable: # please keep this alphabetized - # Don't use soon to deprecated[1] linters that lead to false - # https://github.com/golangci/golangci-lint/issues/1841 - # - deadcode - # - gocyclo - # - loggercheck # requires golangci-lint@v1.49.0 - # - structcheck - # - varcheck + default: none + enable: - errcheck - gocritic - # - goconst - - goimports - - gofmt # We enable this as well as goimports for its simplify mode. - govet - ineffassign - - typecheck - misspell - nakedret - unconvert - -linters-settings: - errcheck: - check-blank: false # to keep `_ = viper.BindPFlag(...)` from throwing errors + settings: + errcheck: + check-blank: false + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gofmt + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/Makefile b/Makefile index 91fb48222..32b035271 100644 --- a/Makefile +++ b/Makefile @@ -131,7 +131,7 @@ mod-download: ## Run go mod download against go modules. .PHONY: module module: ## Run go mod tidy->verify against go modules. - $(GO) mod tidy -compat=1.24 + $(GO) mod tidy -compat=1.25 $(GO) mod verify TEST_PACKAGES ?= ./pkg/... ./cmd/... @@ -257,16 +257,19 @@ install-docker-buildx: ## Create `docker buildx` builder. fi .PHONY: golangci -golangci: GOLANGCILINT_VERSION = v1.64.8 +golangci: GOLANGCILINT_VERSION = v2.8.0 golangci: ## Download golangci-lint locally if necessary. -ifneq ($(shell which golangci-lint),) +ifeq ($(shell golangci-lint version >/dev/null 2>&1 && echo ok),ok) @echo golangci-lint is already installed GOLANGCILINT=$(shell which golangci-lint) else ifeq (, $(shell which $(GOBIN)/golangci-lint)) @{ \ set -e ;\ echo 'installing golangci-lint-$(GOLANGCILINT_VERSION)' ;\ - curl -sSfL $(GITHUB_PROXY)https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) $(GOLANGCILINT_VERSION) ;\ + tmpfile=$$(mktemp) ;\ + trap 'rm -f "$$tmpfile"' EXIT ;\ + curl -sSfL https://golangci-lint.run/install.sh -o "$$tmpfile" ;\ + sh "$$tmpfile" -b $(GOBIN) $(GOLANGCILINT_VERSION) ;\ echo 'Successfully installed' ;\ } GOLANGCILINT=$(GOBIN)/golangci-lint diff --git a/addons b/addons index e381e3de9..44253ddb7 160000 --- a/addons +++ b/addons @@ -1 +1 @@ -Subproject commit e381e3de9cac5d07f7e24ce57dfbc1e86a607503 +Subproject commit 44253ddb73ab9dac23b6eef71db5f4929a6eaab1 diff --git a/docs/user_docs/cli/kbcli_cluster_create_mongodb.md b/docs/user_docs/cli/kbcli_cluster_create_mongodb.md index 48f226bbe..948081f4a 100644 --- a/docs/user_docs/cli/kbcli_cluster_create_mongodb.md +++ b/docs/user_docs/cli/kbcli_cluster_create_mongodb.md @@ -40,7 +40,6 @@ kbcli cluster create mongodb NAME [flags] --termination-policy string The termination policy of cluster. Legal values [DoNotTerminate, Delete, WipeOut]. (default "Delete") --tolerations strings Tolerations for cluster, such as "key=value:effect,key:effect", for example '"engineType=mongo:NoSchedule", "diskType:NoSchedule"' --topology-keys stringArray Topology keys for affinity - --version string Cluster version. Legal values [8.0.8, 7.0.18, 6.0.21, 5.0.29, 4.4.29, 4.2.25, 4.0.28]. (default "6.0.21") ``` ### Options inherited from parent commands diff --git a/docs/user_docs/cli/kbcli_cluster_create_mysql.md b/docs/user_docs/cli/kbcli_cluster_create_mysql.md index 3db913771..c652c60cc 100644 --- a/docs/user_docs/cli/kbcli_cluster_create_mysql.md +++ b/docs/user_docs/cli/kbcli_cluster_create_mysql.md @@ -43,7 +43,7 @@ kbcli cluster create mysql NAME [flags] --tolerations strings Tolerations for cluster, such as "key=value:effect,key:effect", for example '"engineType=mongo:NoSchedule", "diskType:NoSchedule"' --topology string Topology type of the serve. Note that under the orc/orc-proxysql topology, it is necessary to specify the Orchestrator cluster information. You should choose either orchestrator.cluster-service-selector or orchestrator.service-reference. This means that depending on your setup, you will configure one of these options to properly integrate with the Orchestrator service for managing your MySQL cluster. Legal values [semisync, semisync-proxysql, mgr, mgr-proxysql, orc, orc-proxysql]. (default "semisync") --topology-keys stringArray Topology keys for affinity - --version string MySQL version Legal values [8.0.39, 8.0.38, 8.0.37, 8.0.36, 8.4.7, 8.4.3, 8.4.2, 8.4.1, 8.4.0, 5.7.44]. (default "8.0.39") + --version string MySQL version Legal values [8.0.44, 8.0.41, 8.0.39, 8.0.38, 8.0.37, 8.0.36, 8.4.7, 8.4.3, 8.4.2, 8.4.1, 8.4.0, 5.7.44]. (default "8.0.39") ``` ### Options inherited from parent commands diff --git a/docs/user_docs/cli/kbcli_cluster_create_rabbitmq.md b/docs/user_docs/cli/kbcli_cluster_create_rabbitmq.md index 5becf0bb4..4e2a26513 100644 --- a/docs/user_docs/cli/kbcli_cluster_create_rabbitmq.md +++ b/docs/user_docs/cli/kbcli_cluster_create_rabbitmq.md @@ -31,14 +31,14 @@ kbcli cluster create rabbitmq NAME [flags] --node-labels stringToString Node label selector (default []) -o, --output format Prints the output in the specified format. Allowed values: JSON and YAML (default yaml) --pod-anti-affinity string Pod anti-affinity type, one of: (Preferred, Required) (default "Preferred") - --replicas int The number of replicas, for standalone mode, the replicas is 1, for replicaset mode, the default replicas is 3. Value range [1, 5]. (default 1) + --replicas int The number of replicas, for standalone mode, the replicas is 1, for replicaset mode, the default replicas is 3. Value range [1, 5]. (default 3) --storage float Storage size, the unit is Gi. Value range [1, 10000]. (default 20) --storage-class-name string Storage class name of the data volume --tenancy string Tenancy options, one of: (SharedNode, DedicatedNode) (default "SharedNode") --termination-policy string The termination policy of cluster. Legal values [DoNotTerminate, Delete, WipeOut]. (default "Delete") --tolerations strings Tolerations for cluster, such as "key=value:effect,key:effect", for example '"engineType=mongo:NoSchedule", "diskType:NoSchedule"' --topology-keys stringArray Topology keys for affinity - --version string Cluster version. Legal values [4.0.9, 3.13.7, 3.13.2, 3.12.14, 3.11.28, 3.10.25, 3.9.29, 3.8.14]. (default "3.13.7") + --version string Cluster version. Legal values [4.2.1, 4.1.6, 4.0.9, 3.13.7, 3.12.14, 3.11.28, 3.10.25, 3.9.29, 3.8.34]. (default "3.13.7") ``` ### Options inherited from parent commands diff --git a/go.mod b/go.mod index 3f438fb10..069fc2ab6 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/apecloud/kbcli -go 1.24.0 +go 1.25.0 -toolchain go1.24.9 +toolchain go1.25.10 require ( cuelang.org/go v0.8.0 diff --git a/pkg/cluster/charts/etcd.tgz b/pkg/cluster/charts/etcd.tgz index 3b40e4b61..85a331fda 100644 Binary files a/pkg/cluster/charts/etcd.tgz and b/pkg/cluster/charts/etcd.tgz differ diff --git a/pkg/cluster/charts/kafka.tgz b/pkg/cluster/charts/kafka.tgz index b9dc0daff..20748cf72 100644 Binary files a/pkg/cluster/charts/kafka.tgz and b/pkg/cluster/charts/kafka.tgz differ diff --git a/pkg/cluster/charts/mongodb.tgz b/pkg/cluster/charts/mongodb.tgz index c44a941cc..a314dbd05 100644 Binary files a/pkg/cluster/charts/mongodb.tgz and b/pkg/cluster/charts/mongodb.tgz differ diff --git a/pkg/cluster/charts/mysql.tgz b/pkg/cluster/charts/mysql.tgz index db384822c..f0d316d1f 100644 Binary files a/pkg/cluster/charts/mysql.tgz and b/pkg/cluster/charts/mysql.tgz differ diff --git a/pkg/cluster/charts/postgresql.tgz b/pkg/cluster/charts/postgresql.tgz index d511a46e9..ac52ee512 100644 Binary files a/pkg/cluster/charts/postgresql.tgz and b/pkg/cluster/charts/postgresql.tgz differ diff --git a/pkg/cluster/charts/rabbitmq.tgz b/pkg/cluster/charts/rabbitmq.tgz index b914ca594..ab5b0c582 100644 Binary files a/pkg/cluster/charts/rabbitmq.tgz and b/pkg/cluster/charts/rabbitmq.tgz differ diff --git a/pkg/cluster/charts/redis.tgz b/pkg/cluster/charts/redis.tgz index 2da00e1b9..4d8f80830 100644 Binary files a/pkg/cluster/charts/redis.tgz and b/pkg/cluster/charts/redis.tgz differ diff --git a/pkg/cmd/kubeblocks/config.go b/pkg/cmd/kubeblocks/config.go index 361571b96..f6f30e431 100644 --- a/pkg/cmd/kubeblocks/config.go +++ b/pkg/cmd/kubeblocks/config.go @@ -107,7 +107,7 @@ func configKBRelease(o *InstallOptions) error { if kbRelease != nil && kbRelease.Chart != nil && kbRelease.Chart.Metadata != nil { kbVersion = kbRelease.Chart.Metadata.Version } - s := spinner.New(o.Out, spinnerMsg("Config KubeBlocks "+kbVersion)) + s := spinner.New(o.Out, spinnerMsg("Config KubeBlocks %s", kbVersion)) defer s.Fail() o.disableHelmPreHookJob() // upgrade KubeBlocks chart diff --git a/pkg/cmd/kubeblocks/install.go b/pkg/cmd/kubeblocks/install.go index 9f1b7aa5d..b3ec5b49c 100644 --- a/pkg/cmd/kubeblocks/install.go +++ b/pkg/cmd/kubeblocks/install.go @@ -299,7 +299,7 @@ func (o *InstallOptions) Install() error { s.Success() // add helm repo - s = spinner.New(o.Out, spinnerMsg("Add and update repo "+types.KubeBlocksRepoName)) + s = spinner.New(o.Out, spinnerMsg("Add and update repo %s", types.KubeBlocksRepoName)) defer s.Fail() // Add repo, if exists, will update it if err = helm.AddRepo(newHelmRepoEntry()); err != nil { @@ -308,7 +308,7 @@ func (o *InstallOptions) Install() error { s.Success() // install KubeBlocks - s = spinner.New(o.Out, spinnerMsg("Install KubeBlocks "+o.Version)) + s = spinner.New(o.Out, spinnerMsg("Install KubeBlocks %s", o.Version)) defer s.Fail() getImageRegistry := func() string { @@ -460,7 +460,7 @@ func (o *InstallOptions) waitAddonsEnabled() error { msg := "" header := "Wait for addons to be enabled" failedErr := errors.New("some addons are failed to be enabled") - s := spinner.New(o.Out, spinnerMsg(header)) + s := spinner.New(o.Out, spinnerMsg("Wait for addons to be enabled")) var ( spinnerDone = func() { diff --git a/pkg/cmd/kubeblocks/install_1.0.go b/pkg/cmd/kubeblocks/install_1.0.go index 1d655461c..b80a68b65 100644 --- a/pkg/cmd/kubeblocks/install_1.0.go +++ b/pkg/cmd/kubeblocks/install_1.0.go @@ -85,7 +85,7 @@ func (o *InstallOptions) preInstallWhenUpgradeFrom09() error { deploy := &kbDeploys[i] kbVersion := deploy.Labels[constant.AppVersionLabelKey] o.kb09Namespace = deploy.Namespace - s := spinner.New(o.Out, spinnerMsg(fmt.Sprintf("Stop %s %s", msgKey, kbVersion))) + s := spinner.New(o.Out, spinnerMsg("Stop %s %s", msgKey, kbVersion)) if err = o.stopDeploymentObject(s, deploy); err != nil { return err } diff --git a/pkg/cmd/kubeblocks/upgrade.go b/pkg/cmd/kubeblocks/upgrade.go index 06b805204..d93e932d5 100644 --- a/pkg/cmd/kubeblocks/upgrade.go +++ b/pkg/cmd/kubeblocks/upgrade.go @@ -178,7 +178,7 @@ func (o *InstallOptions) Upgrade() error { } // add helm repo - s := spinner.New(o.Out, spinnerMsg("Add and update repo "+types.KubeBlocksChartName)) + s := spinner.New(o.Out, spinnerMsg("Add and update repo %s", types.KubeBlocksChartName)) defer s.Fail() // Add repo, if exists, will update it if err = helm.AddRepo(newHelmRepoEntry()); err != nil { @@ -200,7 +200,7 @@ func (o *InstallOptions) Upgrade() error { // stop the old version KubeBlocks, otherwise the old version KubeBlocks will reconcile the // new version resources, which may be not compatible. helm will start the new version // KubeBlocks after upgrade. - s = spinner.New(o.Out, spinnerMsg("Stop KubeBlocks "+kbVersion)) + s = spinner.New(o.Out, spinnerMsg("Stop KubeBlocks %s", kbVersion)) if err = o.stopDeployment(s, util.GetKubeBlocksDeploy); err != nil { return err } @@ -244,7 +244,7 @@ func (o *InstallOptions) Upgrade() error { s.Success() } - s = spinner.New(o.Out, spinnerMsg("Upgrading KubeBlocks "+msg)) + s = spinner.New(o.Out, spinnerMsg("Upgrading KubeBlocks %s", msg)) defer s.Fail() o.disableHelmPreHookJob() // upgrade KubeBlocks chart diff --git a/pkg/cmd/playground/destroy.go b/pkg/cmd/playground/destroy.go index 3716169e3..0922cc68d 100644 --- a/pkg/cmd/playground/destroy.go +++ b/pkg/cmd/playground/destroy.go @@ -104,7 +104,7 @@ func (o *destroyOptions) destroy() error { // destroyLocal destroy local k3d cluster that will destroy all resources func (o *destroyOptions) destroyLocal() error { provider, _ := cp.New(cp.Local, "", o.Out, o.ErrOut) - s := spinner.New(o.Out, spinnerMsg("Delete playground k3d cluster "+o.prevCluster.ClusterName)) + s := spinner.New(o.Out, spinnerMsg("Delete playground k3d cluster %s", o.prevCluster.ClusterName)) defer s.Fail() if err := provider.DeleteK8sCluster(o.prevCluster); err != nil { if !strings.Contains(err.Error(), "no cluster found") && @@ -358,7 +358,7 @@ func (o *destroyOptions) uninstallKubeBlocks(client kubernetes.Interface, dynami } func (o *destroyOptions) removeKubeConfig() error { - s := spinner.New(o.Out, spinnerMsg("Remove kubeconfig from "+defaultKubeConfigPath)) + s := spinner.New(o.Out, spinnerMsg("Remove kubeconfig from %s", defaultKubeConfigPath)) defer s.Fail() if err := kubeConfigRemove(o.prevCluster.KubeConfig, defaultKubeConfigPath); err != nil { if os.IsNotExist(err) { diff --git a/pkg/cmd/playground/init.go b/pkg/cmd/playground/init.go index 33fa16a85..a0b7eb672 100644 --- a/pkg/cmd/playground/init.go +++ b/pkg/cmd/playground/init.go @@ -227,7 +227,7 @@ func (o *initOptions) local() error { } // create a local kubernetes cluster (k3d cluster) to deploy KubeBlocks - s := spinner.New(o.Out, spinnerMsg("Create k3d cluster: "+clusterInfo.ClusterName)) + s := spinner.New(o.Out, spinnerMsg("Create k3d cluster: %s", clusterInfo.ClusterName)) defer s.Fail() if err = provider.CreateK8sCluster(clusterInfo); err != nil { return errors.Wrap(err, "failed to set up k3d cluster") @@ -379,7 +379,7 @@ func (o *initOptions) writeStateFile(provider cp.Interface) (*cp.K8sClusterInfo, // merge created kubernetes cluster kubeconfig to ~/.kube/config and set it as default func (o *initOptions) setKubeConfig(info *cp.K8sClusterInfo) error { - s := spinner.New(o.Out, spinnerMsg("Merge kubeconfig to "+defaultKubeConfigPath)) + s := spinner.New(o.Out, spinnerMsg("Merge kubeconfig to %s", defaultKubeConfigPath)) defer s.Fail() // check if the default kubeconfig file exists, if not, create it @@ -399,7 +399,7 @@ func (o *initOptions) setKubeConfig(info *cp.K8sClusterInfo) error { s.Success() currentContext, err := kubeConfigCurrentContext(info.KubeConfig) - s = spinner.New(o.Out, spinnerMsg("Switch current context to "+currentContext)) + s = spinner.New(o.Out, spinnerMsg("Switch current context to %s", currentContext)) defer s.Fail() if err != nil { return err diff --git a/pkg/cmd/playground/util.go b/pkg/cmd/playground/util.go index faa14b9ff..9380ff69f 100644 --- a/pkg/cmd/playground/util.go +++ b/pkg/cmd/playground/util.go @@ -123,7 +123,7 @@ func readClusterInfoFromFile(path string) (*cp.K8sClusterInfo, error) { } func writeAndUseKubeConfig(kubeConfig string, kubeConfigPath string, out io.Writer) error { - s := spinner.New(out, spinnerMsg("Write kubeconfig to "+kubeConfigPath)) + s := spinner.New(out, spinnerMsg("Write kubeconfig to %s", kubeConfigPath)) defer s.Fail() if err := kubeConfigWrite(kubeConfig, kubeConfigPath, writeKubeConfigOptions{ UpdateExisting: true,