Skip to content

Conversation

@zeeke
Copy link
Contributor

@zeeke zeeke commented Nov 17, 2025

MultusNetworkPolicy implementation default to util.GetHostname to know the name of the node it is running on and filter pods accordingly. In some cases, that information might be not accurate, leading to a wrong behavior of the controller.

Use downward api to populate the --hostname argument of the multus network policy controller.

Link: https://github.com/kubernetes/component-helpers/blob/v0.34.2/node/util/hostname.go#L28

@coderabbitai
Copy link

coderabbitai bot commented Nov 17, 2025

Walkthrough

The multus-networkpolicy DaemonSet container now receives the node name at runtime: an environment variable K8S_NODE_NAME is set from spec.nodeName via a fieldRef, and the container args include a --hostname-override=$(K8S_NODE_NAME) flag to pass that per-node value to the process.

Changes

Cohort / File(s) Summary
Kubernetes manifest configuration
bindata/network/multus-networkpolicy/multus-networkpolicy.yaml
Adds environment variable K8S_NODE_NAME sourced from spec.nodeName via fieldRef and updates container args to include --hostname-override=$(K8S_NODE_NAME) for per-node hostname injection.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify the fieldRef path spec.nodeName is correct for the target Kubernetes API version.
  • Confirm the --hostname-override=$(K8S_NODE_NAME) substitution syntax matches the container entrypoint/argument parsing expectations.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent 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 c54a54b and a4d1b97.

📒 Files selected for processing (1)
  • bindata/network/multus-networkpolicy/multus-networkpolicy.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • bindata/network/multus-networkpolicy/multus-networkpolicy.yaml

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

@openshift-ci openshift-ci bot requested review from miheer and pperiyasamy November 17, 2025 17:45
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 17, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: zeeke
Once this PR has been reviewed and has the lgtm label, please assign abhat for approval. For more information see the Code Review Process.

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

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

Copy link

@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: 1

📜 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 fda7a9f and c54a54b.

📒 Files selected for processing (1)
  • bindata/network/multus-networkpolicy/multus-networkpolicy.yaml (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • bindata/network/multus-networkpolicy/multus-networkpolicy.yaml

MultusNetworkPolicy implementation default to `util.GetHostname`
to know the name of the node it is running on and filter pods accordingly.
In some cases, that information might be not accurate, leading to a
wrong behavior of the controller.

Use downward api to populate the `--hostname` argument of
the multus network policy controller.

Link: https://github.com/kubernetes/component-helpers/blob/v0.34.2/node/util/hostname.go#L28
Signed-off-by: Andrea Panattoni <apanatto@redhat.com>
@zeeke
Copy link
Contributor Author

zeeke commented Nov 18, 2025

/retest

2 similar comments
@zeeke
Copy link
Contributor Author

zeeke commented Nov 20, 2025

/retest

@zeeke
Copy link
Contributor Author

zeeke commented Nov 20, 2025

/retest

@zeeke
Copy link
Contributor Author

zeeke commented Nov 20, 2025

@pliurh @LionelJouin @bpickard22 please, take a look when you have time.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 20, 2025

@zeeke: 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/e2e-aws-ovn-windows a4d1b97 link true /test e2e-aws-ovn-windows
ci/prow/security a4d1b97 link false /test security

Full PR test history. Your PR dashboard.

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.

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.

1 participant