Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]kbcli runtime error when enabling logs for redis cluster #8923

Closed
tianyue86 opened this issue Feb 14, 2025 · 3 comments
Closed

[BUG]kbcli runtime error when enabling logs for redis cluster #8923

tianyue86 opened this issue Feb 14, 2025 · 3 comments
Assignees
Labels
kind/bug Something isn't working
Milestone

Comments

@tianyue86
Copy link

tianyue86 commented Feb 14, 2025

Describe the env
Kubernetes: v1.31.1-aliyun.1
KubeBlocks: 1.0.0-beta.28
kbcli: 1.0.0-beta.13

To Reproduce
Steps to reproduce the behavior:

  1. Create redis cluster in running state
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
metadata:
  name: redis-lphhul
  namespace: default
spec:
  clusterDef: redis
  topology: replication
  terminationPolicy: Delete
  componentSpecs:
  - name: redis
    serviceVersion: 7.0.6
    replicas: 2
    disableExporter: false
    resources:
      limits:
        cpu: 100m
        memory: 0.5Gi
      requests:
        cpu: 100m
        memory: 0.5Gi
    volumeClaimTemplates:
      - name: data
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 20Gi
  - name: redis-sentinel
    serviceVersion: 7.0.6
    replicas: 3
    resources:
      limits:
        cpu: 100m
        memory:  0.5Gi
      requests:
        cpu: 100m
        memory:  0.5Gi
    volumeClaimTemplates:
      - name: data
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 20Gi

k get cluster -A|grep redis
default     redis-lphhul                 redis                Delete               Running   14m
  1. update the cluster -> error
    kbcli cluster update redis-lphhul --enable-all-logs=true --namespace default
    panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/apecloud/kbcli/pkg/cmd/cluster.buildLogsReconfiguringOps({0x140018122e0, 0xc}, {0x140018122f9, 0x7}, {0x14001812370, 0x5}, {0x140013a1b78, 0x18}, {0x14000e36294, 0xa}, ...)
/home/runner/work/kbcli/kbcli/pkg/cmd/cluster/update.go:654 +0x454
github.com/apecloud/kbcli/pkg/cmd/cluster.(*UpdateOptions).reconfigureLogVariables.func1({{0x14001812370, 0x5}, {0x14001324228, 0x15}, {0x140018123c5, 0x5}, {0x0, 0x0, 0x0}, 0x0, ...}, ...)
/home/runner/work/kbcli/kbcli/pkg/cmd/cluster/update.go:537 +0x210
github.com/apecloud/kbcli/pkg/cmd/cluster.(*UpdateOptions).reconfigureLogVariables(0x140013edb00, 0x14000678910?, 0x1400181233a?)
/home/runner/work/kbcli/kbcli/pkg/cmd/cluster/update.go:551 +0x160
github.com/apecloud/kbcli/pkg/cmd/cluster.(*UpdateOptions).updateEnabledLog(0x140013edb00, {0x10736f553?, 0x16b77738d?})
/home/runner/work/kbcli/kbcli/pkg/cmd/cluster/update.go:489 +0x21c
github.com/apecloud/kbcli/pkg/cmd/cluster.(*UpdateOptions).buildComponents(0x140013edb00?, {0x1073927b8?, 0xf?}, {0x10736f553?, 0x4?})
/home/runner/work/kbcli/kbcli/pkg/cmd/cluster/update.go:428 +0x174
github.com/apecloud/kbcli/pkg/cmd/cluster.(*UpdateOptions).buildPatch.func3(0x1083d7160?, {0x1081fa660?, 0x14001135c00?}, {0x1073927b8?, 0x1400180fb08?})
/home/runner/work/kbcli/kbcli/pkg/cmd/cluster/update.go:308 +0x54
github.com/apecloud/kbcli/pkg/cmd/cluster.(*UpdateOptions).buildPatch(0x140013edb00)
/home/runner/work/kbcli/kbcli/pkg/cmd/cluster/update.go:350 +0x8d4
github.com/apecloud/kbcli/pkg/cmd/cluster.(*UpdateOptions).Complete(0x140013edb00)
/home/runner/work/kbcli/kbcli/pkg/cmd/cluster/update.go:284 +0xc8
github.com/apecloud/kbcli/pkg/cmd/cluster.(*UpdateOptions).Exec(0x140013edb00)
/home/runner/work/kbcli/kbcli/pkg/cmd/cluster/update.go:267 +0x2c
github.com/apecloud/kbcli/pkg/cmd/cluster.NewUpdateCmd.func1(0x1400143c008?, {0x1400087ce40?, 0x1?, 0x4?})
/home/runner/work/kbcli/kbcli/pkg/cmd/cluster/update.go:166 +0x48
github.com/spf13/cobra.(*Command).execute(0x1400143c008, {0x1400087ce00, 0x4, 0x4})
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:989 +0x828
github.com/spf13/cobra.(*Command).ExecuteC(0x140008c4c08)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041
k8s.io/component-base/cli.run(0x140008c4c08)
/home/runner/go/pkg/mod/k8s.io/component-base@v0.29.2/cli/run.go:146 +0x250
k8s.io/component-base/cli.RunNoErrOutput(...)
/home/runner/go/pkg/mod/k8s.io/component-base@v0.29.2/cli/run.go:84
main.main()
/home/runner/work/kbcli/kbcli/cmd/cli/main.go:31 +0x20

4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
 - OS: [e.g. iOS]
 - Browser [e.g. chrome, safari]
 - Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
@tianyue86 tianyue86 added the kind/bug Something isn't working label Feb 14, 2025
@tianyue86 tianyue86 added this to the Release 1.0.0 milestone Feb 14, 2025
@shanshanying shanshanying changed the title [BUG]runtime error occurred when updating redis cluster [BUG]kbcli runtime error when enabling logs for redis cluster Feb 17, 2025
@shanshanying shanshanying changed the title [BUG]kbcli runtime error when enabling logs for redis cluster [BUG]kb runtime error when enabling logs for redis cluster Feb 17, 2025
@shanshanying shanshanying changed the title [BUG]kb runtime error when enabling logs for redis cluster [BUG]kbcli runtime error when enabling logs for redis cluster Feb 17, 2025
@shanshanying
Copy link
Contributor

EnabledLogs API is deprecated sinc KB 1.0. kbcli does not support update --enable-all-logs

@tianyue86
Copy link
Author

tianyue86 commented Feb 17, 2025

EnabledLogs API is deprecated sinc KB 1.0. kbcli does not support update --enable-all-logs

~kbcli cluster update --help
Update the cluster settings, such as enable or disable monitor or log.

Examples:
  # update cluster mycluster termination policy to Delete
  kbcli cluster update mycluster --termination-policy=Delete
  
  # enable cluster monitor
  kbcli cluster update mycluster --monitor=true
  
  # enable all logs
  kbcli cluster update mycluster --enable-all-logs=true

===>I saw the example in help doc, if not support, pls update together

@shanshanying
Copy link
Contributor

shanshanying commented Feb 17, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants