-
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
cli: report server version #9159
cli: report server version #9159
Conversation
setVersion adds a header X-Nomad-Version to a wrapper function. There is a wrapper function in http.go that takes a normal implementation for an endpoint, and adds other code that should be there. As an example, let's say that an endpoint wants to search for all the jobs running. The function would implement the logic to look for jobs. Then you take that function, pass it to the wrapper, and the wrapper will add all the headers that should be on that response. It's nice because all of the logic that you'd have to add version headers can get put in one place
Also fix the build. You need to call go mod vendor when changing the api directory
468c962
to
8cce0dc
Compare
@nickethier 👋 Could you take a quick look at this? I've still got this as a draft, but I wanted to get some early feedback before I dive into this more. Thanks! |
…n-on-mismatched-nomad-versions
a741026
to
28f724d
Compare
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.
Okidokes, I think I understand more of it now 😸. I'm adding a bunch of comments to check my understanding of stuff.
Shoot, I forgot I left this open. @tgross does this make sense? |
Hi @drewgonzales360! I think so. Let me build it and take it for a spin to make sure that I'm clear on all places this gets picked up. |
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.
LGTM! I tested this out locally with a build of 1.4.2 and then did a rolling update with this patch, just to verify nothing unexpected during the upgrade process:
Before:
$ nomad server members -detailed
Name Address Port Status Leader Protocol Raft Version Build Datacenter Region Tags
server0.global 192.168.1.151 4648 alive true 2 3 1.4.2 dc1 global rpc_addr=192.168.1.151,dc=dc1,role=nomad,build=1.4.2,raft_vsn=3,region=global,expect=3,id=b762289c-b200-7017-e6ea-bde963599fa0,port=4647,vsn=1
server1.global 192.168.1.151 4658 alive false 2 3 1.4.2 dc1 global port=4657,role=nomad,region=global,id=a778c12c-d259-df16-8ae6-f7b2a58a929b,expect=3,build=1.4.2,vsn=1,raft_vsn=3,dc=dc1,rpc_addr=192.168.1.151
server2.global 192.168.1.151 4668 alive false 2 3 1.4.2 dc1 global dc=dc1,vsn=1,raft_vsn=3,role=nomad,region=global,id=ef79077f-e492-e20c-a80e-ea9e0b6ee43f,expect=3,port=4667,build=1.4.2,rpc_addr=192.168.1.151
Upgrade a follower:
$ nomad server members -detailed
Name Address Port Status Leader Protocol Raft Version Build Datacenter Region Tags
server0.global 192.168.1.151 4648 alive true 2 3 1.4.2 dc1 global raft_vsn=3,expect=3,port=4647,vsn=1,build=1.4.2,dc=dc1,id=b762289c-b200-7017-e6ea-bde963599fa0,role=nomad,region=global,rpc_addr=192.168.1.151
server1.global 192.168.1.151 4658 alive false 2 3 1.4.2 dc1 global vsn=1,expect=3,build=1.4.2,role=nomad,region=global,id=a778c12c-d259-df16-8ae6-f7b2a58a929b,dc=dc1,raft_vsn=3,rpc_addr=192.168.1.151,port=4657
server2.global 192.168.1.151 4668 alive false 2 3 1.4.1-dev dc1 global raft_vsn=3,id=ef79077f-e492-e20c-a80e-ea9e0b6ee43f,region=global,build=1.4.1-dev,port=4667,role=nomad,dc=dc1,expect=3,revision=2f7ef2de9935f4e36f676da17f787740fca82dc7,vsn=1,rpc_addr=192.168.1.151
Upgrade the leader:
$ nomad server members -detailed
Name Address Port Status Leader Protocol Raft Version Build Datacenter Region Tags
server0.global 192.168.1.151 4648 alive false 2 3 1.4.1-dev dc1 global dc=dc1,revision=2f7ef2de9935f4e36f676da17f787740fca82dc7,id=b762289c-b200-7017-e6ea-bde963599fa0,build=1.4.1-dev,vsn=1,raft_vsn=3,expect=3,role=nomad,port=4647,rpc_addr=192.168.1.151,region=global
server1.global 192.168.1.151 4658 alive false 2 3 1.4.2 dc1 global id=a778c12c-d259-df16-8ae6-f7b2a58a929b,port=4657,raft_vsn=3,expect=3,region=global,vsn=1,role=nomad,dc=dc1,build=1.4.2,rpc_addr=192.168.1.151
server2.global 192.168.1.151 4668 alive true 2 3 1.4.1-dev dc1 global dc=dc1,build=1.4.1-dev,port=4667,raft_vsn=3,id=ef79077f-e492-e20c-a80e-ea9e0b6ee43f,region=global,revision=2f7ef2de9935f4e36f676da17f787740fca82dc7,vsn=1,rpc_addr=192.168.1.151,role=nomad,expect=3
Upgrade the remaining follower:
$ nomad server members -detailed
Name Address Port Status Leader Protocol Raft Version Build Datacenter Region Tags
server0.global 192.168.1.151 4648 alive false 2 3 1.4.1-dev dc1 global rpc_addr=192.168.1.151,region=global,build=1.4.1-dev,role=nomad,id=b762289c-b200-7017-e6ea-bde963599fa0,revision=2f7ef2de9935f4e36f676da17f787740fca82dc7,port=4647,vsn=1,raft_vsn=3,expect=3,dc=dc1
server1.global 192.168.1.151 4658 alive false 2 3 1.4.1-dev dc1 global build=1.4.1-dev,vsn=1,rpc_addr=192.168.1.151,role=nomad,raft_vsn=3,region=global,revision=2f7ef2de9935f4e36f676da17f787740fca82dc7,dc=dc1,port=4657,id=a778c12c-d259-df16-8ae6-f7b2a58a929b,expect=3
server2.global 192.168.1.151 4668 alive true 2 3 1.4.1-dev dc1 global role=nomad,dc=dc1,region=global,expect=3,rpc_addr=192.168.1.151,build=1.4.1-dev,port=4667,raft_vsn=3,revision=2f7ef2de9935f4e36f676da17f787740fca82dc7,vsn=1,id=ef79077f-e492-e20c-a80e-ea9e0b6ee43f
I've tweaked the changelog entry slightly and pushed that. Will merge once CI is done and then this will ship in the next regular release of Nomad (most likely 1.4.3). Thanks so much for your patience on this one @drewgonzales360!
The automated backport to the 1.4.x branch failed, but that's just internal process nonsense so I'll get that fixed up and merged. |
Co-authored-by: Drew Gonzales <[email protected]>
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. |
Issue #1040
This is my first PR here 😄
Summary
Originally, I was going to set a
X-Nomad-Version
on every request, then check the header on every request to any API, but I didn't think it was very clean and it would be a big changeset. I also thought it might get annoying for users to see the warning for several commands.Instead, I just added the
revision
tonomad server members -detailed
.