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

node-drain using name #863

Closed
adrianlop opened this issue Mar 1, 2016 · 7 comments · Fixed by #1068
Closed

node-drain using name #863

adrianlop opened this issue Mar 1, 2016 · 7 comments · Fixed by #1068
Labels
theme/cli theme/docs Documentation issues and enhancements type/enhancement

Comments

@adrianlop
Copy link
Contributor

Hi,

Upgrading our Nomad cluster to 0.3, I encountered a problem with the node-drain command.
In the example of the documentation it seems that you can specify a node using its name ($ nomad node-drain -enable node1), but when I run the command, it doesn't work. It only accepts UUID:
Error toggling drain mode: Unexpected response code: 500 (rpc error: rpc error: node lookup failed: index error: UUID must be 36 characters)

I think it is useful that you can drain a node specifying the name (I'm using Ansible to automate this upgrade, and since the nomad client name is the same as the hostname, it would be really easy to achieve this).

It would be useful too, to launch the command with a myself param or similar, so only that node where you launched the command gets drained. This way you don't have to write the UUID or the name, and simplifies the automation of rolling upgrades using a CM like Ansible/puppet etc.

What do you think?
Thank you guys!

@adrianlop
Copy link
Contributor Author

btw, if someone is having the same problem, or this issue gets closed because you consider that is not neccesary, workaround here:

nomad node-status | grep "$(hostname)" | awk '{print $1}' | xargs nomad node-drain -enable

@dadgar
Copy link
Contributor

dadgar commented Mar 1, 2016

@adrianlop Thanks for filing this. This may be a documentation issue as it has always been by UUID. The reason it has to be UUID is that the name doesn't necessarily have to be unique. So it would be ambiguous which node needed draining! Can you point out the documentation that shows using a name

@adrianlop
Copy link
Contributor Author

Yeah, I saw it here:
https://github.com/hashicorp/nomad/blob/master/website/source/docs/commands/node-drain.html.md.erb#L45

Also, here it says node ID or prefix: I understood node0* by prefix, I tried it but no good result neither:
https://github.com/hashicorp/nomad/blob/master/website/source/docs/commands/node-drain.html.md.erb#L24-L26

I see now that if 2 nodes have these 2 UUIDS:

  • aaf19802-fb8e-af71-905c-c91a79e83a0c
  • aa60512c-6c13-40d3-0ae2-c7ae2a6463cd

nomad node-drain -disable aa will list you both. So the prefix is for UUIDs too.

So it's no problem, if you think this is not a valuable enhancement you can close it!
the workaround I posted 2 comments ago, works like a charm.

@diptanu @dadgar thank you both for your help!

@dadgar dadgar added the theme/docs Documentation issues and enhancements label Mar 4, 2016
@trenton42
Copy link

There was one small piece in @adrianlop 's original issue that I don't want to be overlooked: a nomad node-drain self command would really be wonderful.

@dadgar
Copy link
Contributor

dadgar commented Mar 16, 2016

@trenton42 #926

@trenton42
Copy link

@dadgar Thanks!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, 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 Dec 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
theme/cli theme/docs Documentation issues and enhancements type/enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants