Skip to content

OADP-2785: Add PriorityClassName support to PodConfig in DataProtectionApplication#2010

Open
kaovilai wants to merge 2 commits intoopenshift:oadp-devfrom
kaovilai:OADP-2765
Open

OADP-2785: Add PriorityClassName support to PodConfig in DataProtectionApplication#2010
kaovilai wants to merge 2 commits intoopenshift:oadp-devfrom
kaovilai:OADP-2765

Conversation

@kaovilai
Copy link
Copy Markdown
Member

@kaovilai kaovilai commented Nov 5, 2025

  • Introduced PriorityClassName field in PodConfig struct to allow specification of pod priority.
  • Updated CRD and related manifests to include PriorityClassName description.
  • Modified NodeAgent and Velero deployment builders to utilize PriorityClassName from DataProtectionApplication spec.
  • Enhanced tests to validate PriorityClassName functionality in NodeAgent and Velero deployments.

Why the changes were made

How to test the changes made

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Nov 5, 2025
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Nov 5, 2025

@kaovilai: This pull request references OADP-2785 which is a valid jira issue.

Details

In response to this:

  • Introduced PriorityClassName field in PodConfig struct to allow specification of pod priority.
  • Updated CRD and related manifests to include PriorityClassName description.
  • Modified NodeAgent and Velero deployment builders to utilize PriorityClassName from DataProtectionApplication spec.
  • Enhanced tests to validate PriorityClassName functionality in NodeAgent and Velero deployments.

Why the changes were made

How to test the changes made

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 5, 2025

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6a7b8918-62e2-49d2-b8e6-0ff37fdccaf8

📥 Commits

Reviewing files that changed from the base of the PR and between 5e23ee3 and 13f9851.

📒 Files selected for processing (7)
  • api/v1alpha1/dataprotectionapplication_types.go
  • bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml
  • config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml
  • internal/controller/nodeagent.go
  • internal/controller/nodeagent_test.go
  • internal/controller/velero.go
  • internal/controller/velero_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • api/v1alpha1/dataprotectionapplication_types.go
  • internal/controller/nodeagent_test.go

Walkthrough

Adds an optional PriorityClassName to PodConfig, updates CRD schemas to expose the field in three pod-config locations, and propagates the value into NodeAgent DaemonSet and Velero Deployment pod specs with accompanying tests.

Changes

Cohort / File(s) Summary
API Type Definition
api/v1alpha1/dataprotectionapplication_types.go
Added PriorityClassName string \json:"priorityClassName,omitempty"`toPodConfig`.
CRD Manifests and Schemas
bundle/manifests/.../oadp.openshift.io_dataprotectionapplications.yaml, config/crd/bases/.../oadp.openshift.io_dataprotectionapplications.yaml
Inserted priorityClassName (string) into Pod config schema blocks in three locations across the CRD manifests.
NodeAgent Implementation & Tests
internal/controller/nodeagent.go, internal/controller/nodeagent_test.go
Passes Spec.Configuration.NodeAgent.PodConfig.PriorityClassName to DaemonSet via install option; tests updated to assert presence/absence and test helper extended.
Velero Implementation & Tests
internal/controller/velero.go, internal/controller/velero_test.go
Passes Spec.Configuration.Velero.PodConfig.PriorityClassName to Deployment via install option; tests updated and test helper extended.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci bot requested review from mpryc and sseago November 5, 2025 17:27
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 5, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
internal/controller/nodeagent.go (2)

362-367: Mirror the safer pattern used for Velero

Prefer computing the string with guards and passing it without an IIFE for readability and consistency.

Apply this diff:

-        install.WithPriorityClassName(func() string {
-            if dpa.Spec.Configuration.NodeAgent != nil && dpa.Spec.Configuration.NodeAgent.PodConfig != nil {
-                return dpa.Spec.Configuration.NodeAgent.PodConfig.PriorityClassName
-            }
-            return ""
-        }()),
+        func() install.Option {
+            pc := ""
+            if dpa.Spec.Configuration != nil &&
+               dpa.Spec.Configuration.NodeAgent != nil &&
+               dpa.Spec.Configuration.NodeAgent.PodConfig != nil {
+                pc = dpa.Spec.Configuration.NodeAgent.PodConfig.PriorityClassName
+            }
+            return install.WithPriorityClassName(pc)
+        }(),

303-307: Nit: event message says “deployment” for a DaemonSet

Use “daemonset” to avoid confusion in events.

-            fmt.Sprintf("performed %s on NodeAgent deployment %s/%s", op, ds.Namespace, ds.Name),
+            fmt.Sprintf("performed %s on NodeAgent daemonset %s/%s", op, ds.Namespace, ds.Name),
internal/controller/nodeagent_test.go (1)

571-573: PriorityClassName assignment OK; consider simplifying

You can set PriorityClassName unconditionally (zero-value is “”) to reduce branching. Behavior is identical.

- if len(options.priorityClassName) > 0 {
-   testBuiltNodeAgentDaemonSet.Spec.Template.Spec.PriorityClassName = options.priorityClassName
- }
+ testBuiltNodeAgentDaemonSet.Spec.Template.Spec.PriorityClassName = options.priorityClassName
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 5048a8f and c24396c.

📒 Files selected for processing (7)
  • api/v1alpha1/dataprotectionapplication_types.go (1 hunks)
  • bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml (3 hunks)
  • config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml (3 hunks)
  • internal/controller/nodeagent.go (1 hunks)
  • internal/controller/nodeagent_test.go (3 hunks)
  • internal/controller/velero.go (1 hunks)
  • internal/controller/velero_test.go (3 hunks)
🔇 Additional comments (7)
api/v1alpha1/dataprotectionapplication_types.go (1)

365-367: API change is correct

Optional PriorityClassName on PodConfig with the expected json tag aligns with the CRD.

config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml (1)

497-499: Bundle is in sync with base CRD

Verification confirms priorityClassName is present at all three locations in the bundle (497–499, 854–856, 1374–1376) with consistent field definitions. The change has been properly propagated.

internal/controller/nodeagent_test.go (1)

258-259: New test option field looks good

The addition aligns with PodSpec’s string field. No issues.

bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml (1)

497-500: CRD schema additions are correct and consistent

All verification checks passed:

  • API type has correct json tag: api/v1alpha1/dataprotectionapplication_types.go:367
  • Base and bundle CRDs are in sync with 3 priorityClassName occurrences each (nodeAgent, restic, velero)
  • Velero controller correctly applies the field from dpa.Spec.Configuration.Velero.PodConfig.PriorityClassName (velero.go:204-209)
  • NodeAgent controller correctly applies the field from dpa.Spec.Configuration.NodeAgent.PodConfig.PriorityClassName (nodeagent.go:362-367)
  • Restic field exists in CRD for backwards compatibility despite being deprecated in favor of nodeAgent
internal/controller/velero_test.go (3)

634-634: LGTM! Clean addition of the test option field.

The priorityClassName field addition follows the existing naming conventions and patterns in the test helper struct.


774-777: LGTM! Correct implementation of PriorityClassName assignment.

The conditional logic properly checks for a non-empty string before setting the field on the deployment's pod template spec, following the same pattern as other optional fields in this helper function.


1038-1061: LGTM! Comprehensive test coverage for PriorityClassName feature.

The test case properly validates that a PriorityClassName specified in the DPA's PodConfig is correctly propagated to the Velero deployment. The test follows established patterns and uses realistic test data.

@kaovilai
Copy link
Copy Markdown
Member Author

kaovilai commented Nov 5, 2025

@coderabbitai help

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 5, 2025

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue comments.

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai evaluate custom pre-merge check --instructions <custom-checks-instructions> --name <custom-checks-title> [--mode <error|warning>] to validate the custom pre-merge checks instructions. Defaults to error when --mode is omitted.
    • @coderabbitai ignore pre-merge checks to override pre-merge checks and get an approval on PR.
    • @coderabbitai run pre-merge checks to run pre-merge checks on the pull request.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit configuration file (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

@kaovilai

This comment was marked as off-topic.

@kaovilai

This comment was marked as off-topic.

@kaovilai

This comment was marked as off-topic.

@kaovilai

This comment was marked as off-topic.

@kaovilai

This comment was marked as off-topic.

@kaovilai

This comment was marked as off-topic.

@kaovilai

This comment was marked as off-topic.

@kaovilai

This comment was marked as off-topic.

@kaovilai

This comment was marked as off-topic.

@kaovilai

This comment was marked as off-topic.

@kaovilai

This comment was marked as off-topic.

@kaovilai

This comment was marked as off-topic.

@kaovilai

This comment was marked as off-topic.

2 similar comments
@kaovilai

This comment was marked as off-topic.

@weshayutin

This comment was marked as off-topic.

@kaovilai

This comment was marked as off-topic.

@kaovilai

This comment was marked as off-topic.

@kaovilai

This comment was marked as off-topic.

@kaovilai

This comment was marked as off-topic.

@kaovilai

This comment was marked as off-topic.

1 similar comment
@kaovilai
Copy link
Copy Markdown
Member Author

/retest

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 23, 2026
- Introduced PriorityClassName field in PodConfig struct to allow specification of pod priority.
- Updated CRD and related manifests to include PriorityClassName description.
- Modified NodeAgent and Velero deployment builders to utilize PriorityClassName from DataProtectionApplication spec.
- Enhanced tests to validate PriorityClassName functionality in NodeAgent and Velero deployments.
Copilot AI review requested due to automatic review settings March 30, 2026 19:08
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for configuring Kubernetes priorityClassName on pods created by the OADP operator via spec.configuration.*.podConfig.priorityClassName in the DataProtectionApplication API, wiring it through to the Velero Deployment and NodeAgent DaemonSet, and updating generated CRDs/manifests and unit tests accordingly.

Changes:

  • Extend PodConfig API type with PriorityClassName.
  • Plumb PriorityClassName into Velero Deployment and NodeAgent DaemonSet builders via install.WithPriorityClassName(...).
  • Update CRD/bundle manifests and add/extend tests to validate the behavior.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
api/v1alpha1/dataprotectionapplication_types.go Adds PriorityClassName to PodConfig (API surface).
internal/controller/velero.go Applies PodConfig.PriorityClassName to the Velero Deployment build.
internal/controller/nodeagent.go Applies PodConfig.PriorityClassName to the NodeAgent DaemonSet build.
internal/controller/velero_test.go Adds test coverage for Velero Deployment priorityClassName behavior.
internal/controller/nodeagent_test.go Adds test coverage for NodeAgent DaemonSet priorityClassName behavior.
config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml Updates the generated CRD schema to include priorityClassName.
bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml Updates the shipped bundle CRD schema to include priorityClassName.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Mar 30, 2026

@kaovilai: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/4.19-e2e-test-aws 5e23ee3 link true /test 4.19-e2e-test-aws
ci/prow/4.19-e2e-test-cli-aws 5e23ee3 link true /test 4.19-e2e-test-cli-aws
ci/prow/4.20-e2e-test-cli-aws 5e23ee3 link false /test 4.20-e2e-test-cli-aws
ci/prow/4.21-e2e-test-cli-aws 5e23ee3 link false /test 4.21-e2e-test-cli-aws

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@kaovilai
Copy link
Copy Markdown
Member Author

/retest

Copy link
Copy Markdown
Contributor

@weshayutin weshayutin left a comment

Choose a reason for hiding this comment

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

/LGTM

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 31, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Mar 31, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kaovilai, sseago, weshayutin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants