Skip to content

[BUG]kbcli cluster connect redis cluster error #416

@ahjing99

Description

@ahjing99
root@node1:~# k get cluster  cherr-657bbb6d7b -n kubeblocks-cloud-ns -o yaml
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
  annotations:
    cloud.kubeblocks.io/fields: '{"mode":"cluster","proxyEnabled":null}'
  creationTimestamp: "2024-07-29T02:13:02Z"
  finalizers:
  - cluster.kubeblocks.io/finalizer
  generation: 2
  labels:
    app.kubernetes.io/instance: cherr-657bbb6d7b
    app.kubernetes.io/version: 7.2.4
    cloud.kubeblocks.io/cluster: cherry39
    cloud.kubeblocks.io/organization: mjingz
    helm.sh/chart: redis-cluster-0.9.0
  name: cherr-657bbb6d7b
  namespace: kubeblocks-cloud-ns
  resourceVersion: "20387250"
  uid: 694756d6-921a-454e-a17e-40193efb478e
spec:
  affinity:
    podAntiAffinity: Required
    tenancy: SharedNode
    topologyKeys:
    - topology.kubernetes.io/zone
  backup:
    cronExpression: 0 18 * * *
    enabled: true
    method: datafile
    pitrEnabled: false
    repoName: minio
    retentionPeriod: 7d
    startingDeadlineMinutes: 0
  resources:
    cpu: "0"
    memory: "0"
  shardingSpecs:
  - name: shard
    shards: 3
    template:
      componentDef: redis-cluster-7
      name: redis
      replicas: 2
      resources:
        limits:
          cpu: "2"
          memory: 1Gi
        requests:
          cpu: "1"
          memory: 1Gi
      serviceVersion: 7.2.4
      services:
      - name: redis-advertised
        podService: true
        serviceType: NodePort
      systemAccounts:
      - name: default
        passwordConfig:
          length: 10
          letterCase: MixedCases
          numDigits: 5
          numSymbols: 0
          seed: cherr-657bbb6d7b
      volumeClaimTemplates:
      - name: data
        spec:
          accessModes:
          - ReadWriteOnce
          resources:
            requests:
              storage: 20Gi
  storage:
    size: "0"
  terminationPolicy: DoNotTerminate
status:
  conditions:
  - lastTransitionTime: "2024-07-29T02:13:02Z"
    message: Successfully applied for resources
    observedGeneration: 2
    reason: ApplyResourcesSucceed
    status: "True"
    type: ApplyResources
  - lastTransitionTime: "2024-07-29T02:13:02Z"
    message: 'The operator has started the provisioning of Cluster: cherr-657bbb6d7b'
    observedGeneration: 2
    reason: PreCheckSucceed
    status: "True"
    type: ProvisioningStarted
  - lastTransitionTime: "2024-07-29T02:13:22Z"
    message: all pods of components are ready, waiting for the probe detection successful
    reason: AllReplicasReady
    status: "True"
    type: ReplicasReady
  - lastTransitionTime: "2024-07-29T02:13:22Z"
    message: 'Cluster: cherr-657bbb6d7b is ready, current phase is Running'
    reason: ClusterReady
    status: "True"
    type: Ready
  observedGeneration: 2
  phase: Running

root@node1:~# kbcli cluster connect cherr-657bbb6d7b -n kubeblocks-cloud-ns
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/apecloud/kbcli/pkg/cmd/cluster.(*ConnectOptions).Complete(0xc00057ccc0)
	/home/runner/work/kbcli/kbcli/pkg/cmd/cluster/connect.go:242 +0x530
github.com/apecloud/kbcli/pkg/cmd/cluster.NewConnectCmd.func1(0xc0015e3900?, {0xc00137b350?, 0x1?, 0x3?})
	/home/runner/work/kbcli/kbcli/pkg/cmd/cluster/connect.go:126 +0x34
github.com/spf13/cobra.(*Command).execute(0xc0002c1b00, {0xc00137b2f0, 0x3, 0x3})
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987 +0xaa3
github.com/spf13/cobra.(*Command).ExecuteC(0xc001313200)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
k8s.io/component-base/cli.run(0xc001313200)
	/home/runner/go/pkg/mod/k8s.io/component-base@v0.29.0/cli/run.go:146 +0x2c5
k8s.io/component-base/cli.RunNoErrOutput(...)
	/home/runner/go/pkg/mod/k8s.io/component-base@v0.29.0/cli/run.go:84
main.main()
	/home/runner/work/kbcli/kbcli/cmd/cli/main.go:31 +0x18

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions