Updating documentation and adding monitor verb and noun.

This commit is contained in:
Renan DelValle 2019-03-22 20:50:41 -07:00
parent d1097f33ac
commit 724fdd8799
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9
38 changed files with 188 additions and 43 deletions

View file

@ -1,6 +1,8 @@
0.0.8
* Upgraded default timeouts and durations for sla-aware draining.
* Added monitor verb along with hosts noun.
* Fixed bug with monitor not using the correct default values for sla-aware drain policies.
0.0.7

59
cmd/monitor.go Normal file
View file

@ -0,0 +1,59 @@
package cmd
import (
"strings"
"time"
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(monitorCmd)
monitorCmd.AddCommand(monitorHostCmd)
monitorHostCmd.Flags().DurationVar(&monitorInterval, "interval", time.Second*5, "Interval at which to poll scheduler.")
monitorHostCmd.Flags().DurationVar(&monitorTimeout, "timeout", time.Minute*10, "Time after which the monitor will stop polling and throw an error.")
monitorHostCmd.Flags().StringSliceVar(&statusList, "statuses", []string{aurora.MaintenanceMode_DRAINED.String()}, "List of acceptable statuses for a host to be in. (case-insensitive) [NONE, SCHEDULED, DRAINED, DRAINING]")
}
var monitorCmd = &cobra.Command{
Use: "monitor",
Short: "Watch for a specific state change",
}
var monitorHostCmd = &cobra.Command{
Use: "hosts",
Short: "Watch a host maintenance status until it enters one of the desired statuses.",
Long: `Provide a list of hosts to monitor for desired statuses. Statuses may be passed using the --statuses
flag with a list of comma separated statuses. Statuses include [NONE, SCHEDULED, DRAINED, DRAINING]`,
PreRun: func(cmd *cobra.Command, args []string) {
// Manually initializing default values for this command as the default value for shared variables will
// be dependent on the order in which all commands were initialized
monitorTimeout = time.Minute * 10
monitorInterval = time.Second * 5
},
Run: monitorHost,
}
func monitorHost(cmd *cobra.Command, args []string) {
maintenanceModes := make([]aurora.MaintenanceMode, 0)
for _, status := range statusList {
mode, err := aurora.MaintenanceModeFromString(strings.ToUpper(status))
if err != nil {
log.Fatal(err)
}
maintenanceModes = append(maintenanceModes, mode)
}
log.Println(monitorTimeout)
log.Println(monitorInterval)
hostResult, err := client.HostMaintenanceMonitor(args, maintenanceModes, monitorInterval, monitorTimeout)
maintenanceMonitorPrint(hostResult, maintenanceModes)
if err != nil {
log.Fatalf("error: %+v", err)
}
}

2
debian/changelog vendored
View file

@ -2,6 +2,8 @@ australis (0.0.8) unstable; urgency=medium
* Upgraded default timeouts and durations for sla-aware draining.
* Added ability for controlling when an SLA-Aware drain sheds SLA awareness for SLA-aware drain policies
* Added monitor verb along with hosts noun.
* Fixed bug with monitor not using the correct default values for sla-aware drain policies.
-- Renan DelValle <renanidelvalle@gmail.com> Fri, 22 Mar 2019 15:10:00 -0700

View file

@ -31,9 +31,10 @@ A light-weight command line client for use with Apache Aurora built using goreal
* [australis fetch](australis_fetch.md) - Fetch information from Aurora
* [australis force](australis_force.md) - Force the scheduler to do a snapshot, a backup, or a task reconciliation.
* [australis kill](australis_kill.md) - Kill an Aurora Job
* [australis monitor](australis_monitor.md) - Watch for a specific state change
* [australis rollback](australis_rollback.md) - rollback an operation such as an Update
* [australis set](australis_set.md) - Set a value in the Aurora Scheduler.
* [australis start](australis_start.md) - Start a service, maintenance on a host (DRAIN), a snapshot, or a backup.
* [australis stop](australis_stop.md) - Stop a service or maintenance on a host (DRAIN).
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -44,4 +44,4 @@ australis autocomplete [flags]
* [australis](australis.md) - australis is a client for Apache Aurora
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -36,4 +36,4 @@ australis create [flags]
* [australis](australis.md) - australis is a client for Apache Aurora
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -36,4 +36,4 @@ australis docs [flags]
* [australis](australis.md) - australis is a client for Apache Aurora
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -36,4 +36,4 @@ Fetch information from Aurora
* [australis fetch status](australis_fetch_status.md) - Fetch the maintenance status of a node from Aurora
* [australis fetch task](australis_fetch_task.md) - Task information from Aurora
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -37,4 +37,4 @@ australis fetch jobs [flags]
* [australis fetch](australis_fetch.md) - Fetch information from Aurora
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -38,4 +38,4 @@ australis fetch leader [zkNode0, zkNode1, ...zkNodeN] [flags]
* [australis fetch](australis_fetch.md) - Fetch information from Aurora
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -36,4 +36,4 @@ australis fetch status [flags]
* [australis fetch](australis_fetch.md) - Fetch information from Aurora
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -34,4 +34,4 @@ Task information from Aurora
* [australis fetch task config](australis_fetch_task_config.md) - Fetch a list of task configurations from Aurora.
* [australis fetch task status](australis_fetch_task_status.md) - Fetch task status for a Job key.
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -39,4 +39,4 @@ australis fetch task config [flags]
* [australis fetch task](australis_fetch_task.md) - Task information from Aurora
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -39,4 +39,4 @@ australis fetch task status [flags]
* [australis fetch task](australis_fetch_task.md) - Task information from Aurora
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -35,4 +35,4 @@ Force the scheduler to do a snapshot, a backup, or a task reconciliation.
* [australis force recon](australis_force_recon.md) - Force the leading scheduler to perform a reconciliation.
* [australis force snapshot](australis_force_snapshot.md) - Force the leading scheduler to perform a Snapshot.
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -37,4 +37,4 @@ australis force backup [flags]
* [australis force](australis_force.md) - Force the scheduler to do a snapshot, a backup, or a task reconciliation.
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -41,4 +41,4 @@ state for all currently known non-terminal tasks.
* [australis force recon explicit](australis_force_recon_explicit.md) - Force the leading scheduler to perform an explicit recon.
* [australis force recon implicit](australis_force_recon_implicit.md) - Force the leading scheduler to perform an implicit recon.
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -38,4 +38,4 @@ australis force recon explicit [batch_size] [flags]
* [australis force recon](australis_force_recon.md) - Force the leading scheduler to perform a reconciliation.
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -37,4 +37,4 @@ australis force recon implicit [flags]
* [australis force recon](australis_force_recon.md) - Force the leading scheduler to perform a reconciliation.
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -37,4 +37,4 @@ australis force snapshot [flags]
* [australis force](australis_force.md) - Force the scheduler to do a snapshot, a backup, or a task reconciliation.
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -34,4 +34,4 @@ Kill an Aurora Job
* [australis kill entire-cluster](australis_kill_entire-cluster.md) - Kill every task in the cluster.
* [australis kill job](australis_kill_job.md) - Kill an Aurora Job
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -36,4 +36,4 @@ australis kill entire-cluster [flags]
* [australis kill](australis_kill.md) - Kill an Aurora Job
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -39,4 +39,4 @@ australis kill job [flags]
* [australis kill](australis_kill.md) - Kill an Aurora Job
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

36
docs/australis_monitor.md Normal file
View file

@ -0,0 +1,36 @@
## australis monitor
Watch for a specific state change
### Synopsis
Watch for a specific state change
### Options
```
-h, --help help for monitor
```
### Options inherited from parent commands
```
-a, --caCertsPath string Path where CA certificates can be found.
-c, --clientCert string Client certificate to use to connect to Aurora.
-k, --clientKey string Client key to use to connect to Aurora.
--config string Config file to use. (default "/etc/aurora/australis.yml")
-l, --logLevel string Set logging level [panic fatal error warning info debug trace]. (default "info")
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
--toJSON Print output in JSON format.
-u, --username string Username to use for API authentication
-z, --zookeeper string Zookeeper node(s) where Aurora stores information. (comma separated list)
```
### SEE ALSO
* [australis](australis.md) - australis is a client for Apache Aurora
* [australis monitor hosts](australis_monitor_hosts.md) - Watch a host maintenance status until it enters one of the desired statuses.
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -0,0 +1,43 @@
## australis monitor hosts
Watch a host maintenance status until it enters one of the desired statuses.
### Synopsis
Provide a list of hosts to monitor for desired statuses. Statuses may be passed using the --statuses
flag with a list of comma separated statuses. Statuses include [NONE, SCHEDULED, DRAINED, DRAINING]
```
australis monitor hosts [flags]
```
### Options
```
-h, --help help for hosts
--interval duration Interval at which to poll scheduler. (default 5s)
--statuses strings List of acceptable statuses for a host to be in. (case-insensitive) [NONE, SCHEDULED, DRAINED, DRAINING] (default [DRAINED])
--timeout duration Time after which the monitor will stop polling and throw an error. (default 10m0s)
```
### Options inherited from parent commands
```
-a, --caCertsPath string Path where CA certificates can be found.
-c, --clientCert string Client certificate to use to connect to Aurora.
-k, --clientKey string Client key to use to connect to Aurora.
--config string Config file to use. (default "/etc/aurora/australis.yml")
-l, --logLevel string Set logging level [panic fatal error warning info debug trace]. (default "info")
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
--toJSON Print output in JSON format.
-u, --username string Username to use for API authentication
-z, --zookeeper string Zookeeper node(s) where Aurora stores information. (comma separated list)
```
### SEE ALSO
* [australis monitor](australis_monitor.md) - Watch for a specific state change
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -33,4 +33,4 @@ rollback an operation such as an Update
* [australis](australis.md) - australis is a client for Apache Aurora
* [australis rollback update](australis_rollback_update.md) - rollback an update that is currently paused
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -41,4 +41,4 @@ australis rollback update [flags]
* [australis rollback](australis_rollback.md) - rollback an operation such as an Update
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -33,4 +33,4 @@ Set a value in the Aurora Scheduler.
* [australis](australis.md) - australis is a client for Apache Aurora
* [australis set quota](australis_set_quota.md) - Set Quota resources for a role.
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -36,4 +36,4 @@ australis set quota <role> cpu:<value> ram:<value> disk:<value> [flags]
* [australis set](australis_set.md) - Set a value in the Aurora Scheduler.
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -35,4 +35,4 @@ Start a service, maintenance on a host (DRAIN), a snapshot, or a backup.
* [australis start maintenance](australis_start_maintenance.md) - Place a list of space separated Mesos Agents into maintenance mode.
* [australis start sla-drain](australis_start_sla-drain.md) - Place a list of space separated Mesos Agents into maintenance mode using SLA aware strategies.
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -41,4 +41,4 @@ australis start drain [space separated host list] [flags]
* [australis start](australis_start.md) - Start a service, maintenance on a host (DRAIN), a snapshot, or a backup.
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -40,4 +40,4 @@ australis start maintenance [space separated host list] [flags]
* [australis start](australis_start.md) - Start a service, maintenance on a host (DRAIN), a snapshot, or a backup.
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -37,4 +37,4 @@ expects a space separated list of hosts to place into maintenance mode.
* [australis start sla-drain count](australis_start_sla-drain_count.md) - Place a list of space separated Mesos Agents into maintenance mode using the count SLA aware policy as a fallback.
* [australis start sla-drain percentage](australis_start_sla-drain_percentage.md) - Place a list of space separated Mesos Agents into maintenance mode using the percentage SLA aware policy as a fallback.
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -14,11 +14,12 @@ australis start sla-drain count [space separated host list] [flags]
### Options
```
--count int Instances count that should be running to meet SLA. (default 5)
--duration duration Window of time from which we derive the SLA. (default 10m0s)
-h, --help help for count
--interval duration Interval at which to poll scheduler. (default 5s)
--timeout duration Time after which the monitor will stop polling and throw an error. (default 20m0s)
--count int Instances count that should be running to meet SLA. (default 5)
--duration RUNNING Minimum time duration a task needs to be RUNNING to be treated as active. (default 45s)
-h, --help help for count
--interval duration Interval at which to poll scheduler. (default 10s)
--sla-limit duration Time limit after which SLA-Aware drain sheds SLA Awareness. (default 1h0m0s)
--timeout duration Time after which the monitor will stop polling and throw an error. (default 20m0s)
```
### Options inherited from parent commands
@ -41,4 +42,4 @@ australis start sla-drain count [space separated host list] [flags]
* [australis start sla-drain](australis_start_sla-drain.md) - Place a list of space separated Mesos Agents into maintenance mode using SLA aware strategies.
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -14,11 +14,12 @@ australis start sla-drain percentage [space separated host list] [flags]
### Options
```
--duration duration Window of time from which we derive the SLA. (default 10m0s)
-h, --help help for percentage
--interval duration Interval at which to poll scheduler. (default 5s)
--percent float Percentage of instances that should be running to meet SLA. (default 75)
--timeout duration Time after which the monitor will stop polling and throw an error. (default 1m0s)
--duration RUNNING Minimum time duration a task needs to be RUNNING to be treated as active. (default 45s)
-h, --help help for percentage
--interval duration Interval at which to poll scheduler. (default 10s)
--percent float Percentage of instances that should be running to meet SLA. (default 75)
--sla-limit duration Time limit after which SLA-Aware drain sheds SLA Awareness. (default 1h0m0s)
--timeout duration Time after which the monitor will stop polling and throw an error. (default 20m0s)
```
### Options inherited from parent commands
@ -41,4 +42,4 @@ australis start sla-drain percentage [space separated host list] [flags]
* [australis start sla-drain](australis_start_sla-drain.md) - Place a list of space separated Mesos Agents into maintenance mode using SLA aware strategies.
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -34,4 +34,4 @@ Stop a service or maintenance on a host (DRAIN).
* [australis stop drain](australis_stop_drain.md) - Stop maintenance on a host (move to NONE).
* [australis stop update](australis_stop_update.md) - Stop update
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -38,4 +38,4 @@ australis stop drain [space separated host list] [flags]
* [australis stop](australis_stop.md) - Stop a service or maintenance on a host (DRAIN).
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -39,4 +39,4 @@ australis stop update [update ID] [flags]
* [australis stop](australis_stop.md) - Stop a service or maintenance on a host (DRAIN).
###### Auto generated by spf13/cobra on 21-Mar-2019
###### Auto generated by spf13/cobra on 22-Mar-2019