From fee20090d05d63e75a4ece5a5d431492c95c77e2 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Fri, 22 Mar 2019 19:01:10 -0700 Subject: [PATCH] Making SLA-Aware to plain Drain timeout configurable. Upgraded Dockerbuild for debian package to use go1.12.1 --- CHANGELOG | 4 ++++ cmd/root.go | 4 ++-- cmd/start.go | 16 +++++++++------- deb-packaging/Dockerfile | 2 +- debian/changelog | 7 +++++++ go.sum | 2 +- 6 files changed, 24 insertions(+), 11 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 5eae41b..b037ca3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +0.0.8 + +* Upgraded default timeouts and durations for sla-aware draining. + 0.0.7 * Initial migration to gorealis v2 diff --git a/cmd/root.go b/cmd/root.go index 936be8d..1dcda6b 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -31,9 +31,9 @@ var message = new(string) var updateID string var log = logrus.New() -const australisVer = "v0.0.7" +const australisVer = "v0.0.8" -var monitorInterval, monitorTimeout time.Duration +var monitorInterval, monitorTimeout, forceDrainTimeout time.Duration func init() { diff --git a/cmd/start.go b/cmd/start.go index e7469fe..eb010c2 100644 --- a/cmd/start.go +++ b/cmd/start.go @@ -23,18 +23,20 @@ func init() { startSLADrainCmd.AddCommand(startSLACountDrainCmd) // SLA Maintenance specific flags - startSLACountDrainCmd.Flags().DurationVar(&monitorInterval, "interval", time.Second*5, "Interval at which to poll scheduler.") + startSLACountDrainCmd.Flags().DurationVar(&monitorInterval, "interval", time.Second*10, "Interval at which to poll scheduler.") startSLACountDrainCmd.Flags().DurationVar(&monitorTimeout, "timeout", time.Minute*20, "Time after which the monitor will stop polling and throw an error.") startSLACountDrainCmd.Flags().Int64Var(&count, "count", 5, "Instances count that should be running to meet SLA.") - startSLACountDrainCmd.Flags().DurationVar(&duration, "duration", time.Minute*10, "Window of time from which we derive the SLA.") + startSLACountDrainCmd.Flags().DurationVar(&duration, "duration", time.Second*45, "Minimum time duration a task needs to be `RUNNING` to be treated as active.") + startSLACountDrainCmd.Flags().DurationVar(&forceDrainTimeout, "sla-limit", time.Minute*60, "Time limit after which SLA-Aware drain sheds SLA Awareness.") startSLADrainCmd.AddCommand(startSLAPercentageDrainCmd) // SLA Maintenance specific flags - startSLAPercentageDrainCmd.Flags().DurationVar(&monitorInterval, "interval", time.Second*5, "Interval at which to poll scheduler.") - startSLAPercentageDrainCmd.Flags().DurationVar(&monitorTimeout, "timeout", time.Minute*1, "Time after which the monitor will stop polling and throw an error.") + startSLAPercentageDrainCmd.Flags().DurationVar(&monitorInterval, "interval", time.Second*10, "Interval at which to poll scheduler.") + startSLAPercentageDrainCmd.Flags().DurationVar(&monitorTimeout, "timeout", time.Minute*20, "Time after which the monitor will stop polling and throw an error.") startSLAPercentageDrainCmd.Flags().Float64Var(&percent, "percent", 75.0, "Percentage of instances that should be running to meet SLA.") - startSLAPercentageDrainCmd.Flags().DurationVar(&duration, "duration", time.Minute*10, "Window of time from which we derive the SLA.") + startSLAPercentageDrainCmd.Flags().DurationVar(&duration, "duration", time.Second*45, "Minimum time duration a task needs to be `RUNNING` to be treated as active.") + startSLAPercentageDrainCmd.Flags().DurationVar(&forceDrainTimeout, "sla-limit", time.Minute*60, "Time limit after which SLA-Aware drain sheds SLA Awareness.") startCmd.AddCommand(startMaintenanceCmd) @@ -122,7 +124,7 @@ func drain(cmd *cobra.Command, args []string) { func slaDrain(policy *aurora.SlaPolicy, hosts ...string) { - result, err := client.SLADrainHosts(policy, 60*60, hosts...) + result, err := client.SLADrainHosts(policy, int64(forceDrainTimeout.Seconds()), hosts...) if err != nil { log.Fatalf("error: %+v\n", err) } @@ -139,7 +141,7 @@ func slaDrain(policy *aurora.SlaPolicy, hosts ...string) { maintenanceMonitorPrint(hostResult, []aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED}) if err != nil { - log.Fatalln("error: %+v", err) + log.Fatalf("error: %+v", err) } } diff --git a/deb-packaging/Dockerfile b/deb-packaging/Dockerfile index 823be68..adafba1 100644 --- a/deb-packaging/Dockerfile +++ b/deb-packaging/Dockerfile @@ -2,7 +2,7 @@ FROM ubuntu:16.04 RUN apt-get update -y && \ apt-get install -y build-essential devscripts dh-exec dh-make git lintian wget && \ - wget https://dl.google.com/go/go1.11.5.linux-amd64.tar.gz -O /tmp/go.tar.gz + wget https://dl.google.com/go/go1.12.1.linux-amd64.tar.gz -O /tmp/go.tar.gz RUN tar -C /usr/local -xzf /tmp/go.tar.gz diff --git a/debian/changelog b/debian/changelog index 8ffbd17..39075e5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +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 + + -- Renan DelValle Fri, 22 Mar 2019 15:10:00 -0700 + australis (0.0.7) unstable; urgency=medium * Upgraded australis to gorealis v2. diff --git a/go.sum b/go.sum index c5969d5..f93d82c 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,4 @@ -git.apache.org/thrift.git v0.12.0 h1:CMxsZlAmxKs+VAZMlDDL0wXciMblJcutQbEe3A9CYUM= +git.apache.org/thrift.git v0.12.0 h1:692K1/SsOcQvkvMRMdt60FCq2AvKpuQNM6sIeH3mN4s= git.apache.org/thrift.git v0.12.0/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=