-
Notifications
You must be signed in to change notification settings - Fork 611
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
Fix HasResource inverted boolean error #3162
Fix HasResource inverted boolean error #3162
Conversation
I honestly would love to add more unit tests to constraint_enforcer_test.go, but I am unsure about how to test for "no failure". I would appreciate some pointers. |
Signed-off-by: Martin Braun <braun@neuroforge.de>
481ead2
to
d67eec8
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #3162 +/- ##
===========================================
+ Coverage 0 61.80% +61.80%
===========================================
Files 0 155 +155
Lines 0 31139 +31139
===========================================
+ Hits 0 19244 +19244
- Misses 0 10341 +10341
- Partials 0 1554 +1554 |
@dperny PTAL. Kind of embarrasing that I didn't check this last time around. But boolean logic is hard, okay? |
I additionally verified the fix by running a dind version of moby/moby with the fix applied. root@6a234821266f:/go/src/github.com/docker/docker# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
root@6a234821266f:/go/src/github.com/docker/docker# docker ^C
root@6a234821266f:/go/src/github.com/docker/docker# docker network create -d overlay --scope swarm test-network
Error response from daemon: cannot create a swarm scoped network when swarm is not active
root@6a234821266f:/go/src/github.com/docker/docker# docker swarm init
Swarm initialized: current node (o6ek9v8noxrc2n0dgfw5usw3j) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join --token SWMTKN-1-39mijudamxqjwwifamr1e7lpe8cjxxrnftkpn31342q91parvd-7g63d3i274dmhx264mkbwbfpo 172.17.0.6:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
root@6a234821266f:/go/src/github.com/docker/docker# docker network create -d overlay --scope swarm test-network
zem9t2vf033kkcpa5si9ygukb
root@6a234821266f:/go/src/github.com/docker/docker# docker service create --network test-network --generic-resource "gpu_test=2" --name test-service-2 ubuntu tail -f /dev/n
ull
uhxbdxii0dmbtkfhlqmqhf23d
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service converged
root@6a234821266f:/go/src/github.com/docker/docker# docker service create --network test-network --generic-resource "gpu_test=4" --name test-service-3 ubuntu tail -f /dev/n
ull
ip5x4qx6meorygcu5plo2a465
overall progress: 0 out of 1 tasks
1/1: no suitable node (insufficient resources on 1 node)
Operation continuing in background.
Use `docker service ps ip5x4qx6meorygcu5plo2a465` to check progress.
root@6a234821266f:/go/src/github.com/docker/docker# docker service create --network test-network --generic-resource "gpu_test=3" --name test-service-4 ubuntu tail -f /dev/n
ull
vqxyav44kkyiqriyrdi289vk4
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service converged
root@6a234821266f:/go/src/github.com/docker/docker# |
@thaJeztah PTAL - this is blocking people from upgrading to >23.x from 20.x . It fell through last time I fixed something in the same area. |
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, thanks!
This will also need a re-vendor in moby/moby 😅 |
I will take care of that if you want. The process for vendoring for moby/swarmkit into moby/moby is something that I keep having to make up as I go. Is there documentation that I missed for that? |
Within the moby repo, you can edit the I tend to include a |
- What I did
While fixing moby/moby#44378 for named resources in #3082, we inadvertedly broke scheduling for people with discrete resources.
- How I did it
Investigated the code and added more unit tests.
- How to test it
Run the unit tests. Broken behaviour can be reproduced with a setup with gpu_test=5:
moby/moby#44378 (comment)