Adding interval and timeout flags for start and stop drain.
This commit is contained in:
parent
afa7a5d14f
commit
51daad88eb
2 changed files with 10 additions and 3 deletions
|
@ -28,6 +28,8 @@ var insecureSkipVerify bool
|
||||||
var caCertsPath string
|
var caCertsPath string
|
||||||
var clientKey, clientCert string
|
var clientKey, clientCert string
|
||||||
|
|
||||||
|
var monitorInterval, monitorTimeout int
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.PersistentFlags().StringVarP(&zkAddr, "zookeeper", "z", "", "Zookeeper node(s) where Aurora stores information.")
|
rootCmd.PersistentFlags().StringVarP(&zkAddr, "zookeeper", "z", "", "Zookeeper node(s) where Aurora stores information.")
|
||||||
rootCmd.PersistentFlags().StringVarP(&username, "username", "u", "", "Username to use for API authentication")
|
rootCmd.PersistentFlags().StringVarP(&username, "username", "u", "", "Username to use for API authentication")
|
||||||
|
|
11
cmd/start.go
11
cmd/start.go
|
@ -11,8 +11,13 @@ import (
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(startCmd)
|
rootCmd.AddCommand(startCmd)
|
||||||
|
|
||||||
|
|
||||||
// Sub-commands
|
// Sub-commands
|
||||||
startCmd.AddCommand(startMaintCmd)
|
startCmd.AddCommand(startMaintCmd)
|
||||||
|
|
||||||
|
startMaintCmd.Flags().IntVar(&monitorInterval,"interval", 5, "Interval at which to poll scheduler.")
|
||||||
|
startMaintCmd.Flags().IntVar(&monitorTimeout,"timeout", 50, "Time after which the monitor will stop polling and throw an error.")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var startCmd = &cobra.Command{
|
var startCmd = &cobra.Command{
|
||||||
|
@ -44,8 +49,8 @@ func drain(cmd *cobra.Command, args []string) {
|
||||||
hostResult, err := monitor.HostMaintenance(
|
hostResult, err := monitor.HostMaintenance(
|
||||||
args,
|
args,
|
||||||
[]aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED},
|
[]aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED},
|
||||||
5,
|
monitorInterval,
|
||||||
10)
|
monitorTimeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
for host, ok := range hostResult {
|
for host, ok := range hostResult {
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -57,5 +62,5 @@ func drain(cmd *cobra.Command, args []string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Print(result.String())
|
fmt.Println(result.String())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue