Skip to content

Add NetworkPolicy controller to restrict operator pod traffic (#110) - #174

Open
ompushkara wants to merge 3 commits into
sigstore:mainfrom
ompushkara:add/network-policies-upstream
Open

Add NetworkPolicy controller to restrict operator pod traffic (#110)#174
ompushkara wants to merge 3 commits into
sigstore:mainfrom
ompushkara:add/network-policies-upstream

Conversation

@ompushkara

Copy link
Copy Markdown
  • Add NetworkPolicy controller to restrict operator pod traffic

Introduce a self-healing NetworkPolicy reconciler that enforces ingress (9443, 8081) and egress (DNS, HTTPS, K8s API) rules on the operator pod. The controller watches for drift and recreates or updates the policy automatically. Includes RBAC permissions, POD_NAMESPACE downward API injection, unit tests, and test utility updates for NetworkPolicy scheme.

  • Add peer selectors and metrics port to NetworkPolicy

Add OLM upgrade version logic instead of manually hardcoding

  • Allow same-namespace pods to reach metrics port in NetworkPolicy

  • Drop namespace selectors for apiserver NetworkPolicy rules

  • Replace NetworkPolicy reconciler with one-shot startup install

Instead of a dedicated controller that watches and reconciles the NetworkPolicy, install it once at operator startup using a direct client call. This simplifies the codebase while achieving the same result — the operator's NetworkPolicy is created or updated before the manager starts.


Summary

Release Note

Documentation

* Add NetworkPolicy controller to restrict operator pod traffic

Introduce a self-healing NetworkPolicy reconciler that enforces ingress
(9443, 8081) and egress (DNS, HTTPS, K8s API) rules on the operator pod.
The controller watches for drift and recreates or updates the policy
automatically. Includes RBAC permissions, POD_NAMESPACE downward API
injection, unit tests, and test utility updates for NetworkPolicy scheme.

* Add peer selectors and metrics port to NetworkPolicy

Signed-off-by: ompushkara <omotilal@redhat.com>

Add OLM upgrade version logic instead of manually hardcoding

* Allow same-namespace pods to reach metrics port in NetworkPolicy

Signed-off-by: ompushkara <omotilal@redhat.com>

* Drop namespace selectors for apiserver NetworkPolicy rules

Signed-off-by: ompushkara <omotilal@redhat.com>

* Replace NetworkPolicy reconciler with one-shot startup install

Instead of a dedicated controller that watches and reconciles the
NetworkPolicy, install it once at operator startup using a direct
client call. This simplifies the codebase while achieving the same
result — the operator's NetworkPolicy is created or updated before
the manager starts.

Signed-off-by: ompushkara <omotilal@redhat.com>

---------

Signed-off-by: ompushkara <omotilal@redhat.com>
Signed-off-by: ompushkara <omotilal@redhat.com>
…to be in sync with what securesign operator does for upgrade

Signed-off-by: ompushkara <omotilal@redhat.com>
@ompushkara
ompushkara force-pushed the add/network-policies-upstream branch from 4810e2c to 9c483d2 Compare September 3, 2026 09:54
@ompushkara

ompushkara commented Sep 3, 2026

Copy link
Copy Markdown
Author

Added OLM upgrade test as well

Downstream PRs :

securesign#104
securesign#110

@ompushkara
ompushkara force-pushed the add/network-policies-upstream branch from 9c483d2 to 940f6cd Compare September 3, 2026 10:07
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