-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathdebug.go
More file actions
83 lines (74 loc) · 2.6 KB
/
debug.go
File metadata and controls
83 lines (74 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
Copyright AppsCode Inc. and Contributors
Licensed under the AppsCode Community License 1.0.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://github.com/appscode/licenses/raw/1.0.0/AppsCode-Community-1.0.0.md
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmds
import (
"kubedb.dev/cli/pkg/debug"
"github.com/spf13/cobra"
cmdutil "k8s.io/kubectl/pkg/cmd/util"
"k8s.io/kubectl/pkg/util/i18n"
"k8s.io/kubectl/pkg/util/templates"
)
var (
debugLong = templates.LongDesc(`
Collect all the logs and yamls of a specific database in just one command
`)
debugExample = templates.Examples(`
kubectl dba debug mongodb -n demo sample-mongodb --operator-namespace kubedb
Valid resource types include:
* elasticsearch
* mongodb
* mariadb
* mysql
* postgres
* redis
* gitops
`)
)
func NewCmdDebug(f cmdutil.Factory) *cobra.Command {
cmd := &cobra.Command{
Use: "debug",
Short: i18n.T("Debug any Database issue"),
Long: debugLong,
Example: debugExample,
Run: func(cmd *cobra.Command, args []string) {},
DisableFlagsInUseLine: true,
DisableAutoGenTag: true,
}
// KubeDB v1 databases
cmd.AddCommand(debug.ElasticsearchDebugCMD(f))
cmd.AddCommand(debug.KafkaDebugCMD(f))
cmd.AddCommand(debug.MariaDBDebugCMD(f))
cmd.AddCommand(debug.MemcachedDebugCMD(f))
cmd.AddCommand(debug.MongoDBDebugCMD(f))
cmd.AddCommand(debug.MySQLDebugCMD(f))
cmd.AddCommand(debug.PerconaXtraDBDebugCMD(f))
cmd.AddCommand(debug.PgBouncerDebugCMD(f))
cmd.AddCommand(debug.PostgresDebugCMD(f))
cmd.AddCommand(debug.ProxySQLDebugCMD(f))
cmd.AddCommand(debug.RedisDebugCMD(f))
// KubeDB v1alpha2 databases
cmd.AddCommand(debug.CassandraDebugCMD(f))
cmd.AddCommand(debug.ClickHouseDebugCMD(f))
cmd.AddCommand(debug.DruidDebugCMD(f))
cmd.AddCommand(debug.FerretDBDebugCMD(f))
cmd.AddCommand(debug.HazelcastDebugCMD(f))
cmd.AddCommand(debug.IgniteDebugCMD(f))
cmd.AddCommand(debug.MSSQLServerDebugCMD(f))
cmd.AddCommand(debug.OracleDebugCMD(f))
cmd.AddCommand(debug.PgpoolDebugCMD(f))
cmd.AddCommand(debug.RabbitMQDebugCMD(f))
cmd.AddCommand(debug.SinglestoreDebugCMD(f))
cmd.AddCommand(debug.SolrDebugCMD(f))
cmd.AddCommand(debug.ZooKeeperDebugCMD(f))
return cmd
}