Repository navigation
Add NetworkPolicy for destination mover pods - #31
Merged
Merged
Conversation
Rakshith-R
marked this pull request as draft
October 22, 2026 13:45
There was a problem hiding this comment.
🟢 Approval recommended
The focused networking changes align with existing mover connection paths and have supporting unit coverage, with no blocking issues identified.
No open issues 🎉
What changed in this PR
This PR hardens destination mover networking by limiting inbound traffic to the transfer ports and keeping the plaintext gRPC backend accessible only within the pod.
Changes:
- Binds plaintext gRPC to
127.0.0.1, preserving access through stunnel. - Adds persistent, destination-owned NetworkPolicies with mover-specific ingress ports and open egress; source movers are skipped.
- Adds controller permissions, policy watches, and unit tests for listener binding and policy reconciliation.
| File | Description |
|---|---|
internal/worker/common/destination.go |
Binds the plaintext gRPC listener to loopback. |
internal/worker/common/destination_test.go |
Tests the loopback address and listener binding. |
internal/mover/ceph/networkpolicy.go |
Defines and reconciles destination NetworkPolicies. |
internal/mover/ceph/networkpolicy_test.go |
Tests ports, selectors, ownership, source skipping, and policy updates. |
internal/mover/ceph/mover.go |
Ensures the policy during synchronization. |
internal/controller/replicationdestination_controller.go |
Adds NetworkPolicy permissions and ownership watches. |
config/rbac/role.yaml |
Grants the controller NetworkPolicy access. |
Review effort: Balanced
The destination gRPC server on port 8080 listened on all interfaces, exposing a plaintext endpoint to any pod that can reach the mover. Its only client is the stunnel sidecar at 127.0.0.1:8080, so bind to loopback. Also mark the unused receive in RsyncDaemon.Stop as explicitly discarded to fix the errcheck finding in golangci-lint v2.15.0. Assisted-by: Claude <noreply@anthropic.com> Signed-off-by: Rakshith R <rar@redhat.com>
Destination movers accept TLS, direct mTLS and CephFS rsync connections on their Service ports, but nothing restricts which pods can reach them. Add a NetworkPolicy that allows only those ports on the destination mover pods. Source movers run with hostNetwork, where NetworkPolicy is not enforced, so they get no policy. Assisted-by: Claude <noreply@anthropic.com> Signed-off-by: Rakshith R <rar@redhat.com>
Rakshith-R
force-pushed
the
mover-network-policy
branch
from
October 23, 2026 07:22
fc192e9 to
9d7f214
Compare
iPraveenParihar
approved these changes
Oct 27, 2026
Rakshith-R
marked this pull request as ready for review
October 30, 2026 06:45
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.
Summary
Restrict ingress to destination mover pods and stop exposing the plaintext gRPC backend outside the pod.
127.0.0.1, so it now binds127.0.0.1.networkpoliciesandOwns(NetworkPolicy)on the RD controllerDesign notes
hostNetwork, where NetworkPolicy is not reliably enforced.Testing
make test: pass. New unit tests cover the loopback bind, RBD vs CephFS ports, selector, owner reference, skipping source movers, and full port replacement when the mover type changes.make lint: 0 issues.make docker-buildandmake docker-build-mover: pass.🤖 Generated with Claude Code