Skip to content
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

Prevent existence of multiple active CAs on the same node #121

Open
wants to merge 1 commit into
base: add-kos
Choose a base branch
from

Conversation

matte21
Copy link
Collaborator

@matte21 matte21 commented Sep 7, 2020

This PR is needed because if multiple CAs are running on the same node they might interfere when interacting with OvS, producing safety violations.

This PR guarantees that there cannot be multiple CAs doing real work on a node by having each CA attempt to acquire a lock file on the node at start up. "Doing real work" means anything the CA normally does.

Note that this is different than ensuring there are no CAs on the same node, because if a CA C2 attempts to acquire the lock when another CA C1 on the same node is holding the lock, C2 simply waits until C1 terminates and releases the lock. At that point C2 acquires the lock and proceeds to become the active CA on the node.
I would prefer a different behavior (fail-on-lock-contention): if C2 attempts to acquire the lock when it is already held by C1 C2 terminates immediately (possibly making some noise, such as a K8s event, since this is a situation we're not expecting).
The wait-on-lock-contention behavior was chosen because that's the behavior of the already present K8s utils file locking functionality; this way, we can reuse that.
But note that if we do want to switch to the fail-on-lock-contention, that's trivial to implement (the resulting function body would be 5 lines of code).
I also plan to ask to the SIG node people if they'd be interested in adding the option to have fail-on-lock-contention and why the wait-on-lock-contention behavior was chosen to start with (I suspect it's to allow some form of coordination between an old kubelet and a new, upgraded kubelet instance on the same node).
But what's here is already enough to avoid safety violations.

Ensure at most one connection agent is doing real work on the node
by using a lock file each connection agent acquires at start up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant