-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add Header and Method support for HTTP checks #3031
Conversation
command/agent/consul/unit_test.go
Outdated
Name: "name", | ||
ServiceID: serviceID, | ||
} | ||
expected.Timeout = "0s" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason these aren't inline with struct creation?
jobspec/parse.go
Outdated
if headerI, ok := cm["header"]; ok { | ||
headerRaw, ok := headerI.([]map[string]interface{}) | ||
if !ok { | ||
return fmt.Errorf("check -> header -> expected a []map[string]interface{} but found %T", headerI) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we show interface{} or []string since that is the only thing that is parsable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
Interval: 10 * time.Second, | ||
Timeout: 2 * time.Second, | ||
InitialStatus: capi.HealthPassing, | ||
Method: "POST", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a failing case? With numbers or something.
nomad/structs/diff.go
Outdated
@@ -592,6 +592,23 @@ func serviceCheckDiff(old, new *ServiceCheck, contextual bool) *ObjectDiff { | |||
|
|||
// Diff the primitive fields. | |||
diff.Fields = fieldDiffs(oldPrimitiveFlat, newPrimitiveFlat, contextual) | |||
|
|||
// Diff Header | |||
headerDiff := &ObjectDiff{Type: DiffTypeNone, Name: "Header"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind just popping it into a method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs docs as well. HCL and JSON
b76a221
to
77f4d96
Compare
77f4d96
to
a6bf5b6
Compare
Travis failure is unrelated. |
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Fixes #2924
@dadgar Please check my work in diff.go. I haven't had to edit the diff logic before.
I modeled our header field after Consul's which is modeled after the Go stdlib which ... is kind of awkward for people not used to it for 2 reasons:
map[string][]string
instead of[]string
(like env vars)It's unfortunate that it's kind of an awkward API, but I default to consistency above trying to make a subjective UX tweak.