jackfrancis / kustodian

Kubernetes node maintainer
MIT License
7 stars 4 forks source link

implement mop priority #15

Closed jackfrancis closed 2 years ago

jackfrancis commented 2 years ago

This PR introduces a mop.priority value to the reference kustodian mop chart for running shell scripts. We follow the systemd convention of saying that lower priority values are "higher" (in terms of importance and scheduling precedence) priority.

How this works:

This solves for the scenario when several concurrent mop scripts are waiting in line to execute on the same node. For example:

1) A mop script arrives with a default priority of "99" 2) A 2nd mop script arrives with a priority of "00"

What will generally occur is the following:

1) A particular node will win exclusive maintenance access 2) Let's say that the 2nd mop script hasn't yet arrived on the cluster, then that first script (priority value "99") will begin execution immediately 3) Let's say that the 1st script is still in-progress on this node while the 2nd mop script arrives onto the cluster. Because this node is already under active maintenance, and because the 2nd script has a lower priority, it will be cleared for immediate execution.

If the 2nd script in the above scenario had a higher value ("lower" priority in terms of significance), then execution of that script would be blocked until the first script successfully finishes.

Scripts scheduled concurrently with an equivalent priority value will be serialized in the order that they arrive (via a mop release) on the same node.