@@ -170,12 +170,9 @@ func createClusterCommand() *cobra.Command {
170
170
Use : "create" ,
171
171
Short : "create a cluster" ,
172
172
Run : func (cmd * cobra.Command , args []string ) {
173
- operatorEndpoint , err := cmd . Flags (). GetString ( "operator-endpoint" )
173
+ operatorEndpoint , err := getOperatorEndpoint ( )
174
174
if err != nil {
175
- operatorEndpoint , err = getOperatorEndpoint ()
176
- if err != nil {
177
- cmdFailedf (cmd , "get operator endpoint failed: %s" , err )
178
- }
175
+ cmdFailedf (cmd , "get operator endpoint failed: %s" , err )
179
176
}
180
177
181
178
if showInstallableList {
@@ -251,6 +248,7 @@ func createClusterCommand() *cobra.Command {
251
248
}
252
249
253
250
clusterspec := table .NewWriter ()
251
+ clusterspec .SetCaption ("The Endpoints Of Vanus Operator: %s\n " , operatorEndpoint )
254
252
clusterspec .AppendHeader (table.Row {"Cluster" , "Version" , "Component" , "Replicas" , "StorageSize" , "StorageClass" })
255
253
if c .Etcd .StorageClass == nil {
256
254
clusterspec .AppendRow (table.Row {"vanus" , * c .Version , "etcd" , * c .Etcd .Replicas , * c .Etcd .StorageSize , "-" })
@@ -351,12 +349,9 @@ func deleteClusterCommand() *cobra.Command {
351
349
Use : "delete" ,
352
350
Short : "delete a cluster" ,
353
351
Run : func (cmd * cobra.Command , args []string ) {
354
- operatorEndpoint , err := cmd . Flags (). GetString ( "operator-endpoint" )
352
+ operatorEndpoint , err := getOperatorEndpoint ( )
355
353
if err != nil {
356
- operatorEndpoint , err = getOperatorEndpoint ()
357
- if err != nil {
358
- cmdFailedf (cmd , "get operator endpoint failed: %s" , err )
359
- }
354
+ cmdFailedf (cmd , "get operator endpoint failed: %s" , err )
360
355
}
361
356
362
357
fmt .Print ("Deleting a cluster will lose all cluster data and can't be recovered, do you still want to delete the vanus cluster(y/n):" )
@@ -465,12 +460,9 @@ func upgradeClusterCommand() *cobra.Command {
465
460
Use : "upgrade" ,
466
461
Short : "upgrade cluster" ,
467
462
Run : func (cmd * cobra.Command , args []string ) {
468
- operatorEndpoint , err := cmd . Flags (). GetString ( "operator-endpoint" )
463
+ operatorEndpoint , err := getOperatorEndpoint ( )
469
464
if err != nil {
470
- operatorEndpoint , err = getOperatorEndpoint ()
471
- if err != nil {
472
- cmdFailedf (cmd , "get operator endpoint failed: %s" , err )
473
- }
465
+ cmdFailedf (cmd , "get operator endpoint failed: %s" , err )
474
466
}
475
467
476
468
if showUpgradeableList {
@@ -588,12 +580,13 @@ func scaleStoreReplicas() *cobra.Command {
588
580
Use : "store" ,
589
581
Short : "scale store replicas" ,
590
582
Run : func (cmd * cobra.Command , args []string ) {
591
- operatorEndpoint , err := cmd . Flags (). GetString ( "operator-endpoint" )
583
+ operatorEndpoint , err := getOperatorEndpoint ( )
592
584
if err != nil {
593
- operatorEndpoint , err = getOperatorEndpoint ()
594
- if err != nil {
595
- cmdFailedf (cmd , "get operator endpoint failed: %s" , err )
596
- }
585
+ cmdFailedf (cmd , "get operator endpoint failed: %s" , err )
586
+ }
587
+
588
+ if storeReplicas == 0 {
589
+ cmdFailedf (cmd , "the --replicas flag MUST be set" )
597
590
}
598
591
599
592
client := & http.Client {}
@@ -651,7 +644,7 @@ func scaleStoreReplicas() *cobra.Command {
651
644
}
652
645
},
653
646
}
654
- cmd .Flags ().Int32Var (& storeReplicas , "replicas" , 3 , "replicas" )
647
+ cmd .Flags ().Int32Var (& storeReplicas , "replicas" , 0 , "the replicas of store " )
655
648
return cmd
656
649
}
657
650
@@ -660,12 +653,13 @@ func scaleTriggerReplicas() *cobra.Command {
660
653
Use : "trigger" ,
661
654
Short : "scale trigger replicas" ,
662
655
Run : func (cmd * cobra.Command , args []string ) {
663
- operatorEndpoint , err := cmd . Flags (). GetString ( "operator-endpoint" )
656
+ operatorEndpoint , err := getOperatorEndpoint ( )
664
657
if err != nil {
665
- operatorEndpoint , err = getOperatorEndpoint ()
666
- if err != nil {
667
- cmdFailedf (cmd , "get operator endpoint failed: %s" , err )
668
- }
658
+ cmdFailedf (cmd , "get operator endpoint failed: %s" , err )
659
+ }
660
+
661
+ if triggerReplicas == 0 {
662
+ cmdFailedf (cmd , "the --replicas flag MUST be set" )
669
663
}
670
664
671
665
client := & http.Client {}
@@ -723,7 +717,7 @@ func scaleTriggerReplicas() *cobra.Command {
723
717
}
724
718
},
725
719
}
726
- cmd .Flags ().Int32Var (& triggerReplicas , "replicas" , 3 , "replicas" )
720
+ cmd .Flags ().Int32Var (& triggerReplicas , "replicas" , 0 , "the replicas of trigger " )
727
721
return cmd
728
722
}
729
723
@@ -732,12 +726,9 @@ func getClusterCommand() *cobra.Command {
732
726
Use : "status" ,
733
727
Short : "get cluster status" ,
734
728
Run : func (cmd * cobra.Command , args []string ) {
735
- operatorEndpoint , err := cmd . Flags (). GetString ( "operator-endpoint" )
729
+ operatorEndpoint , err := getOperatorEndpoint ( )
736
730
if err != nil {
737
- operatorEndpoint , err = getOperatorEndpoint ()
738
- if err != nil {
739
- cmdFailedf (cmd , "get operator endpoint failed: %s" , err )
740
- }
731
+ cmdFailedf (cmd , "get operator endpoint failed: %s" , err )
741
732
}
742
733
743
734
client := & http.Client {}
0 commit comments