[K8s] Mounting changes, labels, shutdown#679
Merged
PawelPlesniak merged 7 commits intodevelopfrom Nov 13, 2025
Merged
Conversation
9 tasks
20 tasks
Collaborator
|
I have run the folllowing tests:
All these tests passed as expected. Thank you @MRiganSUSX |
PawelPlesniak
approved these changes
Nov 13, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes several items in #618
Requires: DUNE-DAQ/druncschema#76
Shortly:
Details:
-> Staged, Role-Based Shutdown:
--> _kill_impl has been rewritten to perform a sequential, blocking shutdown based on process roles.
It now terminates all pods in a specific order (applications -> segment-controllers -> root-controller -> local-connection-server) to ensure a clean stop.
--> Robust Signal Handling & PID 1 Fixes:
Python Controllers: Graceful shutdown is fixed. Controllers now correctly use exec to become PID 1, allowing them to receive and handle SIGTERM signals and exit with code 0.
--> LCS: the LCS would always exit with code 143 (SIGTERM). A shell trap is now added to the pod command, which catches the SIGTERM, sends a SIGKILL to the child gunicorn process, and then exits cleanly with code 0.
-> Dynamic & Static Volume Mounting:
--> Implements a new _get_pod_volumes_and_mounts helper to manage all pod volumes.
--> Static Mounts: Reads volumes (e.g., /nfs, /cvmfs) from the k8s.json configuration and mounts them.
--> Log Mount: Automatically creates a read-write "log-mount" for the directory specified in process_logs_path, enabling persistent logs.
--> Data Mount: The oks_parser and process_manager_driver now extract the data_path for DFApplications. This is passed to the K8sProcessManager and mounted as a read-write "data-mount".
Includes de-duplication logic to prevent conflicts if the log and data mounts are the same.
-> Improved Startup Error Handling:
--> Server-Side: The K8sProcessManager now wraps config.load_kube_config() in a try...except block. If the kube-config is missing or invalid, it logs a clear CRITICAL error and exits, rather than failing silently.
--> Client-Side: The drunc-unified-shell startup loop now checks if the server process (pm_process) is alive. If the server crashes on launch (e.g., due to the bad config), the client exits immediately with error message.
-> Pod Role Labeling:
--> A new helper, _get_tree_labels, automatically adds role.drunc.daq and tree-id.drunc.daq labels to all pods at creation time.
This labeling is what enables the new staged shutdown logic.
Tested:
To test:
Type of change
Key checklist
python -m pytest)pre-commit run --all-files)Further checks
(Indicate issue here: # (issue))