Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cicd-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cicd-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
BASE_BRANCH: origin/main
GO_VERSION: "1.24"
GO_VERSION: "1.25"

jobs:
trigger-mode:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-kbcli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
67 changes: 27 additions & 40 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -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$
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/...
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion addons
Submodule addons updated 466 files
1 change: 0 additions & 1 deletion docs/user_docs/cli/kbcli_cluster_create_mongodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/user_docs/cli/kbcli_cluster_create_mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/user_docs/cli/kbcli_cluster_create_rabbitmq.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Binary file modified pkg/cluster/charts/etcd.tgz
Binary file not shown.
Binary file modified pkg/cluster/charts/kafka.tgz
Binary file not shown.
Binary file modified pkg/cluster/charts/mongodb.tgz
Binary file not shown.
Binary file modified pkg/cluster/charts/mysql.tgz
Binary file not shown.
Binary file modified pkg/cluster/charts/postgresql.tgz
Binary file not shown.
Binary file modified pkg/cluster/charts/rabbitmq.tgz
Binary file not shown.
Binary file modified pkg/cluster/charts/redis.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/cmd/kubeblocks/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/kubeblocks/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/kubeblocks/install_1.0.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/kubeblocks/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/playground/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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") &&
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/playground/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/playground/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading