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

k8s exec: Perform liveness check of clients #3045

Merged
merged 3 commits into from
Oct 22, 2024
Merged

k8s exec: Perform liveness check of clients #3045

merged 3 commits into from
Oct 22, 2024

Conversation

DrJosh9000
Copy link
Contributor

@DrJosh9000 DrJosh9000 commented Oct 21, 2024

Description

Add a mechanism for terminating if a client stops communicating.

Context

Sometimes, a container will just die (e.g. it is OOM-killed). If that happens, the agent can sit around happily until the heat death of the universe waiting for Exit to be called by something that isn't running any more.

Changes

  • Some code rearrangement
  • Store clients in a slice instead of a map, since they're keyed by sequential int
  • Finer-grained locking
    • Locking around channel close inside a sync.Once.Do is pointless, given nothing else writes to the channels. The existing locking only prevented data races on the clients, and the clients map/slice never changes, so the mutexes can be made client-specific.
  • Add a goroutine that inspects client states and terminates the job if a client that should be connected goes silent for too long.

Testing

  • Tests have run locally (with go test ./...). Buildkite employees may check this if the pipeline has run automatically.
  • Code is formatted (with go fmt ./...)

@DrJosh9000 DrJosh9000 force-pushed the liveness-check branch 4 times, most recently from 1a076d7 to c51eb2d Compare October 21, 2024 22:43
Copy link
Contributor

@wolfeidau wolfeidau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seem solid, supervisor is 👍🏻 🔍

@DrJosh9000 DrJosh9000 merged commit 3c8709a into main Oct 22, 2024
1 check passed
@DrJosh9000 DrJosh9000 deleted the liveness-check branch October 22, 2024 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants