Skip to content

Commit

Permalink
chore: add alias for install and update cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
lizzy-0323 committed Sep 26, 2024
1 parent 197df33 commit 4cc96ac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
5 changes: 3 additions & 2 deletions internal/cli/cmd/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ func NewCmd() *cobra.Command {
o := install.NewInstallOptions()
logger := cmdUtil.GetDefaultLoggerInstance()
cmd := &cobra.Command{
Use: "install <component>",
Short: "Command for ob-operator and components installation",
Use: "install <component>",
Aliases: []string{"i"},
Short: "Command for ob-operator and components installation",
Long: `Command for ob-operator and components installation.
Currently support:
Expand Down
5 changes: 3 additions & 2 deletions internal/cli/cmd/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ func NewCmd() *cobra.Command {
o := update.NewUpdateOptions()
logger := cmdUtil.GetDefaultLoggerInstance()
cmd := &cobra.Command{
Use: "update <components>",
Short: "Command for ob-operator and components update",
Use: "update <components>",
Aliases: []string{"u"},
Short: "Command for ob-operator and components update",
Long: `Command for ob-operator and components update.
Currently support:
Expand Down
11 changes: 2 additions & 9 deletions internal/cli/tenant/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ import (

type UpdateOptions struct {
generic.ResourceOptions
// flags for cli
force bool
Pools []param.ResourcePoolSpec `json:"pools" binding:"required"`
ConnectWhiteList string `json:"connectWhiteList,omitempty"`
Charset string `json:"charset,omitempty"`
ZonePriority map[string]string `json:"zonePriority"`
UpdateType string `json:"updateType"`
UnitConfig *param.UnitConfig `json:"unitConfig" binding:"required"`
// Operation config
// DS for Operation config
OldResourcePools []v1alpha1.ResourcePoolSpec `json:"oldResourcePools,omitempty"`
ModifyResourcePools []v1alpha1.ResourcePoolSpec `json:"modifyResourcePools,omitempty"`
AddResourcePools []v1alpha1.ResourcePoolSpec `json:"addResourcePools,omitempty"`
Expand Down Expand Up @@ -112,9 +112,6 @@ func GetUpdateOperation(o *UpdateOptions) *v1alpha1.OBTenantOperation {
},
}
switch o.UpdateType {
case "charset":
updateOp.Spec.Charset = o.Charset
updateOp.Spec.Type = apiconst.TenantOpSetCharset
case "connect-white-list":
updateOp.Spec.ConnectWhiteList = o.ConnectWhiteList
updateOp.Spec.Type = apiconst.TenantOpSetConnectWhiteList
Expand Down Expand Up @@ -142,9 +139,6 @@ func (o *UpdateOptions) Validate() error {
o.UpdateType = name
}
}
if o.CheckIfFlagChanged("charset") {
updateTypeMap("charset")
}
if o.CheckIfFlagChanged("connect-white-list") {
updateTypeMap("connect-white-list")
}
Expand Down Expand Up @@ -186,7 +180,6 @@ func (o *UpdateOptions) Validate() error {
// AddFlags add basic flags for tenant management
func (o *UpdateOptions) AddFlags(cmd *cobra.Command) {
cmd.Flags().StringVar(&o.Namespace, "namespace", "default", "The namespace of OBTenant")
cmd.Flags().StringVar(&o.Charset, "charset", "", "The charset using in ob tenant")
cmd.Flags().StringVar(&o.ConnectWhiteList, "connect-white-list", "", "The connect white list using in ob tenant")
cmd.Flags().StringToStringVar(&o.ZonePriority, "priority", nil, "zone priority config of OBTenant")
cmd.Flags().BoolVarP(&o.force, "force", "f", false, "force operation")
Expand Down

0 comments on commit 4cc96ac

Please sign in to comment.