Skip to content

Commit 97bc5ab

Browse files
committed
explain the caching mechanism
1 parent 6cacb7b commit 97bc5ab

File tree

1 file changed

+17
-4
lines changed
  • keps/sig-scheduling/5278-nominated-node-name-for-expectation

1 file changed

+17
-4
lines changed

keps/sig-scheduling/5278-nominated-node-name-for-expectation/README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,7 @@ If an external component adds `NominatedNodeName`, but the scheduler picks up a
372372
But, if an external component updates `NominatedNodeName` that is set by the scheduler,
373373
the pod could end up having different `NominatedNodeName` and `NodeName`.
374374

375-
We will update the logic so that:
376-
- `NominatedNodeName` field is cleared during `binding` call
375+
We will update the logic so that `NominatedNodeName` field is cleared during `binding` call
377376

378377
We believe that ensuring that `NominatedNodeName` can't be set after the pod is already bound
379378
is niche enough feature that doesn't justify an attempt to strenghtening the validation.
@@ -457,10 +456,24 @@ Higher-priority pods can ignore it, but pods with equal or lower priority don't
457456
This allows us to prioritize nominated pods when nomination was done by external components.
458457
We just need to ensure that in case when NominatedNodeName was assigned by an external component, this nomination will get reflected in scheduler memory.
459458

460-
TODO: We need to ensure that works for non-existing nodes too and if those nodes won't appear in the future, it won't leak the memory.
461-
462459
We will implement integration tests simulating the above behavior of external components.
463460

461+
### The scheduler's cache for `NominatedNodeName`
462+
463+
Here, we'll ensure that works for non-existing nodes too and if those nodes won't appear in the future, it won't leak the memory.
464+
465+
The scheduler stores `NominatedNodeName` data at [`nominator`](https://github.com/kubernetes/kubernetes/blob/master/pkg/scheduler/backend/queue/nominator.go).
466+
This `nominator` holds `NominatedNodeName` data even if the node doesn't exist.
467+
So, this caching mechanism should work correctly for non-existing NNN node scenario.
468+
469+
Also, this cached info is cleared
470+
[`deletePodFromSchedulingQueue`](https://github.com/kubernetes/kubernetes/blob/b2dfba4151b859c31a27fe31f8703f9b2b758270/pkg/scheduler/eventhandlers.go#L199).
471+
This `deletePodFromSchedulingQueue` is called when unscheduled pods are removed,
472+
or pods are assigned to nodes (EventHandler calls `DeleteFunc` handler when [the condition](https://github.com/kubernetes/kubernetes/blob/b2dfba4151b859c31a27fe31f8703f9b2b758270/pkg/scheduler/eventhandlers.go#L416) is no longer met).
473+
474+
So, as a conclusion, there should be nothing to implement newly around it.
475+
Again, we'll ensure this scenario works correctly via tests.
476+
464477
#### The scheduler only modifies `NominatedNodeName`, not clears it in any cases
465478

466479
As of now, scheduler clears the `NominatedNodeName` field at the end of failed scheduling cycle if it

0 commit comments

Comments
 (0)