diff --git a/api/jobs.go b/api/jobs.go index 912bcb972..17e75daff 100644 --- a/api/jobs.go +++ b/api/jobs.go @@ -119,7 +119,6 @@ type Job struct { Constraints []*Constraint TaskGroups []*TaskGroup Update *UpdateStrategy - GC bool Meta map[string]string Status string StatusDescription string diff --git a/jobspec/parse.go b/jobspec/parse.go index 2573341bd..765f58b3a 100644 --- a/jobspec/parse.go +++ b/jobspec/parse.go @@ -91,7 +91,6 @@ func parseJob(result *structs.Job, list *ast.ObjectList) error { delete(m, "meta") delete(m, "update") delete(m, "periodic") - delete(m, "gc") // Set the ID and name to the object key result.ID = obj.Keys[0].Token.Value().(string) @@ -136,13 +135,6 @@ func parseJob(result *structs.Job, list *ast.ObjectList) error { } } - // If we have a gc config, then parse that - if o := listVal.Filter("gc"); len(o.Items) > 0 { - if err := parseGC(&result.GC, o); err != nil { - return err - } - } - // Parse out meta fields. These are in HCL as a list so we need // to iterate over them and merge them. if metaO := listVal.Filter("meta"); len(metaO.Items) > 0 { @@ -722,33 +714,3 @@ func parsePeriodic(result **structs.PeriodicConfig, list *ast.ObjectList) error *result = &p return nil } - -func parseGC(result *bool, list *ast.ObjectList) error { - list = list.Elem() - if len(list.Items) > 1 { - return fmt.Errorf("only one 'gc' block allowed per job") - } - - // Get our resource object - o := list.Items[0] - - var m map[string]interface{} - if err := hcl.DecodeObject(&m, o.Val); err != nil { - return err - } - - // Enabled by default if the gc block exists. - enabled := false - if value, ok := m["enabled"]; !ok { - enabled = true - } else { - var err error - enabled, err = parseBool(value) - if err != nil { - return fmt.Errorf("gc.enabled should be set to true or false; %v", err) - } - } - - *result = enabled - return nil -} diff --git a/jobspec/parse_test.go b/jobspec/parse_test.go index 7a89595f8..4497348eb 100644 --- a/jobspec/parse_test.go +++ b/jobspec/parse_test.go @@ -246,19 +246,6 @@ func TestParse(t *testing.T) { false, }, - { - "gc.hcl", - &structs.Job{ - ID: "foo", - Name: "foo", - Priority: 50, - Region: "global", - Type: "service", - GC: true, - }, - false, - }, - { "specify-job.hcl", &structs.Job{ diff --git a/jobspec/test-fixtures/gc.hcl b/jobspec/test-fixtures/gc.hcl deleted file mode 100644 index 5af5de1e1..000000000 --- a/jobspec/test-fixtures/gc.hcl +++ /dev/null @@ -1,5 +0,0 @@ -job "foo" { - gc { - enabled = true - } -} diff --git a/website/source/docs/jobspec/index.html.md b/website/source/docs/jobspec/index.html.md index d3f4ee650..99aefe2b4 100644 --- a/website/source/docs/jobspec/index.html.md +++ b/website/source/docs/jobspec/index.html.md @@ -156,23 +156,6 @@ The `job` object supports the following keys: and "h" suffix can be used, such as "30s". Both values default to zero, which disables rolling updates. -* `gc` - Toggles the job's eligibility for garbage collection. This allows jobs - to be garbage collected when all their evaluations and allocations are - terminal. The `gc` block has the following format: - - ``` - "gc" { - // Enabled is set to true by default if the "gc" block is included. - enabled = true - } - - // Equivalent configuration. - "gc" {} - ``` - - * `enabled`: Toggles the eligibility of a job for garbage collection. - - ### Task Group The `group` object supports the following keys: