Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated nomad API to 0.10.3 #97

Merged
merged 1 commit into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
## 1.5.0 (Unreleased)
## 1.4.4 (Unreleased)

IMPROVEMENTS:

* **Target Nomad 0.10.3**: updated the nomad client to support Nomad API version 0.10.3 ([#96](https://github.com/terraform-providers/terraform-provider-nomad/issues/96))

## 1.4.3 (February 07, 2020)

IMPROVEMENTS:
Expand All @@ -13,7 +18,7 @@ BUG FIXES:

IMPROVEMENTS:

* **Target Nomad 0.10.0**: updated the noomad client to support Nomad API version 0.10.0 ([#77](https://github.com/terraform-providers/terraform-provider-nomad/issues/77))
* **Target Nomad 0.10.0**: updated the nomad client to support Nomad API version 0.10.0 ([#77](https://github.com/terraform-providers/terraform-provider-nomad/issues/77))

BUG FIXES:

Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ exclude (

require (
github.com/google/go-cmp v0.3.0
github.com/gorilla/websocket v1.4.1 // indirect
github.com/hashicorp/go-multierror v1.0.0
github.com/hashicorp/go-version v1.2.0
github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f
github.com/hashicorp/nomad/api v0.0.0-20191010200500-0e6af1085602
github.com/hashicorp/nomad/api v0.0.0-20200129172448-74e08d5af489
github.com/hashicorp/terraform-plugin-sdk v1.0.0
github.com/hashicorp/vault v0.10.4
github.com/mitchellh/mapstructure v1.1.2
Expand Down
8 changes: 2 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,8 @@ github.com/hashicorp/hil v0.0.0-20190212112733-ab17b08d6590 h1:2yzhWGdgQUWZUCNK+
github.com/hashicorp/hil v0.0.0-20190212112733-ab17b08d6590/go.mod h1:n2TSygSNwsLJ76m8qFXTSc7beTb+auJxYdqrnoqwZWE=
github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
github.com/hashicorp/nomad/api v0.0.0-20190906191921-82f214630cd6 h1:kiTndH1QxgBybn2s/sHk75LDre3hjZ8Ihrb8ycM+9PM=
github.com/hashicorp/nomad/api v0.0.0-20190906191921-82f214630cd6/go.mod h1:BDngVi1f4UA6aJq9WYTgxhfWSE1+42xshvstLU2fRGk=
github.com/hashicorp/nomad/api v0.0.0-20191007164342-7b08e19f7268 h1:vqGLw5utD6HsEvEd1vqTZ6nMZHjdc8suiuc5/76GTSo=
github.com/hashicorp/nomad/api v0.0.0-20191007164342-7b08e19f7268/go.mod h1:BDngVi1f4UA6aJq9WYTgxhfWSE1+42xshvstLU2fRGk=
github.com/hashicorp/nomad/api v0.0.0-20191010200500-0e6af1085602 h1:rpJ6qZg+bTbf29ME0azxxW1zUZKq+Wh8hukVLlH5Bmw=
github.com/hashicorp/nomad/api v0.0.0-20191010200500-0e6af1085602/go.mod h1:BDngVi1f4UA6aJq9WYTgxhfWSE1+42xshvstLU2fRGk=
github.com/hashicorp/nomad/api v0.0.0-20200129172448-74e08d5af489 h1:MCZpZRk0tN0ezSBjwtVzYZwOz2KBmNONI1rHz6XE39E=
github.com/hashicorp/nomad/api v0.0.0-20200129172448-74e08d5af489/go.mod h1:Kbx02dGxN6wnAHhSbTqeg/sdACnMMD20BFkVuAxJzds=
github.com/hashicorp/terraform-config-inspect v0.0.0-20190821133035-82a99dc22ef4 h1:fTkL0YwjohGyN7AqsDhz6bwcGBpT+xBqi3Qhpw58Juw=
github.com/hashicorp/terraform-config-inspect v0.0.0-20190821133035-82a99dc22ef4/go.mod h1:JDmizlhaP5P0rYTTZB0reDMefAiJyfWPEtugV4in1oI=
github.com/hashicorp/terraform-plugin-sdk v1.0.0 h1:3AjuuV1LJKs1NlG+heUgqWN6/QCSx2kDhyS6K7F0fTw=
Expand Down
16 changes: 16 additions & 0 deletions nomad/core/jobspec/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func parseConstraints(result *[]*api.Constraint, list *ast.ObjectList) error {
"set_contains",
"value",
"version",
"semver",
}
if err := helper.CheckHCLKeys(o.Val, valid); err != nil {
return err
Expand All @@ -159,6 +160,13 @@ func parseConstraints(result *[]*api.Constraint, list *ast.ObjectList) error {
m["RTarget"] = constraint
}

// If "semver" is provided, set the operand
// to "semver" and the value to the "RTarget"
if constraint, ok := m[api.ConstraintSemver]; ok {
m["Operand"] = api.ConstraintSemver
m["RTarget"] = constraint
}

// If "regexp" is provided, set the operand
// to "regexp" and the value to the "RTarget"
if constraint, ok := m[api.ConstraintRegex]; ok {
Expand Down Expand Up @@ -219,6 +227,7 @@ func parseAffinities(result *[]*api.Affinity, list *ast.ObjectList) error {
"set_contains_all",
"value",
"version",
"semver",
"weight",
}
if err := helper.CheckHCLKeys(o.Val, valid); err != nil {
Expand All @@ -241,6 +250,13 @@ func parseAffinities(result *[]*api.Affinity, list *ast.ObjectList) error {
m["RTarget"] = affinity
}

// If "semver" is provided, set the operand
// to "semver" and the value to the "RTarget"
if affinity, ok := m[api.ConstraintSemver]; ok {
m["Operand"] = api.ConstraintSemver
m["RTarget"] = affinity
}

// If "regexp" is provided, set the operand
// to "regexp" and the value to the "RTarget"
if affinity, ok := m[api.ConstraintRegex]; ok {
Expand Down
2 changes: 1 addition & 1 deletion nomad/core/jobspec/parse_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func parseGroups(result *api.Job, list *ast.ObjectList) error {

// Parse network
if o := listVal.Filter("network"); len(o.Items) > 0 {
networks, err := parseNetwork(o)
networks, err := ParseNetwork(o)
if err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion nomad/core/jobspec/parse_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import (
"github.com/terraform-providers/terraform-provider-nomad/nomad/core/helper"
)

func parseNetwork(o *ast.ObjectList) (*api.NetworkResource, error) {
// ParseNetwork parses a collection containing exactly one NetworkResource
func ParseNetwork(o *ast.ObjectList) (*api.NetworkResource, error) {
if len(o.Items) > 1 {
return nil, fmt.Errorf("only one 'network' resource allowed")
}
Expand Down
3 changes: 2 additions & 1 deletion nomad/core/jobspec/parse_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ func parseSidecarService(o *ast.ObjectItem) (*api.ConsulSidecarService, error) {
valid := []string{
"port",
"proxy",
"tags",
}

if err := helper.CheckHCLKeys(o.Val, valid); err != nil {
Expand All @@ -216,7 +217,7 @@ func parseSidecarService(o *ast.ObjectItem) (*api.ConsulSidecarService, error) {
return nil, err
}
if err := dec.Decode(m); err != nil {
return nil, fmt.Errorf("foo: %v", err)
return nil, fmt.Errorf("sidecar_service: %v", err)
}

var proxyList *ast.ObjectList
Expand Down
3 changes: 2 additions & 1 deletion nomad/core/jobspec/parse_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ func parseResources(result *api.Resources, list *ast.ObjectList) error {

// Parse the network resources
if o := listVal.Filter("network"); len(o.Items) > 0 {
r, err := parseNetwork(o)
r, err := ParseNetwork(o)
if err != nil {
return fmt.Errorf("resource, %v", err)
}
Expand Down Expand Up @@ -522,6 +522,7 @@ func parseVolumeMounts(out *[]*api.VolumeMount, list *ast.ObjectList) error {
"volume",
"read_only",
"destination",
"propagation_mode",
}
if err := helper.CheckHCLKeys(item.Val, valid); err != nil {
return err
Expand Down
2 changes: 2 additions & 0 deletions nomad/resource_job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,7 @@ resource "nomad_job" "test" {
volume = "data"
destination = "/var/lib/data"
read_only = true
propagation_mode = "private"
}
}
}
Expand Down Expand Up @@ -1430,6 +1431,7 @@ resource "nomad_job" "test" {
local_bind_port = 8080
}
}
tags = ["bar", "foo"]
}
}
}
Expand Down
51 changes: 51 additions & 0 deletions vendor/github.com/hashicorp/nomad/api/agent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 8 additions & 11 deletions vendor/github.com/hashicorp/nomad/api/allocations.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 18 additions & 5 deletions vendor/github.com/hashicorp/nomad/api/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/github.com/hashicorp/nomad/api/constraint.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading