Skip to content

OADP-7665: Pass --log-level to NodeAgent DaemonSet container args - #2139

Open
kaovilai wants to merge 1 commit into
openshift:oadp-devfrom
kaovilai:pass-log-level-to-nodeagent
Open

OADP-7665: Pass --log-level to NodeAgent DaemonSet container args#2139
kaovilai wants to merge 1 commit into
openshift:oadp-devfrom
kaovilai:pass-log-level-to-nodeagent

Conversation

@kaovilai

@kaovilai kaovilai commented Mar 27, 2026

Copy link
Copy Markdown
Member

Summary

  • Pass --log-level from dpa.Spec.Configuration.Velero.LogLevel to NodeAgent DaemonSet container args
  • This allows the Velero exposer to inherit log level for data mover pods (via getInheritedPodInfo in pkg/exposer/image.go)
  • Previously, LogLevel was only passed to the Velero server deployment but not to NodeAgent

Request: https://redhat-internal.slack.com/archives/C0144ECKUJ0/p1772820634393599

Test plan

  • Unit test added for LogLevel=debug in NodeAgent DaemonSet build
  • go test ./internal/controller/ -run TestDPAReconciler_buildNodeAgentDaemonset passes
  • E2E: set logLevel: debug in DPA and verify node-agent pod has --log-level=debug in args
  • E2E: verify data mover pods spawned during backup/restore inherit the log level

🤖 Generated with Claude Code
via Happy

Summary by CodeRabbit

  • New Features
    • NodeAgent resource labels and annotations are now applied consistently to ConfigMaps, DaemonSets, and pod templates.
    • Additional NodeAgent arguments and Velero log-level settings are supported with predictable precedence.
    • Load affinity now supports storage-class constraints.
  • Bug Fixes
    • Unbounded pod resource values are normalized before configuration serialization.
    • DaemonSet cleanup succeeds when the resource is already absent.
    • Pod labels and annotations now require the appropriate NodeAgent ConfigMap configuration.

Copilot AI review requested due to automatic review settings March 27, 2026 13:42
@coderabbitai

coderabbitai Bot commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c0c4d35e-a9ec-4ca6-b699-9cf7b666890d

📥 Commits

Reviewing files that changed from the base of the PR and between 6449f95 and ec10bbf.

📒 Files selected for processing (2)
  • internal/controller/nodeagent.go
  • internal/controller/nodeagent_test.go

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


Walkthrough

NodeAgent reconciliation now handles Pod metadata, normalized resource values, storage-class affinity, DaemonSet metadata, missing DaemonSets, and argument precedence. Tests cover these behaviors and verify that ConfigMap generation does not mutate the DPA specification.

Changes

NodeAgent configuration and reconciliation

Layer / File(s) Summary
ConfigMap resources and affinity
internal/controller/nodeagent.go, internal/controller/nodeagent_test.go
ConfigMap generation requires Pod labels or annotations, normalizes unbounded resources, preserves annotations, and includes storage classes in load affinity. Tests cover resource defaults and DPA specification immutability.
DaemonSet metadata and deletion
internal/controller/nodeagent.go, internal/controller/nodeagent_test.go
Resource labels and annotations apply to the DaemonSet and pod template. Missing DaemonSets are treated as successfully deleted. Test DaemonSet constraints now use node affinity that excludes Windows nodes.
NodeAgent argument precedence
internal/controller/nodeagent.go, internal/controller/nodeagent_test.go
Configured Velero.LogLevel adds a log-level argument. ExtraArgs merge after generated log settings and before unsupported server-argument overrides. Tests verify argument precedence and log-level output.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to ec10b

This localized change passes the stated unit test and adds the configured log level to NodeAgent arguments; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: msfrucht

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: passing --log-level to the NodeAgent DaemonSet container arguments.
Description check ✅ Passed The description explains why the change was made and provides a test plan with a targeted unit test and command. It also identifies the pending E2E validations. The headings differ from the repository…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PASS. The pull request adds one table-test name: "valid DPA CR with LogLevel set to debug, NodeAgent DaemonSet is built with LogLevel set to debug". This is a fixed descriptive string. It contains no …
Test Structure And Quality ✅ Passed PASS: The pull request adds a case to an existing Go table test, not a new Ginkgo It block. The case checks only LogLevel argument propagation and uses the existing fake-client pattern. It creates…
Microshift Test Compatibility ✅ Passed PASS: The pull request adds a standard Go table-test case to TestDPAReconciler_buildNodeAgentDaemonset and extends its test helper. It does not add a Ginkgo It, Describe, Context, or When te…
Single Node Openshift (Sno) Test Compatibility ✅ Passed PASS: The pull request changes only internal/controller/nodeagent.go and internal/controller/nodeagent_test.go. It adds no test under tests/e2e and adds no new It, Describe, Context, or `W…
Topology-Aware Scheduling Compatibility ✅ Passed PASS: The pull request changes only NodeAgent container arguments and adds a matching unit-test case. The controller diff adds --log-level=<value>; it does not add or change nodeSelector, affinity…
Ote Binary Stdout Contract ✅ Passed PASS: The pull request changes only internal/controller/nodeagent.go and internal/controller/nodeagent_test.go. The added production code appends a --log-level argument to a DaemonSet container.…
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PASS. The pull request changes only internal/controller/nodeagent.go and the table-driven unit test TestDPAReconciler_buildNodeAgentDaemonset. The added test case checks LogLevel: "debug" and do…
No-Weak-Crypto ✅ Passed PASS: The pull request adds only --log-level argument handling and its test support. The exact added lines contain no MD5, SHA1, DES, 3DES, RC4, Blowfish, ECB, custom cryptography, or secret/token c…
Container-Privileges ✅ Passed PASS: The PR changes only NodeAgent argument handling and test setup for --log-level. The exact parent-to-PR diff adds no privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, `allowPrivil…
No-Sensitive-Data-In-Logs ✅ Passed The pull-request diff adds only --log-level=<validated DPA value> to the NodeAgent container arguments and matching test data. It adds no logging call and does not include passwords, tokens, API key…
Full details: Description check

Explanation

The description explains why the change was made and provides a test plan with a targeted unit test and command. It also identifies the pending E2E validations. The headings differ from the repository template, and no pictures are included, but the required information is mostly present.

Full details: Stable And Deterministic Test Names

Explanation

PASS. The pull request adds one table-test name: "valid DPA CR with LogLevel set to debug, NodeAgent DaemonSet is built with LogLevel set to debug". This is a fixed descriptive string. It contains no generated value, timestamp, node name, namespace, IP address, or runtime interpolation. The Ginkgo Describe and Entry titles were not changed.

Full details: Test Structure And Quality

Explanation

PASS: The pull request adds a case to an existing Go table test, not a new Ginkgo It block. The case checks only LogLevel argument propagation and uses the existing fake-client pattern. It creates no cluster resources, adds no Eventually or Consistently calls, and adds no cleanup or timeout requirement. The existing Ginkgo setup and assertions were not changed by this pull request.

Full details: Microshift Test Compatibility

Explanation

PASS: The pull request adds a standard Go table-test case to TestDPAReconciler_buildNodeAgentDaemonset and extends its test helper. It does not add a Ginkgo It, Describe, Context, or When test, and it does not add an e2e test. The existing Ginkgo suite and existing config.openshift.io Infrastructure fixture are unchanged. Therefore, the MicroShift compatibility failure condition does not apply.

Full details: Single Node Openshift (Sno) Test Compatibility

Explanation

PASS: The pull request changes only internal/controller/nodeagent.go and internal/controller/nodeagent_test.go. It adds no test under tests/e2e and adds no new It, Describe, Context, or When declaration. The new LogLevel coverage is a case in the existing TestDPAReconciler_buildNodeAgentDaemonset(t *testing.T) table and only compares constructed DaemonSet arguments. It does not schedule pods, inspect nodes, or assume cluster topology. SNO compatibility is therefore not applicable.

Full details: Topology-Aware Scheduling Compatibility

Explanation

PASS: The pull request changes only NodeAgent container arguments and adds a matching unit-test case. The controller diff adds --log-level=&lt;value&gt;; it does not add or change nodeSelector, affinity, topology spread constraints, tolerations, replica logic, or a PDB. Existing DaemonSet settings retain MaxUnavailable: 1 and MaxSurge: 0. Therefore, no topology constraint from the custom check is introduced.

Full details: Ote Binary Stdout Contract

Explanation

PASS: The pull request changes only internal/controller/nodeagent.go and internal/controller/nodeagent_test.go. The added production code appends a --log-level argument to a DaemonSet container. The added test code constructs expected arguments and adds a test case. No added line contains fmt.Print*, log.Print*, klog, os.Stdout, suite setup, TestMain, main, or init output. The existing fmt.Printf in the test file is unchanged and is not process-level code.

Full details: Ipv6 And Disconnected Network Test Compatibility

Explanation

PASS. The pull request changes only internal/controller/nodeagent.go and the table-driven unit test TestDPAReconciler_buildNodeAgentDaemonset. The added test case checks LogLevel: "debug" and does not create a Ginkgo e2e test, use IP addresses, or connect to external services. The existing Ginkgo declarations and the existing 1.1.1.1 test value are unchanged.

Full details: No-Weak-Crypto

Explanation

PASS: The pull request adds only --log-level argument handling and its test support. The exact added lines contain no MD5, SHA1, DES, 3DES, RC4, Blowfish, ECB, custom cryptography, or secret/token comparisons. The changed code only appends a configured log-level string to NodeAgent arguments.

Full details: Container-Privileges

Explanation

PASS: The PR changes only NodeAgent argument handling and test setup for --log-level. The exact parent-to-PR diff adds no privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, allowPrivilegeEscalation, or security-context fields. Existing NodeAgent privileged and root behavior is unchanged from the parent revision.

Full details: No-Sensitive-Data-In-Logs

Explanation

The pull-request diff adds only --log-level=&lt;validated DPA value&gt; to the NodeAgent container arguments and matching test data. It adds no logging call and does not include passwords, tokens, API keys, PII, hostnames, or customer data in log output. Existing NodeAgent logging is unchanged.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 27, 2026
@weshayutin

Copy link
Copy Markdown
Contributor

@kaovilai isn't there a jira on this ???

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR propagates spec.configuration.velero.logLevel from the DataProtectionApplication (DPA) CR into the NodeAgent DaemonSet container args, aligning node-agent logging behavior with the Velero server deployment.

Changes:

  • Append --log-level=<value> to the node-agent container args when dpa.Spec.Configuration.Velero.LogLevel is set.
  • Extend node-agent daemonset unit test scaffolding to support asserting log-level.
  • Add a unit test case validating LogLevel=debug results in --log-level=debug on the NodeAgent DaemonSet.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
internal/controller/nodeagent.go Passes DPA Velero logLevel into the node-agent DaemonSet container args.
internal/controller/nodeagent_test.go Adds test builder support and a unit test case asserting node-agent receives --log-level.

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

Comment on lines +697 to +699
if dpa.Spec.Configuration.Velero.LogLevel != "" {
nodeAgentContainer.Args = append(nodeAgentContainer.Args, fmt.Sprintf("--log-level=%s", dpa.Spec.Configuration.Velero.LogLevel))
}

Copilot AI Mar 27, 2026

Copy link

Choose a reason for hiding this comment

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

PR description references getInheritedPodInfo in pkg/exposer/image.go, but there is no pkg/exposer package (and no getInheritedPodInfo symbol) in this repository. Please update the PR description to point at the correct code path in this repo that consumes the node-agent --log-level arg, or clarify that it’s referring to an external component/repo.

Copilot uses AI. Check for mistakes.
@kaovilai

Copy link
Copy Markdown
Member Author

no jira yet.. thread

@weshayutin

Copy link
Copy Markdown
Contributor

/retest

@mpryc mpryc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@kaovilai is there any validation against improper log levels somewhere?

weshayutin
weshayutin previously approved these changes Mar 31, 2026

@weshayutin weshayutin left a comment

Copy link
Copy Markdown
Contributor

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
sseago
sseago previously approved these changes Mar 31, 2026
@kaovilai

Copy link
Copy Markdown
Member Author

is there any validation against improper log levels somewhere?

nodeagent will error out if that happens. Our CRD also have these markers to block invalid values.

// +kubebuilder:validation:Enum=trace;debug;info;warning;error;fatal;panic
LogLevel string `json:"logLevel,omitempty"`

@mpryc

mpryc commented Apr 1, 2026

Copy link
Copy Markdown
Contributor
Merge conflict in internal/controller/nodeagent_test.go
Automatic merge failed; fix conflicts and then commit the result.

@openshift-ci-robot

Copy link
Copy Markdown

/retest-required

Remaining retests: 0 against base HEAD 3cceb1e and 2 for PR HEAD 61e70f4 in total

@weshayutin

Copy link
Copy Markdown
Contributor

/retest

@weshayutin weshayutin changed the title Pass --log-level to NodeAgent DaemonSet container args OADP-7665 Pass --log-level to NodeAgent DaemonSet container args Apr 7, 2026
@kaovilai kaovilai changed the title OADP-7665 Pass --log-level to NodeAgent DaemonSet container args OADP-7665: Pass --log-level to NodeAgent DaemonSet container args Apr 7, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 7, 2026
@openshift-ci-robot

openshift-ci-robot commented Apr 7, 2026

Copy link
Copy Markdown

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

Details

In response to this:

Summary

  • Pass --log-level from dpa.Spec.Configuration.Velero.LogLevel to NodeAgent DaemonSet container args
  • This allows the Velero exposer to inherit log level for data mover pods (via getInheritedPodInfo in pkg/exposer/image.go)
  • Previously, LogLevel was only passed to the Velero server deployment but not to NodeAgent

Request: https://redhat-internal.slack.com/archives/C0144ECKUJ0/p1772820634393599

Test plan

  • Unit test added for LogLevel=debug in NodeAgent DaemonSet build
  • go test ./internal/controller/ -run TestDPAReconciler_buildNodeAgentDaemonset passes
  • E2E: set logLevel: debug in DPA and verify node-agent pod has --log-level=debug in args
  • E2E: verify data mover pods spawned during backup/restore inherit the log level

🤖 Generated with Claude Code
via Happy

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.

@weshayutin

Copy link
Copy Markdown
Contributor

/cherry-pick oadp-1.6

@openshift-cherrypick-robot

Copy link
Copy Markdown
Contributor

@weshayutin: once the present PR merges, I will cherry-pick it on top of oadp-1.6 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick oadp-1.6

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.

@kaovilai

kaovilai commented Apr 7, 2026

Copy link
Copy Markdown
Member Author

/retest

@kaovilai

kaovilai commented Apr 7, 2026

Copy link
Copy Markdown
Member Author

sounds like rebase needed..

@kaovilai
kaovilai force-pushed the pass-log-level-to-nodeagent branch from 61e70f4 to 6449f95 Compare April 7, 2026 21:27
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Apr 7, 2026
@kaovilai
kaovilai requested review from mpryc, sseago and weshayutin April 7, 2026 21:27
@weshayutin

Copy link
Copy Markdown
Contributor

/retest

@kaovilai

Copy link
Copy Markdown
Member Author

/override ci/prow/4.23-e2e-test-aws

@openshift-ci

openshift-ci Bot commented Apr 30, 2026

Copy link
Copy Markdown

@kaovilai: Overrode contexts on behalf of kaovilai: ci/prow/4.23-e2e-test-aws

Details

In response to this:

/override ci/prow/4.23-e2e-test-aws

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.

Joeavaikath
Joeavaikath previously approved these changes Apr 30, 2026
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 13, 2026
The DPA LogLevel field was only passed to the Velero server deployment
but not to the NodeAgent DaemonSet. This meant data mover pods spawned
by the exposer could not inherit the log level from the node-agent,
since the exposer reads --log-level from the node-agent container args.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
@kaovilai
kaovilai force-pushed the pass-log-level-to-nodeagent branch from 6449f95 to ec10bbf Compare August 26, 2026 14:56
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 26, 2026
@sseago

sseago commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci

openshift-ci Bot commented Aug 26, 2026

Copy link
Copy Markdown

[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

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 26, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD 2409f61 and 2 for PR HEAD ec10bbf in total

@openshift-ci

openshift-ci Bot commented Aug 26, 2026

Copy link
Copy Markdown

@kaovilai: The following test 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/5.0-e2e-test-cli-aws ec10bbf link true /test 5.0-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.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD d69edd0 and 1 for PR HEAD ec10bbf in total

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

Labels

ai-gen-bugfix ai-generated-test 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.

8 participants