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

Refactor(cli): move default values #581

Merged
merged 4 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (
func NewCliCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "obocli",
Short: "OceanBase Operator CLI",
Long: "OceanBase Operator CLI tool to manage OceanBase clusters, tenants, and backups.",
Short: "OceanBase Operator Cli",
Long: "OceanBase Operator Cli tool to manage OceanBase clusters, tenants, and backups.",
Run: func(cmd *cobra.Command, args []string) {
if cmd.Flags().Changed("version") {
versionCmd := version.NewCmd()
Expand Down
34 changes: 17 additions & 17 deletions internal/cli/cluster/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,47 +309,47 @@ func (o *CreateOptions) AddZoneFlags(cmd *cobra.Command) {
func (o *CreateOptions) AddBaseFlags(cmd *cobra.Command) {
baseFlags := cmd.Flags()
baseFlags.StringVarP(&o.ClusterName, FLAG_CLUSTER_NAME, "n", "", "Cluster name, if not specified, use resource name in k8s instead")
baseFlags.StringVar(&o.Namespace, FLAG_NAMESPACE, "default", "The namespace of the cluster")
baseFlags.Int64Var(&o.ClusterId, FLAG_CLUSTER_ID, 0, "The id of the cluster")
baseFlags.StringVar(&o.Namespace, FLAG_NAMESPACE, DEFAULT_NAMESPACE, "The namespace of the cluster")
baseFlags.Int64Var(&o.ClusterId, FLAG_CLUSTER_ID, DEFAULT_ID, "The id of the cluster")
baseFlags.StringVarP(&o.RootPassword, FLAG_ROOTPASSWD, "p", "", "The root password of the cluster")
baseFlags.StringVar(&o.Mode, FLAG_MODE, "", "The mode of the cluster")
}

// AddObserverFlags adds the observer-related flags to the command.
func (o *CreateOptions) AddObserverFlags(cmd *cobra.Command) {
observerFlags := pflag.NewFlagSet(FLAGSET_OBSERVER, pflag.ContinueOnError)
observerFlags.StringVar(&o.OBServer.Image, FLAG_OBSERVER_IMAGE, "oceanbase/oceanbase-cloud-native:4.2.1.6-106000012024042515", "The image of the observer")
observerFlags.Int64Var(&o.OBServer.Resource.Cpu, FLAG_OBSERVER_CPU, 2, "The cpu of the observer")
observerFlags.Int64Var(&o.OBServer.Resource.MemoryGB, FLAG_MONITOR_MEMORY, 10, "The memory of the observer")
observerFlags.StringVar(&o.OBServer.Storage.Data.StorageClass, FLAG_DATA_STORAGE_CLASS, "local-path", "The storage class of the data storage")
observerFlags.StringVar(&o.OBServer.Storage.RedoLog.StorageClass, FLAG_REDO_LOG_STORAGE_CLASS, "local-path", "The storage class of the redo log storage")
observerFlags.StringVar(&o.OBServer.Storage.Log.StorageClass, FLAG_LOG_STORAGE_CLASS, "local-path", "The storage class of the log storage")
observerFlags.Int64Var(&o.OBServer.Storage.Data.SizeGB, FLAG_DATA_STORAGE_SIZE, 50, "The size of the data storage")
observerFlags.Int64Var(&o.OBServer.Storage.RedoLog.SizeGB, FLAG_REDO_LOG_STORAGE_SIZE, 50, "The size of the redo log storage")
observerFlags.Int64Var(&o.OBServer.Storage.Log.SizeGB, FLAG_LOG_STORAGE_SIZE, 20, "The size of the log storage")
observerFlags.StringVar(&o.OBServer.Image, FLAG_OBSERVER_IMAGE, DEFAULT_OBSERVER_IMAGE, "The image of the observer")
observerFlags.Int64Var(&o.OBServer.Resource.Cpu, FLAG_OBSERVER_CPU, DEFAULT_CPU_NUM, "The cpu of the observer")
observerFlags.Int64Var(&o.OBServer.Resource.MemoryGB, FLAG_MONITOR_MEMORY, DEFAULT_MONITOR_MEMORY, "The memory of the observer")
observerFlags.StringVar(&o.OBServer.Storage.Data.StorageClass, FLAG_DATA_STORAGE_CLASS, DEFAULT_DATA_STORAGE_CLASS, "The storage class of the data storage")
observerFlags.StringVar(&o.OBServer.Storage.RedoLog.StorageClass, FLAG_REDO_LOG_STORAGE_CLASS, DEFAULT_REDO_LOG_STORAGE_CLASS, "The storage class of the redo log storage")
observerFlags.StringVar(&o.OBServer.Storage.Log.StorageClass, FLAG_LOG_STORAGE_CLASS, DEFAULT_LOG_STORAGE_CLASS, "The storage class of the log storage")
observerFlags.Int64Var(&o.OBServer.Storage.Data.SizeGB, FLAG_DATA_STORAGE_SIZE, DEFAULT_DATA_STORAGE_SIZE, "The size of the data storage")
observerFlags.Int64Var(&o.OBServer.Storage.RedoLog.SizeGB, FLAG_REDO_LOG_STORAGE_SIZE, DEFAULT_REDO_LOG_STORAGE_SIZE, "The size of the redo log storage")
observerFlags.Int64Var(&o.OBServer.Storage.Log.SizeGB, FLAG_LOG_STORAGE_SIZE, DEFAULT_LOG_STORAGE_SIZE, "The size of the log storage")
cmd.Flags().AddFlagSet(observerFlags)
}

// AddMonitorFlags adds the monitor-related flags to the command.
func (o *CreateOptions) AddMonitorFlags(cmd *cobra.Command) {
monitorFlags := pflag.NewFlagSet(FLAGSET_MONITOR, pflag.ContinueOnError)
monitorFlags.StringVar(&o.Monitor.Image, FLAG_MONITOR_IMAGE, "oceanbase/obagent:4.2.1-100000092023101717", "The image of the monitor")
monitorFlags.Int64Var(&o.Monitor.Resource.Cpu, FLAG_MONITOR_CPU, 1, "The cpu of the monitor")
monitorFlags.Int64Var(&o.Monitor.Resource.MemoryGB, FLAG_MONITOR_MEMORY, 1, "The memory of the monitor")
monitorFlags.StringVar(&o.Monitor.Image, FLAG_MONITOR_IMAGE, DEFAULT_MONITOR_IMAGE, "The image of the monitor")
monitorFlags.Int64Var(&o.Monitor.Resource.Cpu, FLAG_MONITOR_CPU, DEFAULT_MONITOR_CPU, "The cpu of the monitor")
monitorFlags.Int64Var(&o.Monitor.Resource.MemoryGB, FLAG_MONITOR_MEMORY, DEFAULT_MONITOR_MEMORY, "The memory of the monitor")
cmd.Flags().AddFlagSet(monitorFlags)
}

// AddBackupVolumeFlags adds the backup-volume-related flags to the command.
func (o *CreateOptions) AddBackupVolumeFlags(cmd *cobra.Command) {
backupVolumeFlags := pflag.NewFlagSet(FLAGSET_BACKUP_VOLUME, pflag.ContinueOnError)
backupVolumeFlags.StringVar(&o.BackupVolume.Address, FLAG_BACKUP_ADDRESS, "local-path", "The storage class of the backup storage")
backupVolumeFlags.StringVar(&o.BackupVolume.Path, FLAG_BACKUP_PATH, "/opt/nfs", "The size of the backup storage")
backupVolumeFlags.StringVar(&o.BackupVolume.Address, FLAG_BACKUP_ADDRESS, DEFAULT_BACKUP_ADDRESS, "The storage class of the backup storage")
backupVolumeFlags.StringVar(&o.BackupVolume.Path, FLAG_BACKUP_PATH, DEFAULT_BACKUP_PATH, "The size of the backup storage")
cmd.Flags().AddFlagSet(backupVolumeFlags)
}

// AddParameterFlags adds the parameter-related flags, e.g. __min_full_resource_pool_memory, to the command
func (o *CreateOptions) AddParameterFlags(cmd *cobra.Command) {
parameterFlags := pflag.NewFlagSet(FLAGSET_PARAMETERS, pflag.ContinueOnError)
parameterFlags.StringToStringVar(&o.KvParameters, FLAG_PARAMETERS, map[string]string{"__min_full_resource_pool_memory": "2147483648", "system_memory": "1G"}, "Other parameter settings in obcluster, e.g., __min_full_resource_pool_memory")
parameterFlags.StringToStringVar(&o.KvParameters, FLAG_PARAMETERS, map[string]string{"__min_full_resource_pool_memory": DEFAULT_MIN_FULL_RESOURCE_POOL_MEMORY, "system_memory": DEFAULT_SYSTEM_MEMORY}, "Other parameter settings in OBCluster, e.g., __min_full_resource_pool_memory")
cmd.Flags().AddFlagSet(parameterFlags)
}
2 changes: 1 addition & 1 deletion internal/cli/cluster/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ func NewDeleteOptions() *DeleteOptions {

// AddFlags add basic flags for cluster management
func (o *DeleteOptions) AddFlags(cmd *cobra.Command) {
cmd.Flags().StringVar(&o.Namespace, FLAG_NAMESPACE, "default", "namespace of ob cluster")
cmd.Flags().StringVar(&o.Namespace, FLAG_NAMESPACE, DEFAULT_NAMESPACE, "namespace of ob cluster")
}
29 changes: 28 additions & 1 deletion internal/cli/cluster/enter.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ See the Mulan PSL v2 for more details.
*/
package cluster

// Flags and FlagSets for cluster management
const (
// Flagsets for cluster
// FlagSets for cluster
FLAGSET_ZONE = "zone"
FLAGSET_OBSERVER = "observer"
FLAGSET_MONITOR = "monitor"
Expand Down Expand Up @@ -54,3 +55,29 @@ const (
// Flags for parameter-related options
FLAG_PARAMETERS = "parameters"
)

// Default values for cluster management
const (
// Default values for int and string flags
DEFAULT_NAMESPACE = "default"
DEFAULT_ID = 0
DEFAULT_CPU_NUM = 2
DEFAULT_OBSERVER_IMAGE = "oceanbase/oceanbase-cloud-native:4.2.1.6-106000012024042515"
DEFAULT_OBSERVER_CPU = 2
DEFAULT_OBSERVER_MEMORY = 10
DEFAULT_DATA_STORAGE_CLASS = "local-path"
DEFAULT_REDO_LOG_STORAGE_CLASS = "local-path"
DEFAULT_LOG_STORAGE_CLASS = "local-path"
DEFAULT_DATA_STORAGE_SIZE = 50
DEFAULT_REDO_LOG_STORAGE_SIZE = 50
DEFAULT_LOG_STORAGE_SIZE = 20
DEFAULT_MONITOR_IMAGE = "oceanbase/obagent:4.2.1-100000092023101717"
DEFAULT_MONITOR_CPU = 1
DEFAULT_MONITOR_MEMORY = 1
DEFAULT_BACKUP_ADDRESS = "local-path"
DEFAULT_BACKUP_PATH = "/opt/nfs"

// Default values for Parameter flag
DEFAULT_MIN_FULL_RESOURCE_POOL_MEMORY = "2147483648"
DEFAULT_SYSTEM_MEMORY = "1G"
)
4 changes: 2 additions & 2 deletions internal/cli/cluster/scale.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (o *ScaleOptions) Validate() error {
typeAdd = true
}
if typeDelete && deleteNum > maxDeleteNum {
return fmt.Errorf("Obcluster has %d Zones, can only delete %d zones", zoneNum, maxDeleteNum)
return fmt.Errorf("Ob cluster has %d Zones, can only delete %d zones", zoneNum, maxDeleteNum)
}
}
trueCount := 0
Expand All @@ -167,6 +167,6 @@ func (o *ScaleOptions) Validate() error {

// Add Flags for scale options
func (o *ScaleOptions) AddFlags(cmd *cobra.Command) {
cmd.Flags().StringVar(&o.Namespace, FLAG_NAMESPACE, "default", "namespace of ob cluster")
cmd.Flags().StringVar(&o.Namespace, FLAG_NAMESPACE, DEFAULT_NAMESPACE, "namespace of ob cluster")
cmd.Flags().StringToStringVar(&o.Zones, FLAG_ZONES, nil, "zone of ob cluster")
}
2 changes: 1 addition & 1 deletion internal/cli/cluster/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ func NewShowOptions() *ShowOptions {

// AddFlags add basic flags for cluster management
func (o *ShowOptions) AddFlags(cmd *cobra.Command) {
cmd.Flags().StringVar(&o.Namespace, FLAG_NAMESPACE, "default", "namespace of ob cluster")
cmd.Flags().StringVar(&o.Namespace, FLAG_NAMESPACE, DEFAULT_NAMESPACE, "namespace of ob cluster")
}
18 changes: 9 additions & 9 deletions internal/cli/cluster/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ func GetUpdateOperation(o *UpdateOptions) *v1alpha1.OBClusterOperation {

func (o *UpdateOptions) Validate() error {
updateTypeCount := 0
if o.Resource.Cpu != 0 || o.Resource.MemoryGB != 0 {
if o.CheckIfFlagChanged(FLAG_OBSERVER_CPU, FLAG_OBSERVER_MEMORY) {
updateTypeCount++
o.UpdateType = "resource"
}
if o.Storage.Data.StorageClass != "" || o.Storage.Log.StorageClass != "" || o.Storage.RedoLog.StorageClass != "" {
if o.CheckIfFlagChanged(FLAG_DATA_STORAGE_CLASS, FLAG_LOG_STORAGE_CLASS, FLAG_REDO_LOG_STORAGE_CLASS) {
updateTypeCount++
o.UpdateType = "modifyStorageClass"
}
if o.Storage.Data.SizeGB != 0 || o.Storage.Log.SizeGB != 0 || o.Storage.RedoLog.SizeGB != 0 {
if o.CheckIfFlagChanged(FLAG_DATA_STORAGE_SIZE, FLAG_LOG_STORAGE_SIZE, FLAG_REDO_LOG_STORAGE_SIZE) {
updateTypeCount++
o.UpdateType = "expandStorageSize"
}
Expand Down Expand Up @@ -128,13 +128,13 @@ func (o *UpdateOptions) Complete() error {

// AddFlags for update options
func (o *UpdateOptions) AddFlags(cmd *cobra.Command) {
cmd.Flags().StringVar(&o.Namespace, FLAG_NAMESPACE, "default", "namespace of ob cluster")
cmd.Flags().Int64Var(&o.Resource.Cpu, FLAG_OBSERVER_CPU, 0, "The cpu of the observer")
cmd.Flags().Int64Var(&o.Resource.MemoryGB, FLAG_MONITOR_MEMORY, 0, "The memory of the observer")
cmd.Flags().StringVar(&o.Namespace, FLAG_NAMESPACE, DEFAULT_NAMESPACE, "namespace of ob cluster")
cmd.Flags().Int64Var(&o.Resource.Cpu, FLAG_OBSERVER_CPU, DEFAULT_OBSERVER_CPU, "The cpu of the observer")
cmd.Flags().Int64Var(&o.Resource.MemoryGB, FLAG_OBSERVER_MEMORY, DEFAULT_OBSERVER_MEMORY, "The memory of the observer")
cmd.Flags().StringVar(&o.Storage.Data.StorageClass, FLAG_DATA_STORAGE_CLASS, "", "The storage class of the data storage")
cmd.Flags().StringVar(&o.Storage.RedoLog.StorageClass, FLAG_REDO_LOG_STORAGE_CLASS, "", "The storage class of the redo log storage")
cmd.Flags().StringVar(&o.Storage.Log.StorageClass, FLAG_LOG_STORAGE_CLASS, "", "The storage class of the log storage")
cmd.Flags().Int64Var(&o.Storage.Data.SizeGB, FLAG_DATA_STORAGE_SIZE, 0, "The size of the data storage")
cmd.Flags().Int64Var(&o.Storage.RedoLog.SizeGB, FLAG_REDO_LOG_STORAGE_SIZE, 0, "The size of the redo log storage")
cmd.Flags().Int64Var(&o.Storage.Log.SizeGB, FLAG_LOG_STORAGE_SIZE, 0, "The size of the log storage")
cmd.Flags().Int64Var(&o.Storage.Data.SizeGB, FLAG_DATA_STORAGE_SIZE, DEFAULT_DATA_STORAGE_SIZE, "The size of the data storage")
cmd.Flags().Int64Var(&o.Storage.RedoLog.SizeGB, FLAG_REDO_LOG_STORAGE_SIZE, DEFAULT_REDO_LOG_STORAGE_SIZE, "The size of the redo log storage")
cmd.Flags().Int64Var(&o.Storage.Log.SizeGB, FLAG_LOG_STORAGE_SIZE, DEFAULT_LOG_STORAGE_SIZE, "The size of the log storage")
}
2 changes: 1 addition & 1 deletion internal/cli/cluster/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ func (o *UpgradeOptions) Validate() error {

// AddFlags for upgrade options
func (o *UpgradeOptions) AddFlags(cmd *cobra.Command) {
cmd.Flags().StringVar(&o.Namespace, FLAG_NAMESPACE, "default", "namespace of ob cluster")
cmd.Flags().StringVar(&o.Namespace, FLAG_NAMESPACE, DEFAULT_NAMESPACE, "namespace of ob cluster")
cmd.Flags().StringVar(&o.Image, FLAG_OBSERVER_IMAGE, "", "The image of observer") // set image to null, avoid image downgrade
}
4 changes: 2 additions & 2 deletions internal/cli/cmd/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ func NewCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "cluster <subcommand>",
Aliases: []string{"c"},
Short: "Command for cluster management",
Long: `Command for cluster management, such as Create, UpGrade, Delete, Scale, Show.`,
Short: "Command for OBCluster's management",
Long: `Command for OBCluster's management, such as Create, UpGrade, Delete, Scale, Show.`,
}
cmd.AddCommand(NewCreateCmd())
cmd.AddCommand(NewDeleteCmd())
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/cmd/cluster/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func NewCreateCmd() *cobra.Command {
logger := cmdUtil.GetDefaultLoggerInstance()
cmd := &cobra.Command{
Use: "create <cluster_name>",
Short: "Create ob cluster",
Short: "Create an ob cluster",
Aliases: []string{"c"},
Args: cobra.ExactArgs(1),
PreRunE: o.Parse,
Expand All @@ -47,7 +47,7 @@ func NewCreateCmd() *cobra.Command {
if err != nil {
logger.Fatalln(err)
}
logger.Printf("Create obcluster instance: %s", o.ClusterName)
logger.Printf("Create OBCluster instance: %s", o.ClusterName)
logger.Printf("Run `echo $(kubectl get secret %s -o jsonpath='{.data.password}'|base64 --decode)` to get the secrets", obcluster.Spec.UserSecrets.Root)
},
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/cmd/cluster/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewDeleteCmd() *cobra.Command {
logger := cmdUtil.GetDefaultLoggerInstance()
cmd := &cobra.Command{
Use: "delete <cluster_name>",
Short: "Delete ob cluster",
Short: "Delete an ob cluster",
Aliases: []string{"d"},
Args: cobra.ExactArgs(1),
PreRunE: o.Parse,
Expand All @@ -36,7 +36,7 @@ func NewDeleteCmd() *cobra.Command {
if err != nil {
logger.Fatalln(err)
}
logger.Printf("Delete ob cluster %s successfully", o.Name)
logger.Printf("Delete OBCluster %s successfully", o.Name)
},
}
o.AddFlags(cmd)
Expand Down
6 changes: 3 additions & 3 deletions internal/cli/cmd/cluster/scale.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func NewScaleCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "scale <cluster_name>",
Args: cobra.ExactArgs(1),
Short: "Scale ob cluster",
Long: `Scale ob cluster, support add/adjust/delete of zones.`,
Short: "Scale an ob cluster",
Long: `Scale an ob cluster, support add/adjust/delete of zones.`,
PreRunE: o.Parse,
Run: func(cmd *cobra.Command, args []string) {
obcluster, err := clients.GetOBCluster(cmd.Context(), o.Namespace, o.Name)
Expand All @@ -51,7 +51,7 @@ func NewScaleCmd() *cobra.Command {
if _, err = clients.CreateOBClusterOperation(cmd.Context(), op); err != nil {
logger.Fatalln(err)
}
logger.Printf("Create scale operation for obcluster %s successfully", op.Spec.OBCluster)
logger.Printf("Create scale operation for OBCluster %s successfully", op.Spec.OBCluster)
},
}
o.AddFlags(cmd)
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/cmd/cluster/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func NewShowCmd() *cobra.Command {
tbw, tbLog := cmdUtil.GetTableLoggerInstance()
cmd := &cobra.Command{
Use: "show <cluster_name>",
Short: "Show overview of ob cluster",
Short: "Show overview of an ob cluster",
Args: cobra.ExactArgs(1),
PreRunE: o.Parse,
Run: func(cmd *cobra.Command, args []string) {
Expand Down
6 changes: 3 additions & 3 deletions internal/cli/cmd/cluster/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ func NewUpdateCmd() *cobra.Command {
logger := cmdUtil.GetDefaultLoggerInstance()
cmd := &cobra.Command{
Use: "update <cluster_name>",
Short: "Update ob cluster",
Long: "Update ob cluster, support cpu/memory/storage",
Short: "Update an ob cluster",
Long: "Update an ob cluster, support cpu/memory/storage",
Args: cobra.ExactArgs(1),
Aliases: []string{"ud"},
PreRunE: o.Parse,
Expand All @@ -50,7 +50,7 @@ func NewUpdateCmd() *cobra.Command {
if _, err = clients.CreateOBClusterOperation(cmd.Context(), op); err != nil {
logger.Fatalln(err)
}
logger.Printf("Create update operation for obcluster %s successfully", op.Spec.OBCluster)
logger.Printf("Create update operation for OBCluster %s successfully", op.Spec.OBCluster)
},
}
o.AddFlags(cmd)
Expand Down
6 changes: 3 additions & 3 deletions internal/cli/cmd/cluster/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ func NewUpgradeCmd() *cobra.Command {
logger := cmdUtil.GetDefaultLoggerInstance()
cmd := &cobra.Command{
Use: "upgrade <cluster_name>",
Short: "Upgrade ob cluster",
Long: "Upgrade ob cluster, please specify the new image",
Short: "Upgrade an ob cluster",
Long: "Upgrade an ob cluster, please specify the new image",
Args: cobra.ExactArgs(1),
Aliases: []string{"ug"},
PreRunE: o.Parse,
Expand All @@ -47,7 +47,7 @@ func NewUpgradeCmd() *cobra.Command {
if _, err = clients.CreateOBClusterOperation(cmd.Context(), op); err != nil {
logger.Fatalln(err)
}
logger.Printf("Create upgrade operation for obcluster %s successfully", op.Spec.OBCluster)
logger.Printf("Create upgrade operation for OBCluster %s successfully", op.Spec.OBCluster)
},
}
o.AddFlags(cmd)
Expand Down
6 changes: 3 additions & 3 deletions internal/cli/cmd/tenant/activate.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewActivateCmd() *cobra.Command {
logger := cmdUtil.GetDefaultLoggerInstance()
cmd := &cobra.Command{
Use: "activate <standby_tenant_name>",
Short: "Activate a standby tenant",
Short: "Activate a standby ob tenant",
PreRunE: o.Parse,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -47,13 +47,13 @@ func NewActivateCmd() *cobra.Command {
logger.Fatalln(err)
}
if obtenant.Status.TenantRole == apiconst.TenantRolePrimary {
logger.Fatalf("Obtenant %s is already PRIMARY", o.Name)
logger.Fatalf("OBTenant %s is already PRIMARY", o.Name)
}
op := tenant.GetActivateOperation(o)
if _, err = clients.CreateOBTenantOperation(cmd.Context(), op); err != nil {
logger.Fatalln(err)
}
logger.Printf("Create activate operation for tenant %s successfully", o.Name)
logger.Printf("Create activate operation for OBTenant %s successfully", o.Name)
},
}
o.AddFlags(cmd)
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/cmd/tenant/changepwd.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func NewChangePwdCmd() *cobra.Command {
if _, err = clients.CreateOBTenantOperation(cmd.Context(), op); err != nil {
logger.Fatalln(err)
}
logger.Printf("Create changepwd operation for obtenant %s successfully", o.Name)
logger.Printf("Create change password operation for OBTenant %s successfully", o.Name)
},
}
o.AddFlags(cmd)
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/cmd/tenant/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func NewCreateCmd() *cobra.Command {
logger := cmdUtil.GetDefaultLoggerInstance()
cmd := &cobra.Command{
Use: "create <tenant_name> --cluster=<cluster_name>",
Short: "Create ob tenant",
Short: "Create an ob tenant",
Aliases: []string{"c"},
PreRunE: o.Parse,
Args: cobra.ExactArgs(1),
Expand All @@ -41,7 +41,7 @@ func NewCreateCmd() *cobra.Command {
if err != nil {
logger.Fatalln(err)
}
logger.Printf("Create obtenant instance: %s", o.TenantName)
logger.Printf("Create OBTenant instance: %s", o.TenantName)
logger.Printf("Run `echo $(kubectl get secret %s -o jsonpath='{.data.password}'|base64 --decode)` to get the secrets", obtenant.Spec.Credentials.Root)
},
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/cmd/tenant/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func NewDeleteCmd() *cobra.Command {
logger := cmdUtil.GetDefaultLoggerInstance()
cmd := &cobra.Command{
Use: "delete <tenant_name>",
Short: "Delete ob tenant",
Short: "Delete an ob tenant",
Aliases: []string{"d"},
Args: cobra.ExactArgs(1),
PreRunE: o.Parse,
Expand All @@ -40,7 +40,7 @@ func NewDeleteCmd() *cobra.Command {
if err != nil {
logger.Fatalln(err)
}
logger.Printf("Delete ob tenant %s successfully", o.Name)
logger.Printf("Delete OBTenant %s successfully", o.Name)
},
}
o.AddFlags(cmd)
Expand Down
Loading
Loading