Merge pull request #1 from aurora-scheduler/main

pull from the upstream
This commit is contained in:
lenhattan86 2020-11-13 10:48:05 -08:00 committed by GitHub
commit 8ebf66426a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 213 additions and 214 deletions

23
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,23 @@
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Go for use with actions
uses: actions/setup-go@v2
with:
go-version: 1.15
- name: Install goimports
run: go get golang.org/x/tools/cmd/goimports
- name: Set env with list of directories in repo containin go code
run: echo GO_USR_DIRS=$(go list -f {{.Dir}} ./... | grep -E -v "/gen-go/|/vendor/") >> $GITHUB_ENV
- name: Run goimports check
run: test -z `for d in $GO_USR_DIRS; do goimports -d "$d" | tee /dev/stderr; done`
- name: Run tests
run: go build -o australis *.go

View file

@ -42,4 +42,3 @@ In MacOS this directory is $(brew --prefix)/etc/bash_completion.d if auto comple
rootCmd.GenBashCompletionFile(filename)
},
}

View file

@ -21,13 +21,14 @@ import (
func init() {
rootCmd.AddCommand(createCmd)
createCmd.Flags().BoolVarP(&monitor, "monitor", "m", true, "monitor the result after sending the command")
}
var createCmd = &cobra.Command{
Use: "create",
Short: "Create an Aurora Job",
Run: createJob,
Args: cobra.ExactArgs(1),
Args: cobra.RangeArgs(1, 2),
}
func createJob(cmd *cobra.Command, args []string) {
@ -46,14 +47,15 @@ func createJob(cmd *cobra.Command, args []string) {
log.Fatal("unable to create Aurora job: ", err)
}
if ok, monitorErr := client.MonitorInstances(auroraJob.JobKey(),
auroraJob.GetInstanceCount(),
5,
50); !ok || monitorErr != nil {
if err := client.KillJob(auroraJob.JobKey()); err != nil {
log.Fatal(monitorErr, err)
if monitor {
if ok, monitorErr := client.MonitorInstances(auroraJob.JobKey(),
auroraJob.GetInstanceCount(),
5,
50); !ok || monitorErr != nil {
if err := client.KillJob(auroraJob.JobKey()); err != nil {
log.Fatal(monitorErr, err)
}
log.Fatal(monitorErr)
}
log.Fatal(monitorErr)
}
}

View file

@ -30,6 +30,7 @@ func init() {
killJobCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment")
killJobCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
killJobCmd.Flags().StringVarP(name, "name", "n", "", "Aurora Name")
killJobCmd.Flags().BoolVarP(&monitor, "monitor", "m", true, "monitor the result after sending the command")
killJobCmd.MarkFlagRequired("environment")
killJobCmd.MarkFlagRequired("role")
killJobCmd.MarkFlagRequired("name")
@ -57,8 +58,9 @@ func killJob(cmd *cobra.Command, args []string) {
if err != nil {
log.Fatalln(err)
}
if ok, err := client.MonitorInstances(job.JobKey(), 0, 5, 50); !ok || err != nil {
log.Fatalln("Unable to kill all instances of job")
if monitor {
if ok, err := client.MonitorInstances(job.JobKey(), 0, 5, 50); !ok || err != nil {
log.Fatalln("Unable to kill all instances of job")
}
}
}

View file

@ -15,34 +15,33 @@
package cmd
import (
"github.com/aurora-scheduler/gorealis/v2/gen-go/apache/aurora"
"github.com/spf13/cobra"
"github.com/aurora-scheduler/gorealis/v2/gen-go/apache/aurora"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(restartCmd)
rootCmd.AddCommand(restartCmd)
restartCmd.AddCommand(restartJobCmd)
restartJobCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment")
restartJobCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
restartJobCmd.Flags().StringVarP(name, "name", "n", "", "Aurora Name")
restartCmd.AddCommand(restartJobCmd)
restartJobCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment")
restartJobCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
restartJobCmd.Flags().StringVarP(name, "name", "n", "", "Aurora Name")
}
var restartCmd = &cobra.Command{
Use: "restart",
Short: "Restart an Aurora Job.",
Use: "restart",
Short: "Restart an Aurora Job.",
}
var restartJobCmd = &cobra.Command{
Use: "job",
Short: "Restart a Job.",
Run: restartJob,
Use: "job",
Short: "Restart a Job.",
Run: restartJob,
}
func restartJob(cmd *cobra.Command, args []string) {
key := aurora.JobKey{Environment: *env, Role: *role, Name: *name}
if err := client.RestartJob(key); err != nil {
log.Fatal("unable to create Aurora job: ", err)
}
key := aurora.JobKey{Environment: *env, Role: *role, Name: *name}
if err := client.RestartJob(key); err != nil {
log.Fatal("unable to create Aurora job: ", err)
}
}

View file

@ -46,9 +46,11 @@ var count int64
var filename string
var message = new(string)
var updateID string
var monitor bool
var timeout time.Duration // seconds
var log = logrus.New()
const australisVer = "v0.22.0"
const australisVer = "v1.0.1"
var forceDrainTimeout time.Duration
@ -67,6 +69,7 @@ func init() {
rootCmd.PersistentFlags().StringVar(&configFile, "config", "/etc/aurora/australis.yml", "Config file to use.")
rootCmd.PersistentFlags().BoolVar(&toJson, "toJSON", false, "Print output in JSON format.")
rootCmd.PersistentFlags().StringVarP(&logLevel, "logLevel", "l", "info", "Set logging level ["+internal.GetLoggingLevels()+"].")
rootCmd.PersistentFlags().DurationVarP(&timeout, "timeout", "t", 20*time.Second, "Gorealis timeout.")
}
var rootCmd = &cobra.Command{
@ -141,7 +144,7 @@ func connect(cmd *cobra.Command, args []string) {
realisOptions := []realis.ClientOption{realis.BasicAuth(username, password),
realis.ThriftJSON(),
realis.Timeout(20 * time.Second),
realis.Timeout(timeout),
realis.BackOff(realis.Backoff{
Steps: 2,
Duration: 10 * time.Second,

View file

@ -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.12.6.linux-amd64.tar.gz -O /tmp/go.tar.gz
wget https://dl.google.com/go/go1.15.2.linux-amd64.tar.gz -O /tmp/go.tar.gz
RUN tar -C /usr/local -xzf /tmp/go.tar.gz

View file

@ -2,4 +2,4 @@
docker build . -t australis_deb_builder
docker run --rm -v $HOME/go/pkg/mod:/go/pkg/mod -v $(pwd)/..:/australis australis_builder
docker run --rm -v $HOME/go/pkg/mod:/go/pkg/mod -v $(pwd)/..:/australis australis_deb_builder

View file

@ -1,12 +1,9 @@
#!/bin/bash
# Temporary fix for a go mods bug
rm /australis/go.sum
# Build debian package
cd /australis
debuild -d -us -uc -b
# Move resulting packages to the dist folder
mkdir -p /australis/dist
mv /australis_*_amd64* /australis/dist
mv /australis_*_amd64* /australis/dist

20
debian/changelog vendored
View file

@ -1,8 +1,22 @@
australis (0.1.2) unstable; urgency=medium
australis (1.0.1) stable; urgency=medium
* Unreleased
* Added flag -m and --monitor that can be set in order to monitor a job creation or a job kill. By default monitor is set to true.
-- Renan DelValle <renanidelvalle@gmail.com> Mon, 19 Feb 2020 12:00:00 -0700
-- Renan Del Valle <maintainer@ridv.xyz> Wed, 30 Sep 2020 16:46:56 -0700
australis (1.0.0) stable; urgency=medium
* First stable release.
-- Renan Del Valle <maintainer@ridv.xyz> Wed, 30 Sep 2020 15:39:29 -0700
australis (0.22.0) unstable; urgency=medium
* Added support for starting job updates.
* Added support for setting SlaAwareness for updates.
* Added upport for scheduling cron jobs.
-- Renan Del Valle <maintainer@ridv.xyz> Thu, 07 May 2020 12:00:00 -0700
australis (0.1.1) unstable; urgency=medium

View file

@ -18,6 +18,7 @@ A light-weight command line client for use with Apache Aurora built using goreal
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -39,4 +40,4 @@ A light-weight command line client for use with Apache Aurora built using goreal
* [australis start](australis_start.md) - Start a service, maintenance on a host (DRAIN), a snapshot, an update, or a backup.
* [australis stop](australis_stop.md) - Stop a service or maintenance on a host (DRAIN).
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -13,7 +13,8 @@ australis create [flags]
### Options
```
-h, --help help for create
-h, --help help for create
-m, --monitor monitor the result after sending the command (default true)
```
### Options inherited from parent commands
@ -27,6 +28,7 @@ australis create [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -36,4 +38,4 @@ australis create [flags]
* [australis](australis.md) - australis is a client for Apache Aurora
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -23,6 +23,7 @@ Fetch information from Aurora
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -36,4 +37,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 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -28,6 +28,7 @@ australis fetch jobs [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -37,4 +38,4 @@ australis fetch jobs [flags]
* [australis fetch](australis_fetch.md) - Fetch information from Aurora
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -29,6 +29,7 @@ australis fetch leader [zkNode0, zkNode1, ...zkNodeN] [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -38,4 +39,4 @@ australis fetch leader [zkNode0, zkNode1, ...zkNodeN] [flags]
* [australis fetch](australis_fetch.md) - Fetch information from Aurora
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -27,6 +27,7 @@ australis fetch status [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -36,4 +37,4 @@ australis fetch status [flags]
* [australis fetch](australis_fetch.md) - Fetch information from Aurora
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -23,6 +23,7 @@ Task information from Aurora
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -34,4 +35,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 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -30,6 +30,7 @@ australis fetch task config [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -39,4 +40,4 @@ australis fetch task config [flags]
* [australis fetch task](australis_fetch_task.md) - Task information from Aurora
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -30,6 +30,7 @@ australis fetch task status [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -39,4 +40,4 @@ australis fetch task status [flags]
* [australis fetch task](australis_fetch_task.md) - Task information from Aurora
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -23,6 +23,7 @@ Force the scheduler to do a snapshot, a backup, or a task reconciliation.
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -35,4 +36,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 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -28,6 +28,7 @@ australis force backup [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -37,4 +38,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 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -30,6 +30,7 @@ state for all currently known non-terminal tasks.
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -41,4 +42,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 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -29,6 +29,7 @@ australis force recon explicit [batch_size] [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -38,4 +39,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 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -28,6 +28,7 @@ australis force recon implicit [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -37,4 +38,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 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -28,6 +28,7 @@ australis force snapshot [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -37,4 +38,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 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -23,6 +23,7 @@ Kill an Aurora Job
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -33,4 +34,4 @@ Kill an Aurora Job
* [australis](australis.md) - australis is a client for Apache Aurora
* [australis kill job](australis_kill_job.md) - Kill an Aurora Job
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -1,39 +0,0 @@
## australis kill entire-cluster
Kill every task in the cluster.
### Synopsis
To be written.
```
australis kill entire-cluster [flags]
```
### Options
```
-h, --help help for entire-cluster
```
### 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 kill](australis_kill.md) - Kill an Aurora Job
###### Auto generated by spf13/cobra on 22-Mar-2019

View file

@ -15,6 +15,7 @@ australis kill job [flags]
```
-e, --environment string Aurora Environment
-h, --help help for job
-m, --monitor monitor the result after sending the command (default true)
-n, --name string Aurora Name
-r, --role string Aurora Role
```
@ -30,6 +31,7 @@ australis kill job [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -39,4 +41,4 @@ australis kill job [flags]
* [australis kill](australis_kill.md) - Kill an Aurora Job
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -23,6 +23,7 @@ Watch for a specific state change
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -33,4 +34,4 @@ Watch for a specific state change
* [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 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -17,7 +17,6 @@ australis monitor hosts [flags]
-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
@ -31,6 +30,7 @@ australis monitor hosts [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -40,4 +40,4 @@ australis monitor hosts [flags]
* [australis monitor](australis_monitor.md) - Watch for a specific state change
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -31,6 +31,7 @@ australis pulse [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -40,4 +41,4 @@ australis pulse [flags]
* [australis](australis.md) - australis is a client for Apache Aurora
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -23,6 +23,7 @@ Restart an Aurora Job.
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -33,4 +34,4 @@ Restart an Aurora Job.
* [australis](australis.md) - australis is a client for Apache Aurora
* [australis restart job](australis_restart_job.md) - Restart a Job.
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -30,6 +30,7 @@ australis restart job [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -39,4 +40,4 @@ australis restart job [flags]
* [australis restart](australis_restart.md) - Restart an Aurora Job.
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -32,6 +32,7 @@ australis resume [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -41,4 +42,4 @@ australis resume [flags]
* [australis](australis.md) - australis is a client for Apache Aurora
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -23,6 +23,7 @@ Rollback an operation such as an Update
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -33,4 +34,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
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -32,6 +32,7 @@ australis rollback update [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -41,4 +42,4 @@ australis rollback update [flags]
* [australis rollback](australis_rollback.md) - Rollback an operation such as an Update
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -27,6 +27,7 @@ australis schedule [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -36,4 +37,4 @@ australis schedule [flags]
* [australis](australis.md) - australis is a client for Apache Aurora
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -23,6 +23,7 @@ Set a value in the Aurora Scheduler.
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -33,4 +34,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 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -27,6 +27,7 @@ australis set quota <role> cpu:<value> ram:<value> disk:<value> [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -36,4 +37,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 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -23,6 +23,7 @@ Start a service, maintenance on a host (DRAIN), a snapshot, an update, or a back
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -36,4 +37,4 @@ Start a service, maintenance on a host (DRAIN), a snapshot, an update, or a back
* [australis start sla-drain](australis_start_sla-drain.md) - Place a list of space separated Mesos Agents into maintenance mode using SLA aware strategies.
* [australis start update](australis_start_update.md) - Start an update on an Aurora long running service.
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -20,7 +20,6 @@ australis start drain [space separated host list or use JSON flags] [flags]
--interval duration Interval at which to poll scheduler. (default 5s)
--json Read JSON list of agents from the STDIN.
--json-file string JSON file to read list of agents from.
--timeout duration Time after which the monitor will stop polling and throw an error. (default 10m0s)
```
### Options inherited from parent commands
@ -34,6 +33,7 @@ australis start drain [space separated host list or use JSON flags] [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -43,4 +43,4 @@ australis start drain [space separated host list or use JSON flags] [flags]
* [australis start](australis_start.md) - Start a service, maintenance on a host (DRAIN), a snapshot, an update, or a backup.
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -19,7 +19,6 @@ australis start maintenance [space separated host list or use JSON flags] [flags
--interval duration Interval at which to poll scheduler. (default 5s)
--json Read JSON list of agents from the STDIN.
--json-file string JSON file to read list of agents from.
--timeout duration Time after which the monitor will stop polling and throw an error. (default 10m0s)
```
### Options inherited from parent commands
@ -33,6 +32,7 @@ australis start maintenance [space separated host list or use JSON flags] [flags
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -42,4 +42,4 @@ australis start maintenance [space separated host list or use JSON flags] [flags
* [australis start](australis_start.md) - Start a service, maintenance on a host (DRAIN), a snapshot, an update, or a backup.
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -28,7 +28,6 @@ australis start sla-drain [space separated host list or use JSON flags] [flags]
--json-file string JSON file to read list of agents from.
--percentage float Percentage of instances that should be running to meet SLA. (default 80)
--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
@ -42,6 +41,7 @@ australis start sla-drain [space separated host list or use JSON flags] [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -51,4 +51,4 @@ australis start sla-drain [space separated host list or use JSON flags] [flags]
* [australis start](australis_start.md) - Start a service, maintenance on a host (DRAIN), a snapshot, an update, or a backup.
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -1,45 +0,0 @@
## australis start sla-drain count
Place a list of space separated Mesos Agents into maintenance mode using the count SLA aware policy as a fallback.
### Synopsis
Adds a Mesos Agent to Aurora's Drain list. Tasks will be drained using the count SLA policy as a fallback
when a Job does not have a defined SLA policy.
```
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 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
```
-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 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 22-Mar-2019

View file

@ -1,45 +0,0 @@
## australis start sla-drain percentage
Place a list of space separated Mesos Agents into maintenance mode using the percentage SLA aware policy as a fallback.
### Synopsis
Adds a Mesos Agent to Aurora's Drain list. Tasks will be drained using the percentage SLA policy as a fallback
when a Job does not have a defined SLA policy.
```
australis start sla-drain percentage [space separated host list] [flags]
```
### Options
```
--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
```
-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 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 22-Mar-2019

View file

@ -16,7 +16,6 @@ australis start update [update config] [flags]
```
-h, --help help for update
--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 10m0s)
```
### Options inherited from parent commands
@ -30,6 +29,7 @@ australis start update [update config] [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -39,4 +39,4 @@ australis start update [update config] [flags]
* [australis start](australis_start.md) - Start a service, maintenance on a host (DRAIN), a snapshot, an update, or a backup.
###### Auto generated by spf13/cobra on 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -23,6 +23,7 @@ Stop a service or maintenance on a host (DRAIN).
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -34,4 +35,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 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -15,7 +15,6 @@ australis stop drain [space separated host list] [flags]
```
-h, --help help for drain
--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 1m0s)
```
### Options inherited from parent commands
@ -29,6 +28,7 @@ australis stop drain [space separated host list] [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -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 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -30,6 +30,7 @@ australis stop update [update ID] [flags]
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--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)
@ -39,4 +40,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 7-May-2020
###### Auto generated by spf13/cobra on 5-Nov-2020

View file

@ -47,6 +47,17 @@ type Container struct {
Docker *DockerContainer `yaml:"docker"`
}
type ValueConstraint struct {
Name string `yaml:"name"`
Values []string `yaml:"values"`
Negated bool `yaml:"negated"`
}
type LimitConstraint struct {
Name string `yaml:"name"`
Limit int32 `yaml:"limit"`
}
type Job struct {
Environment string `yaml:"environment"`
Role string `yaml:"role"`
@ -64,6 +75,8 @@ type Job struct {
Container *Container `yaml:"container,omitempty"`
CronSchedule *string `yaml:"cronSchedule,omitempty"`
CronCollisionPolicy *string `yaml:"cronCollisionPolicy,omitempty"`
ValueConstraints []ValueConstraint `yaml:"valueConstraints,flow,omitempty"`
LimitConstraints []LimitConstraint `yaml:"limitConstraints,flow,omitempty"`
}
func (j *Job) ToRealis() (*realis.AuroraJob, error) {
@ -125,6 +138,15 @@ func (j *Job) ToRealis() (*realis.AuroraJob, error) {
}
// Setting Constraints
for _, valConstraint := range j.ValueConstraints {
auroraJob.AddValueConstraint(valConstraint.Name, valConstraint.Negated, valConstraint.Values...)
}
for _, limit := range j.LimitConstraints {
auroraJob.AddLimitConstraint(limit.Name, limit.Limit)
}
return auroraJob, nil
}
@ -162,6 +184,7 @@ func (j *Job) Validate() error {
}
return nil
}
func (j *Job) ValidateCron() error {
if j.CronSchedule == nil {
return errors.New("cron schedule must be set")

View file

@ -25,6 +25,11 @@ func TestUnmarshalJob(t *testing.T) {
assert.NoError(t, err)
}
func TestUnmarshalDedicatedJob(t *testing.T) {
_, err := UnmarshalJob("../test/hello_world_dedicated.yaml")
assert.NoError(t, err)
}
func TestUnmarshalCron(t *testing.T) {
cron, err := UnmarshalJob("../test/hello_world_cron.yaml")
assert.NoError(t, err)
@ -35,4 +40,3 @@ func TestUnmarshalUpdate(t *testing.T) {
_, err := UnmarshalUpdate("../test/update_hello_world.yaml")
assert.NoError(t, err)
}

View file

@ -0,0 +1,30 @@
---
environment: "prod"
role: "vagrant"
name: "hello_world"
cpu: 0.09
ram: 64
disk: 128
instances: 1
valueConstraints:
- name: "dedicated"
values:
- "vagrant/bar"
thermos:
- name: "bootstrap"
cmd: "echo bootstrapping"
- name: "hello_gorealis"
cmd: "while true; do echo hello world from gorealis; sleep 10; done"
updateSettings:
maxPerInstanceFailures: 1
maxFailedInstances: 1
minTimeInRunning: 1m
rollbackOnFailure: true
instanceRanges:
- start: 1
end: 4
blockIfNoPulseAfter: 1m
slaAware: false
strategy:
name: Batch
groupSize: 2