apecloud / kubeblocks

KubeBlocks is an open-source control plane software that runs and manages databases, message queues and other stateful applications on K8s.
https://kubeblocks.io
GNU Affero General Public License v3.0
2.11k stars 173 forks source link

[BUG] kbcli connect postgresql cluster error with componentdefinition #5952

Closed JashBook closed 10 months ago

JashBook commented 11 months ago

Describe the bug kbcli connect postgresql cluster error with componentdefinition. error: failed to get component def :

kbcli version
Kubernetes: v1.26.3
KubeBlocks: 0.8.0-alpha.9
kbcli: 0.8.0-alpha.9

To Reproduce Steps to reproduce the behavior:

  1. create cluster
    
    apiVersion: apps.kubeblocks.io/v1alpha1
    kind: Cluster
    metadata:
    name: postgres-lxcdqz
    namespace: default
    spec:
    clusterDefinitionRef: postgresql
    clusterVersionRef: postgresql-14.8.0
    terminationPolicy: Halt
    componentSpecs:
    - name: postgresql
      componentDef: postgresql-14
      replicas: 1
      resources:
        requests:
          cpu: 100m
          memory: 0.5Gi
        limits:
          cpu: 100m
          memory: 0.5Gi
      updateStrategy: BestEffortParallel
      switchPolicy:
        type: Noop
      volumeClaimTemplates:
        - name: data
          spec:
            storageClassName:
            accessModes:
              - ReadWriteOnce
            resources:
              requests:
                storage: 3Gi

kubectl get cluster NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE postgres-lxcdqz postgresql postgresql-14.8.0 Halt Running 4m58s

2. See error

kbcli cluster connect postgres-lxcdqz error: failed to get component def :

➜ ~ kubectl exec -it postgres-lxcdqz-postgresql-0 bash kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead. Defaulted container "postgresql" out of: postgresql, pgbouncer, metrics, kb-checkrole, config-manager, pg-init-container (init)


/ | (_) | \ | ' | | |/ \ ) | |) | | | (_) | |__/| ./|||_/ |_|

This container is managed by runit, when stopping/starting services use sv

Examples:

sv stop cron sv restart patroni

Current status: (sv status /etc/service/*)

run: /etc/service/patroni: (pid 73) 419s run: /etc/service/pgqd: (pid 74) 419s root@postgres-lxcdqz-postgresql-0:/home/postgres# env|grep PASS PGPASSWORD=s3/,)]4921 PGPASSWORD_STANDBY=s3/,)]4921 PGPASSWORD_SUPERUSER=s3/,)]4921 PGPASSWORD_ADMIN=s3/,)]4921 root@postgres-lxcdqz-postgresql-0:/home/postgres#



**Expected behavior**
kbcli connect postgresql cluster success with componentdefinition.

**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.
Y-Rookie commented 11 months ago

kbcli needs to adapt to the new version of API refactoring, related issue link: https://github.com/apecloud/kbcli/issues/22