apecloud / kbcli Goto Github PK
View Code? Open in Web Editor NEWThe CLI for KubeBlocks.
License: GNU Affero General Public License v3.0
The CLI for KubeBlocks.
License: GNU Affero General Public License v3.0
kbcli cluster edit-config mycluster --component mysql --config-spec xxx
When there are multiple config specs, one must specify the config template name.
But the name is hard to remeber, and it's better to support auto-completion.
Is your improvement request related to a problem? Please describe.
kubeblocks upgrade should check if the target version exits first, otherwise, the kubeblocks will be stopped, but the new version can not be installed.
kbcli kb upgrade --version 0.7.1
Current KubeBlocks version 0.7.0.
Upgrade KubeBlocks from 0.7.0 to 0.7.1
Please type 'Yes/yes' to confirm your operation: yes
Add and update repo kubeblocks OK
Stop KubeBlocks 0.7.0 OK
Stop DataProtection OK
Upgrading KubeBlocks to 0.7.1 FAIL
error: chart "kubeblocks" matching 0.7.1 not found in kubeblocks index. (try 'helm repo update'): no chart version found for kubeblocks-0.7.1
kbcli version
KubeBlocks: 0.8.0-alpha.9
kbcli: 0.8.0-alpha.9
To reproduce:
install kbcli
curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash
and install kubeblocks
kbcli kubeblocks install
if there is no accessible k8s, just use our playground
kbcli playground init
ref to: https://kubeblocks.io/docs/preview/user_docs/try-out-on-playground/try-kubeblocks-on-your-laptop
2. create a mysql cluster
kbcli cluster create mycluster --cluster-definition apecloud-mysql --cluster
-version ac-mysql-8.0.30
kbcli cluster list mycluster
kbcli cluster backup mycluster --method xtrabackup
Because there is no BackupRepo configured, this backup task should fail as expected.
If you type tab
at this moment, there is no auto-completion for backup names.
For comprision, you can try
kbcli cluster list my<tab>
and cluster name mycluster
will be completed.
kbcli cluster create-account -i apple89-mysql-0 --name test
Error from server (NotFound): pods "apple89-mysql-0" not found`
cause there is no ConsensusSetStatus
, ReplicationSetStatus
in cluster status.
When disable or uninstall addons, check if there are any clusters currently using this addon. If there are, please inform the user that these clusters may be affected.
And add double-check.
Kubernetes: v1.27.3
KubeBlocks: 0.8.0-alpha.9
kbcli: 0.8.0-alpha.9
There is no backup repo by default.
When one creates a cluster, say mysql raft-group cluster, and creates a backup for that cluster.
He won't any error message until he checks the status of the newly created backup CR.
kbcli backuprepo list
No backup repository found
kbcli cluster create mysql mycluster
kbcli cluster backup mycluster --method xtrabackup
and this backup failed due to error: no default BackupRepo found
we'd better check the existence of backuprepo ahead.
What is the user interaction of your feature
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
What is the user interaction of your feature
Support addon install/uninstall command like plugin.
Describe the bug
% kbcli backuprepo create --provider ftp --ftp-host my-ftp-service.default.svc.cluster.local --ftp-user user --ftp-password pass1234 --default
invalid value "" for "--ftp-port": Invalid type. Expected: integer, given: string
invalid value "" for "--ftp-tls": Invalid type. Expected: boolean, given: string
error: invalid flags
Describe the bug
addon index update faild due to git fetch origin -v
and git status -uno --porcelain
output nothing
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
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):
Additional context
Add any other context about the problem here.
kbcli bench cmd support redis-benchmark
~ kbcli kb uninstall --auto-approve
Uninstall KubeBlocks in namespace "kb-system"
Wait for addons to be disabled
snapshot-controller OK
Uninstall helm release kubeblocks 0.8.0-alpha.11 OK
Remove helm repo kubeblocks OK
Remove built-in custom resources OK
Remove actionsets OK
Remove addons OK
Remove backuppolicytemplates OK
Remove clusterdefinitions OK
Remove clusterversions OK
Remove componentclassdefinitions OK
Remove componentdefinitions OK
Remove configconstraints OK
Remove configmaps OK
Remove customresourcedefinitions OK
Remove storageproviders OK
Uninstall KubeBlocks done.
➜ ~ kbcli kb install
KubeBlocks will be installed to namespace "kb-system"
error: there are resources left by previous KubeBlocks version, try to run "kbcli kubeblocks uninstall" to clean up
configmaps: ape-0.8.0-auditlog-config-template,ape-0.8.0-scripts,ape-0.8.0-config-template,ape-0.8.0-agamotto-configuration,ape-0.8.0-vttablet-config-template,ape-0.8.0-vtconsensus-config-template,ape-0.8.0-vtgate-config-template
Now kubebench can limit the cpu and memroy for bench pod. kbcli bench need to add it.
What is the user interaction of your feature
kbcli github workflows
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
If this is a new feature, please describe the motivation and goals.
A clear and concise description of why you want to happen, link the design doc if possible
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
due to the api refactoring, accounts are not provisioned as expected and kbcli failed to connect cluster as 'admin' user.
to workaround, using secret '-root-credential' instead for the moment.
kbcli support connect to oceanbase.
➜ ~ kbcli version
Kubernetes: v1.27.3-gke.100
KubeBlocks: 0.8.0-beta.11
kbcli: 0.8.0-beta.11
➜ ~ kbcli addon upgrade zookeeper
error: addon 'zookeeper' not found in the index 'kubeblocks'
➜ ~ kbcli addon upgrade apecloud-mysql
error: addon 'apecloud-mysql' not found in the index 'kubeblocks'
➜ ~ kbcli addon upgrade clickhouse
error: addon 'clickhouse' not found in the index 'kubeblocks'
➜ ~ kbcli addon upgrade greptimedb
error: addon 'greptimedb' not found in the index 'kubeblocks'
➜ ~ kbcli addon index list
error: command execution failure, output="正克隆到 '/Users/mjingz/.kbcli/addon/index/kubeblocks'...\nfatal: 无法访问 'https://github.com/apecloud/block-index.git/':HTTP/2 stream 1 was not closed cleanly before end of the underlying stream\n": exit status 128
Describe the bug
➜ ~ kbcli cluster create --cluster-definition oracle --set memory=2GB
panic: cannot parse '2GB': quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$'
goroutine 1 [running]:
k8s.io/apimachinery/pkg/api/resource.MustParse({0x16d35364e, 0x3})
/home/runner/go/pkg/mod/k8s.io/[email protected]/pkg/api/resource/quantity.go:139 +0x10c
github.com/apecloud/kbcli/pkg/cmd/cluster.buildClusterComp(0x140009282c0, 0x1?, 0x16d35363a?)
/home/runner/work/kubeblocks/kubeblocks/pkg/cmd/cluster/create.go:1058 +0x73c
github.com/apecloud/kbcli/pkg/cmd/cluster.(*CreateOptions).buildComponents(0x1400137f800, {0x0, 0x0, 0x7?})
/home/runner/work/kubeblocks/kubeblocks/pkg/cmd/cluster/create.go:599 +0x154
github.com/apecloud/kbcli/pkg/cmd/cluster.(*CreateOptions).Complete(0x1400137f800)
/home/runner/work/kubeblocks/kubeblocks/pkg/cmd/cluster/create.go:496 +0x250
github.com/apecloud/kbcli/pkg/cmd/cluster.NewCreateCmd.func1(0x1400138ff00?, {0x140007a7080?, 0x0?, 0x4?})
/home/runner/work/kubeblocks/kubeblocks/pkg/cmd/cluster/create.go:268 +0x6c
github.com/spf13/cobra.(*Command).execute(0x1400137fb00, {0x140007a7040, 0x4, 0x4})
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:944 +0x640
github.com/spf13/cobra.(*Command).ExecuteC(0x14000f52c00)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x320
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:992
k8s.io/component-base/cli.run(0x14000f52c00)
/home/runner/go/pkg/mod/k8s.io/[email protected]/cli/run.go:146 +0x264
k8s.io/component-base/cli.RunNoErrOutput(...)
/home/runner/go/pkg/mod/k8s.io/[email protected]/cli/run.go:84
main.main()
/home/runner/work/kubeblocks/kubeblocks/cmd/cli/main.go:31 +0x20
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
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):
Additional context
Add any other context about the problem here.
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
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):
Additional context
Add any other context about the problem here.
now, addon index init default addon repo in index add cmd, it should be move into index cmd.
➜ ~ kbcli version
Kubernetes: v1.28.3-aliyun.1
KubeBlocks: 0.6.5
kbcli: 0.8.0-alpha.5
WARNING: version difference between kbcli (0.8.0-alpha.5) and kubeblocks (0.6.5)
➜ ~ kbcli cluster describe apecloud-pg -n kubeblocks-cloud
Error from server (NotFound): the server could not find the requested resource
➜ ~ k get cluster apecloud-pg -n kubeblocks-cloud
NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
apecloud-pg postgresql postgresql-14.8.0 Delete Running 141m
➜ ~ kbcli cluster list apecloud-pg -n kubeblocks-cloud
NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
apecloud-pg kubeblocks-cloud postgresql postgresql-14.8.0 Delete Running Nov 17,2023 15:26 UTC+0800
What is the user interaction of your feature
support kbcli addon index
like krew
KBCLI will build some charts as embeded-chart
fo fast creation
.PHONY: build-kbcli-embed-chart
build-kbcli-embed-chart: helmtool fetch-addons create-kbcli-embed-charts-dir \
build-single-kbcli-embed-chart.apecloud-mysql-cluster \
build-single-kbcli-embed-chart.redis-cluster \
build-single-kbcli-embed-chart.postgresql-cluster \
build-single-kbcli-embed-chart.kafka-cluster \
build-single-kbcli-embed-chart.mongodb-cluster \
...
That's why KBCLI should fetch the laste version of kubeblocks-addons repo.
we may use GIT submodule
to manage this repo.
After I upgrade kb/kbcli from 0.7.2 to 0.8.0-beta.35 and try to kbcli cluster connect starrock, following error returned, we should return "unsupported engine type" as other engines if we do not support kbcli connect starrock
➜ ~ kbcli72 version
Kubernetes: v1.27.3-gke.100
KubeBlocks: 0.8.0-beta.35
kbcli: 0.7.2
WARNING: version difference between kbcli (0.7.2) and kubeblocks (0.8.0-beta.35)
➜ ~ kbcli72 cluster connect starrock-gdjmzp
Connect to instance starrock-gdjmzp-fe-0
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
command terminated with exit code 1
➜ ~ kbcli version
Kubernetes: v1.27.3-gke.100
KubeBlocks: 0.8.0-beta.35
kbcli: 0.8.0-beta.36
WARNING: version difference between kbcli (0.8.0-beta.36) and kubeblocks (0.8.0-beta.35)
➜ ~ kbcli cluster connect starrock-gdjmzp
Connect to instance starrock-gdjmzp-fe-0
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
command terminated with exit code 1
➜ ~ k get secret starrock-gdjmzp-conn-credential -o yaml
apiVersion: v1
data:
endpoint: c3RhcnJvY2stZ2RqbXpwLWZlLmRlZmF1bHQuc3ZjOjkwMzA=
host: c3RhcnJvY2stZ2RqbXpwLWZlLmRlZmF1bHQuc3Zj
password: ""
port: OTAzMA==
username: cm9vdA==
kind: Secret
metadata:
creationTimestamp: "2024-01-04T02:54:37Z"
finalizers:
- cluster.kubeblocks.io/finalizer
labels:
app.kubernetes.io/instance: starrock-gdjmzp
app.kubernetes.io/managed-by: kubeblocks
app.kubernetes.io/name: starrocks
name: starrock-gdjmzp-conn-credential
namespace: default
ownerReferences:
- apiVersion: apps.kubeblocks.io/v1alpha1
blockOwnerDeletion: true
controller: true
kind: Cluster
name: starrock-gdjmzp
uid: f1172145-0d21-4a80-a88b-4be6bd0a1710
resourceVersion: "27527"
uid: 014d3806-3f2b-44c0-9bc7-8b00aca8e180
type: Opaque
➜ ~ kbcli version
Kubernetes: v1.27.3-gke.100
KubeBlocks: 0.7.1-beta.1
kbcli: 0.8.0-alpha.5
➜ ~ kbcli login
Successfully logged in as "[email protected]" for organization "" ("") "".
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
[github.com/apecloud/kbcli/pkg/cmd/auth.getFirstContext](http://github.com/apecloud/kbcli/pkg/cmd/auth.getFirstContext)({0x140003b2f00?, 0x4a6?}, {0x14001594330?, 0x104bdcd68?})
/home/runner/work/kubeblocks/kubeblocks/pkg/cmd/auth/login.go:250 +0xd8
[github.com/apecloud/kbcli/pkg/cmd/auth.(*LoginOptions).loginWithDefault](http://github.com/apecloud/kbcli/pkg/cmd/auth.(*LoginOptions).loginWithDefault)(0x104bdcd68?, {0x104c17c90?, 0x106e6c860?})
/home/runner/work/kubeblocks/kubeblocks/pkg/cmd/auth/login.go:195 +0x68
[github.com/apecloud/kbcli/pkg/cmd/auth.(*LoginOptions).run](http://github.com/apecloud/kbcli/pkg/cmd/auth.(*LoginOptions).run)(0x0?, {0x104c17c90?, 0x106e6c860?})
/home/runner/work/kubeblocks/kubeblocks/pkg/cmd/auth/login.go:100 +0x6c
[github.com/apecloud/kbcli/pkg/cmd/auth.NewLogin.func1](http://github.com/apecloud/kbcli/pkg/cmd/auth.NewLogin.func1)(0x14000ec8300, {0x106e6c860?, 0x0?, 0x0?})
/home/runner/work/kubeblocks/kubeblocks/pkg/cmd/auth/login.go:55 +0x90
[github.com/spf13/cobra.(*Command).execute](http://github.com/spf13/cobra.(*Command).execute)(0x14000ec8300, {0x106e6c860, 0x0, 0x0})
/home/runner/go/pkg/mod/[github.com/spf13/[email protected]/command.go:944](http://github.com/spf13/[email protected]/command.go:944) +0x640
[github.com/spf13/cobra.(*Command).ExecuteC(0x14000ec8000)](http://github.com/spf13/cobra.(*Command).ExecuteC(0x14000ec8000))
/home/runner/go/pkg/mod/[github.com/spf13/[email protected]/command.go:1068](http://github.com/spf13/[email protected]/command.go:1068) +0x320
[github.com/spf13/cobra.(*Command).Execute(...)](http://github.com/spf13/cobra.(*Command).Execute(...))
/home/runner/go/pkg/mod/[github.com/spf13/[email protected]/command.go:992](http://github.com/spf13/[email protected]/command.go:992)
[k8s.io/component-base/cli.run(0x14000ec8000)](http://k8s.io/component-base/cli.run(0x14000ec8000))
/home/runner/go/pkg/mod/[k8s.io/[email protected]/cli/run.go:146](http://k8s.io/[email protected]/cli/run.go:146) +0x264
[k8s.io/component-base/cli.RunNoErrOutput(...)](http://k8s.io/component-base/cli.RunNoErrOutput(...))
/home/runner/go/pkg/mod/[k8s.io/[email protected]/cli/run.go:84](http://k8s.io/[email protected]/cli/run.go:84)
main.main()
/home/runner/work/kubeblocks/kubeblocks/cmd/cli/main.go:31 +0x20
set annotation kubeblocks.io/extra-env
in cluster
kbcli should support to set the image registry as a environment variable, this image registry can be used when install KB or enable addon.
Back port to release 0.7.
achieve backup and restore using opsrequest
support upgrade command to upgrade kbcli version.
kbcli update --version 0.7.1
Is your improvement request related to a problem? Please describe.
kbcli kb config --set storageClass.name="test"
Current KubeBlocks version 0.7.0.
Add and update repo kubeblocks OK
Stop KubeBlocks 0.7.0 OK
Stop DataProtection OK
Upgrading KubeBlocks FAIL
something like kbcli cluster create --label cloud.kubeblocks.io/cluster=ck-cttest --label cloud.kubeblocks.io/organization=cttest
What is the user interaction of your feature
A concise description of user interactions or user stories of your feature request
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
If this is a new feature, please describe the motivation and goals.
A clear and concise description of why you want to happen, link the design doc if possible
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
support to search the specify addon from added indexes.
Is your improvement request related to a problem? Please describe.
kbcli cluster logs mycluster --file-type=audit --startTime='1970-01-01 00:00:00' --endTime='1970-01-02 00:00:00'
kbcli cluster logs mycluster --file-type=audit --startTime='1970-01-01 00:00:00' --endTime='1970-01-02 00:00:00' --filterkey='select'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.