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
Allow empty services #10375
Allow empty services #10375
Conversation
5100ef2
to
1e15586
Compare
7555391
to
3bfac8f
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.
Thanks a lot for this contribution @chrispruitt
Few comments below
aa7709f
to
f832ddf
Compare
Hi @chrispruitt Thanks for your changes. Seems good to me regarding the feature. I am one more question what do you think to use a mock instead of creating these fixtures files for test? |
@mmatur I just followed the same process this provider package already had in place. The only change I made was moving the JSON responses to files. I don't have a strong opinion either way. They do end up with the same result in my opinion and the fixtures approach is easy to track mocked responses IMO. On another note, do I need to rebase this branch? Or would you do that before merging? Thanks! |
f832ddf
to
0ddf789
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.
Thanks for your feedback @chrispruitt .
Let's move forward with that and see what other maintainers think about it
I gave it a try and it seems good to me
LGTM
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.
Thank you @chrispruitt for this contribution!
LGTM 👏
Are we able to get one more approval and merge this guy??? Thanks! |
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.
Thanks 👌
0ddf789
to
47c0725
Compare
What does this PR do?
This enables the nomad provider the ability to allow empty services. For instance, when a service is scaled down to 0 the route will persist. This would be an opt-in feature (false by default).
Fixes #10374
Motivation
I currently have services in Nomad that scaled down to zero and use a port-knocking solution that scales the service up when the route receives traffic. Also, the Kubernetes provider already has this option, so I felt like it was missing from the nomad provider.
More
Additional Notes
I attempted to implement this just like the Kubernetes provider for consistency.
Also, to make this possible, I had to utilize Nomad's job API methods, rather than the service API methods to retrieve the list of existing services. This is because Nomad does not currently list nonregistered services (or services scaled to 0) with service API methods.