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

two fixes for inspect on connect proxy #7690

Merged
merged 2 commits into from
Apr 20, 2020
Merged

Conversation

shoenig
Copy link
Member

@shoenig shoenig commented Apr 10, 2020

This PR contains 2 commits, each with a fix around the response of nomad job inspect on jobs containing a proxy stanza. More details in each commit, but basically

  1. jobspec parsing for proxy.local_service_address and proxy.local_service_port was missing
  2. fields names of proxy representation within api and nomad/structs were different, causing them to be lost in translation (i.e. JSON marshaling)

Fixes #7397

Copy link
Contributor

@notnoop notnoop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a backward compatibility concern with struct renaming? Might need use tags rather than renaming field. Also, are these values set by user in the API or just read-only fields?

Given that nomad/structs are persisted, changing the field name would mean that future versions will silently drop 0.11.0 Expose field.

FWIWI, struct persistence use msgpack with codec tags, while api interaction uses json tag - so probably a clever use of tags can preserve compatibility while solving the issue.

@shoenig shoenig force-pushed the b-inspect-proxy-output branch 2 times, most recently from 35bd50f to b956062 Compare April 13, 2020 21:46
Before, the proxy stanza did not parse non-object fields
`local_service_port` and `local_service_address` from the
connect `proxy` stanza. This change fixes that.
…tions

The field names within the structs representing the Connect proxy
definition were not the same (nomad/structs/ vs api/), causing the
values to be lost in translation for the 'nomad job inspect' command.

Since the field names already shipped in v0.11.0 we cannot simply
fix the names. Instead, use the json struct tag on the structs/ structs
to remap the name to match the publicly expose api/ package on json
encoding.

This means existing jobs from v0.11.0 will continue to work, and
the JSON API for job submission will remain backwards compatible.
@shoenig
Copy link
Member Author

shoenig commented Apr 14, 2020

Gah! yep, we need to preserve the field names as they're persisted in 0.11. Following your suggestion, I've now left the field names alone, and only applied json tags to the structs in the structs/ package, enabling the translation from structs/ -> api/, while also preserving JSON HTTP API compatibility.

Copy link
Member

@nickethier nickethier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, don't forget to update CHANGELOG

@shoenig shoenig merged commit a6cb4a0 into master Apr 20, 2020
@shoenig shoenig deleted the b-inspect-proxy-output branch April 20, 2020 16:17
shoenig added a commit that referenced this pull request Apr 20, 2020
@github-actions
Copy link

github-actions bot commented Jan 9, 2023

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

connect block blank in job inspect output
3 participants