moby / moby/swarmkit

PlacementPreference SpreadOver only nodes with label when possible

Open
#2,839 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
3.7k
Forks
676
Avg merge
4d 9h
Merged PRs (30d)
6

Description

Allow placement preferences only to nodes with the specified label, as long as possible.
The current scheduling behavior can cause scheduling problems.
From: https://github.com/docker/swarmkit/blob/master/design/topology.md
"Nodes that are missing the label used by SpreadOver will still receive task assignments. As a group, they will receive tasks in equal proportion to any of the other groups identified by a specific label value. In a sense, a missing label is the same as having the label with a null value attached to it"

If I have two nodes with label X and a third without a label, running 3 service instances will put an instance on each node, the solution in the above document is to use constraints, which will prevent the service from running if only node 3 is up.
I think the best way is to prevent spreading to the null labeled nodes, this will allow running services according to the preferences as long as possible, if satisfying these preferences is not possible, the service will run on nodes without the label.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with design/topology.md and the documented SpreadOver behavior, then trace the scheduler's placement-preference path and its interaction with constraints. Verify behavior with services spanning labeled and unlabeled nodes. Done means labeled nodes receive tasks when possible, while unlabeled nodes are used only when the preference cannot be satisfied.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
distributed-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.