Implement PriorityClass Support#8883
Merged
Merged
Conversation
3 tasks
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8883 +/- ##
==========================================
+ Coverage 59.30% 59.72% +0.42%
==========================================
Files 380 381 +1
Lines 43784 43889 +105
==========================================
+ Hits 25965 26213 +248
+ Misses 16280 16130 -150
- Partials 1539 1546 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
29af40a to
2f72032
Compare
303ad7e to
5c9c01a
Compare
373fe4a to
9727a9e
Compare
kaovilai
added a commit
to kaovilai/velero
that referenced
this pull request
Jul 25, 2025
- Add --server-priority-class-name and --node-agent-priority-class-name flags to velero install command - Configure data mover pods (PVB/PVR/DataUpload/DataDownload) to use priority class from node-agent-configmap - Update e2e tests to include PriorityClass label for testing - Move priority class design document to Implemented folder - Add changelog entry for velero-io#8883 🤖 Generated with [Claude Code](https://claude.ai/code) Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> Add support for ConfigMap options in Velero server installation Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> Implement centralized ConfigMap watching for node-agent controllers This change introduces a centralized ConfigMap watching mechanism to eliminate redundant ConfigMap watchers across controllers. Previously, each controller (PodVolumeBackup, PodVolumeRestore, DataUpload, DataDownload) independently watched the same ConfigMap, leading to inefficiency. Key changes: - Add ConfigProvider interface for centralized configuration management - Implement nodeAgentConfigProvider with single ConfigMap watcher - Update all controllers to use ConfigProvider instead of direct watching - Add comprehensive unit tests for ConfigProvider implementation - Add enhanced MockConfigProvider for testing - Add E2E test for validating centralized watching behavior - Remove redundant ConfigMap watching code from controllers Benefits: - Single source of truth for ConfigMap watching - Reduced resource usage with one watcher instead of four - Consistent configuration updates across all controllers - Improved testability with centralized mocking - Better separation of concerns 🤖 Generated with [Claude Code](https://claude.ai/code) Fix ConfigProvider tests for empty ConfigMap name and informer behavior - Handle empty ConfigMap name gracefully in NewNodeAgentConfigProvider - Skip informer start when ConfigMap name is empty - Update test expectations to handle informer Add events on startup - Ensure tests pass with correct behavior for edge cases 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
kaovilai
added a commit
to kaovilai/velero
that referenced
this pull request
Jul 25, 2025
- Add --server-priority-class-name and --node-agent-priority-class-name flags to velero install command - Configure data mover pods (PVB/PVR/DataUpload/DataDownload) to use priority class from node-agent-configmap - Update e2e tests to include PriorityClass label for testing - Move priority class design document to Implemented folder - Add changelog entry for velero-io#8883 🤖 Generated with [Claude Code](https://claude.ai/code) Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> Add support for ConfigMap options in Velero server installation Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> Implement centralized ConfigMap watching for node-agent controllers This change introduces a centralized ConfigMap watching mechanism to eliminate redundant ConfigMap watchers across controllers. Previously, each controller (PodVolumeBackup, PodVolumeRestore, DataUpload, DataDownload) independently watched the same ConfigMap, leading to inefficiency. Key changes: - Add ConfigProvider interface for centralized configuration management - Implement nodeAgentConfigProvider with single ConfigMap watcher - Update all controllers to use ConfigProvider instead of direct watching - Add comprehensive unit tests for ConfigProvider implementation - Add enhanced MockConfigProvider for testing - Add E2E test for validating centralized watching behavior - Remove redundant ConfigMap watching code from controllers Benefits: - Single source of truth for ConfigMap watching - Reduced resource usage with one watcher instead of four - Consistent configuration updates across all controllers - Improved testability with centralized mocking - Better separation of concerns 🤖 Generated with [Claude Code](https://claude.ai/code) Fix ConfigProvider tests for empty ConfigMap name and informer behavior - Handle empty ConfigMap name gracefully in NewNodeAgentConfigProvider - Skip informer start when ConfigMap name is empty - Update test expectations to handle informer Add events on startup - Ensure tests pass with correct behavior for edge cases 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
kaovilai
added a commit
to kaovilai/velero
that referenced
this pull request
Jul 25, 2025
- Add --server-priority-class-name and --node-agent-priority-class-name flags to velero install command - Configure data mover pods (PVB/PVR/DataUpload/DataDownload) to use priority class from node-agent-configmap - Update e2e tests to include PriorityClass label for testing - Move priority class design document to Implemented folder - Add changelog entry for velero-io#8883 🤖 Generated with [Claude Code](https://claude.ai/code) Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> Add support for ConfigMap options in Velero server installation Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> Implement centralized ConfigMap watching for node-agent controllers This change introduces a centralized ConfigMap watching mechanism to eliminate redundant ConfigMap watchers across controllers. Previously, each controller (PodVolumeBackup, PodVolumeRestore, DataUpload, DataDownload) independently watched the same ConfigMap, leading to inefficiency. Key changes: - Add ConfigProvider interface for centralized configuration management - Implement nodeAgentConfigProvider with single ConfigMap watcher - Update all controllers to use ConfigProvider instead of direct watching - Add comprehensive unit tests for ConfigProvider implementation - Add enhanced MockConfigProvider for testing - Add E2E test for validating centralized watching behavior - Remove redundant ConfigMap watching code from controllers Benefits: - Single source of truth for ConfigMap watching - Reduced resource usage with one watcher instead of four - Consistent configuration updates across all controllers - Improved testability with centralized mocking - Better separation of concerns 🤖 Generated with [Claude Code](https://claude.ai/code) Fix ConfigProvider tests for empty ConfigMap name and informer behavior - Handle empty ConfigMap name gracefully in NewNodeAgentConfigProvider - Skip informer start when ConfigMap name is empty - Update test expectations to handle informer Add events on startup - Ensure tests pass with correct behavior for edge cases 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
kaovilai
commented
Jul 25, 2025
Lyndon-Li
reviewed
Jul 25, 2025
Lyndon-Li
reviewed
Jul 25, 2025
Lyndon-Li
reviewed
Jul 25, 2025
Lyndon-Li
reviewed
Jul 25, 2025
kaovilai
added a commit
to kaovilai/velero
that referenced
this pull request
Jul 25, 2025
- Add --server-priority-class-name and --node-agent-priority-class-name flags to velero install command - Configure data mover pods (PVB/PVR/DataUpload/DataDownload) to use priority class from node-agent-configmap - Update e2e tests to include PriorityClass label for testing - Move priority class design document to Implemented folder - Add changelog entry for velero-io#8883 🤖 Generated with [Claude Code](https://claude.ai/code) Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> Add support for ConfigMap options in Velero server installation Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> Implement centralized ConfigMap watching for node-agent controllers This change introduces a centralized ConfigMap watching mechanism to eliminate redundant ConfigMap watchers across controllers. Previously, each controller (PodVolumeBackup, PodVolumeRestore, DataUpload, DataDownload) independently watched the same ConfigMap, leading to inefficiency. Key changes: - Add ConfigProvider interface for centralized configuration management - Implement nodeAgentConfigProvider with single ConfigMap watcher - Update all controllers to use ConfigProvider instead of direct watching - Add comprehensive unit tests for ConfigProvider implementation - Add enhanced MockConfigProvider for testing - Add E2E test for validating centralized watching behavior - Remove redundant ConfigMap watching code from controllers Benefits: - Single source of truth for ConfigMap watching - Reduced resource usage with one watcher instead of four - Consistent configuration updates across all controllers - Improved testability with centralized mocking - Better separation of concerns 🤖 Generated with [Claude Code](https://claude.ai/code) Fix ConfigProvider tests for empty ConfigMap name and informer behavior - Handle empty ConfigMap name gracefully in NewNodeAgentConfigProvider - Skip informer start when ConfigMap name is empty - Update test expectations to handle informer Add events on startup - Ensure tests pass with correct behavior for edge cases 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Lyndon-Li
reviewed
Jul 28, 2025
blackpiglet
reviewed
Jul 29, 2025
blackpiglet
reviewed
Jul 29, 2025
Lyndon-Li
reviewed
Jul 30, 2025
Contributor
|
@kaovilai |
Lyndon-Li
previously approved these changes
Jul 30, 2025
ywk253100
previously approved these changes
Aug 1, 2025
Contributor
|
@kaovilai Please resolve the conflicts. |
Collaborator
Author
|
rebasing |
Contributor
|
@kaovilai |
Collaborator
Author
|
yes |
- Add --server-priority-class-name and --node-agent-priority-class-name flags to velero install command - Configure data mover pods (PVB/PVR/DataUpload/DataDownload) to use priority class from node-agent-configmap - Configure maintenance jobs to use priority class from repo-maintenance-job-configmap (global config only) - Add priority class validation with ValidatePriorityClass and GetDataMoverPriorityClassName utilities - Update e2e tests to include PriorityClass testing utilities - Move priority class design document to Implemented folder - Add comprehensive unit tests for all priority class implementations - Update documentation for priority class configuration - Add changelog entry for velero-io#8883 Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> remove unused test utils Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> feat: add unit test for getting priority class name in maintenance jobs Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> doc update Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> feat: add priority class validation for repository maintenance jobs - Add ValidatePriorityClassWithClient function to validate priority class existence - Integrate validation in maintenance.go when creating maintenance jobs - Update tests to cover the new validation functionality - Return boolean from ValidatePriorityClass to allow fallback behavior This ensures maintenance jobs don't fail due to non-existent priority classes, following the same pattern used for data mover pods. Addresses feedback from: velero-io#8883 (comment) Refs velero-io#8869 Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> refactor: clean up priority class handling for data mover pods - Fix comment in node_agent.go to clarify PriorityClassName is only for data mover pods - Simplify server.go to use dataPathConfigs.PriorityClassName directly - Remove redundant priority class logging from controllers as it's already logged during server startup - Keep logging centralized in the node-agent server initialization This reduces code duplication and clarifies the scope of priority class configuration. 🤖 Generated with [Claude Code](https://claude.ai/code) Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> refactor: remove GetDataMoverPriorityClassName from kube utilities Remove GetDataMoverPriorityClassName function and its tests as priority class is now read directly from dataPathConfigs instead of parsing from ConfigMap. This simplifies the codebase by eliminating the need for indirect ConfigMap parsing. Refs velero-io#8869 🤖 Generated with [Claude Code](https://claude.ai/code) Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> refactor: remove priority class validation from install command Remove priority class validation during install as it's redundant since validation already occurs during server startup. Users cannot see console logs during install, making the validation warnings ineffective at this stage. The validation remains in place during server and node-agent startup where it's more appropriate and visible to users. Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> Co-Authored-By: Claude <noreply@anthropic.com>
Lyndon-Li
approved these changes
Aug 6, 2025
Lyndon-Li
approved these changes
Aug 6, 2025
blackpiglet
approved these changes
Aug 6, 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.
Add priority class support for Velero components
Summary
This PR implements priority class support for Velero components, allowing users to configure Kubernetes priority classes for the Velero server, node-agent, data mover pods, and maintenance jobs. This ensures proper pod scheduling and preemption behavior in resource-constrained environments.
Changes
Core Implementation
--server-priority-class-nameand--node-agent-priority-class-nameflags tovelero installcommandKey Features
ValidatePriorityClassnow returns a boolean, allowing callers to handle missing priority classes gracefullyConfiguration Flow
graph TB subgraph "Installation Time" CLI[velero install] --> |"--server-priority-class-name"| Server[Velero Server Deployment] CLI --> |"--node-agent-priority-class-name"| NodeAgent[Node Agent DaemonSet] end subgraph "ConfigMap Configuration" NAConfig[node-agent-configmap] --> |priorityClassName| DataMovers[Data Mover Pods] MJConfig[repo-maintenance-job-configmap] --> |global.priorityClassName| MaintJobs[Maintenance Jobs] end subgraph "Runtime Flow" NodeAgentServer[Node Agent Server Startup] --> |Read Once| NAConfig NodeAgentServer --> |Validate| ValidatePC{Priority Class Exists?} ValidatePC -->|Yes| PassToControllers[Pass to Controllers] ValidatePC -->|No| ClearPC[Clear Priority Class<br/>Log Warning] ClearPC --> PassToControllers PassToControllers --> PVBController[PVB Controller] PassToControllers --> PVRController[PVR Controller] PassToControllers --> DUController[DataUpload Controller] PassToControllers --> DDController[DataDownload Controller] PVBController --> PVBPods[PVB Pods] PVRController --> PVRPods[PVR Pods] DUController --> DUPods[DataUpload Pods] DDController --> DDPods[DataDownload Pods] end subgraph "Maintenance Jobs" MaintController[Maintenance Controller] --> |Read Fresh| MJConfig MaintController --> MaintJobs end style ValidatePC fill:#f9f,stroke:#333,stroke-width:2px style ClearPC fill:#ff9,stroke:#333,stroke-width:2pxPriority Class Hierarchy
Example Usage
Testing
ValidatePriorityClassandGetDataMoverPriorityClassNameDocumentation
design/Implemented/priority-class-name-support_design.mdFixes #8869
Checklist