ADR-006: Tailored NetworkPolicies for RHDH deployments [RHDHPLAN-1032] - #8
Conversation
Proposes adding default-deny NetworkPolicies scoped to RHDH-labeled pods for both Operator operands and Helm chart deployments, leveraging the additive nature of NetworkPolicies for user extensibility. Assisted-by: Claude
Add tailored NetworkPolicies to RHDH install methods to enforce least-privilege pod communication by default, addressing risks identified in the OCP Threat Model. Ensure policies are flexible for disconnected environments and do not break functionality on clusters without NetworkPolicy support.
Base policies cover only core traffic flows common to all deployments. All deployment-specific egress is the user's responsibility via additive NetworkPolicy resources. Assisted-by: Claude
…AT-819 reference Assisted-by: Claude
Updated section headers and improved documentation clarity regarding NetworkPolicies for RHDH.
Assisted-by: Claude
|
@rm3l: GitHub didn't allow me to request PR reviews from the following users: redhat-developer/rhdh-security, redhat-developer/rhdh-install. Note that only redhat-developer members and repo collaborators can review this PR, and authors cannot review their own PRs. DetailsIn response to this:
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 have few points as a reminder that is my concern that I can think of. What do you think about it ? @rm3l @Fortune-Ndlovu |
Co-authored-by: Subhash Khileri <subhashkhileri2@gmail.com> Assisted-by: Claude
Co-authored-by: Subhash Khileri <subhashkhileri2@gmail.com> Assisted-by: Claude
@polasudo For the "OCI registry egress in base policies", yes, it makes sense to add a note about that, especially when the default deployment would need to fetch plugins from registry.access.redhat.com or quay.io or even ghcr.io for community plugins. I'll add a note about that in the ADR. Anyway, we have a spike task to analyze and map RHDH traffic flows, which would help concretely define the base policies rules. |
Yes I was thinking abut some sort of policy template that would guide users to to pull plugins from ghcr for example or from some registry |
…to docs Add OCI (registry.access.redhat.com, quay.io) and NPM (npm.registry.redhat.com) plugin registries to base egress policies. Mention ready-to-use NetworkPolicy templates for common scenarios in the documentation guidance. Assisted-by: Claude Co-authored-by: Martin Polaško <50864147+polasudo@users.noreply.github.com>
makes sense. Updated in |
gazarenkov
left a comment
There was a problem hiding this comment.
Classification makes it more clear, thanks.
2 things:
- I guess I miss some decision details to understand how exactly we are going to implement it in each case (static manifest to provide, dynamicaly created etc)
- I would not totally reject CNP (as discussed)
| - **Clear boundary between base and user-managed policies**: The base policies shipped by the Operator and Helm chart cover DNS, API server access, PostgreSQL, broad HTTPS egress for the RHDH backend, and Orchestrator cross-namespace traffic. Egress on non-standard ports or to destinations not reachable over HTTPS (e.g., corporate proxies on custom ports) is the user's responsibility to allow via additive policies. | ||
| - **User-extensible via additive policies**: This split is possible because Kubernetes NetworkPolicies are **additive**: once a default-deny policy selects a pod, any additional NetworkPolicy matching that pod can only add more allow rules, never remove existing ones. Users who need to allow additional site-specific traffic simply create their own NetworkPolicy resources in the same namespace. These compose naturally with the base policies without any CRD or Helm values change. The base NetworkPolicies are always present and cannot be disabled. On clusters without NetworkPolicy enforcement, they simply have no effect | ||
| - **Documentation**: Clear documentation is essential to make this approach work in practice. Users need to understand which base policies are shipped, what traffic they allow and deny, how to create additional NetworkPolicies for their site-specific needs, and how to troubleshoot connectivity issues caused by policies. Documentation should also clarify the requirement for a NetworkPolicy-capable CNI plugin on non-OCP platforms, and provide ready-to-use NetworkPolicy templates for common plugin egress scenarios (e.g., GitHub/GitLab SCM access, Quay/Artifactory registries, OIDC providers) that users can copy and adapt for their environment | ||
| - **Label-scoped policies**: Since RHDH is a layered product deployed into potentially shared namespaces, policies use `podSelector` with RHDH-specific labels rather than namespace-wide selectors, following the OCP best practice for layered products |
There was a problem hiding this comment.
I believe the values are stable (even if not the same for Chart and Operator) and have to be specified and known outside of implementation so to me it is definitely a part of decision.
| Additionally, RHDH is supported across multiple Kubernetes platforms (OCP, EKS, AKS, GKE), each with different levels of default NetworkPolicy enforcement. OCP enforces NetworkPolicies out of the box, but other platforms may require users to configure a compatible CNI plugin. | ||
|
|
||
| ### Disconnected/airgapped environments | ||
|
|
There was a problem hiding this comment.
I do not think we can hardcode specific destinations in non-airgap as well, CIDRs in cloud services tend to change.
…tailored-networkpolicies-to-the-install-methods-operands-and-helm-chart
Document the exact labels used by each install method to scope NetworkPolicies to a specific component of a specific instance: Operator uses rhdh.redhat.com/app, Helm uses app.kubernetes.io/instance combined with app.kubernetes.io/component. Co-authored-by: Gennady Azarenkov <gazarenkov@gmail.com> Assisted-by: Claude
OCP team confirmed operators are expected to ship standard NetworkPolicies, not ANP. ANP is for cluster admins to override or tighten operator-shipped policies as needed. Assisted-by: Claude
…tailored-networkpolicies-to-the-install-methods-operands-and-helm-chart
Move key paragraphs (multi-platform support, plugin-driven unpredictable egress, disconnected environments) from the problem statement into Key constraints, reordered by impact. Rename ADR title from "Install Methods" to "Application Workloads" to avoid confusion with the Operator itself. Summarize user-extensible policies section, add CNP to Alternative 5, clarify Lightspeed as default since 1.10, replace em dashes with semicolons, and use CR-specific/release-specific terminology for label-scoped policies. Assisted-by: Claude
Add three example policies to the Decision section illustrating the label-scoped approach for both Operator and Helm chart paths: default-deny (Helm), allow Router ingress (Operator, OCP-specific), and DNS-only egress for PostgreSQL (Operator, cross-platform). Assisted-by: Claude
Address threat model finding about insecure Prometheus metrics port by explicitly documenting port 9464 ingress restriction to the monitoring namespace and adding a corresponding NetworkPolicy example. Assisted-by: Claude
…tailored-networkpolicies-to-the-install-methods-operands-and-helm-chart
Add a note that the NetworkPolicy examples are illustrative and that both Operator and Helm chart will ship equivalent policies OOTB. Add a note about reviewing future NetworkPolicy changes against this ADR as part of the standard PR review process. Co-authored-by: Kim Tsao <ktsao@redhat.com> Assisted-by: Claude
e5cc8cc to
bbdf08a
Compare
|
/agentic_review |
|
/agentic_review |
Code Review by QodoContext used 1.
|
…tailored-networkpolicies-to-the-install-methods-operands-and-helm-chart
- Add OOTB constraint for default base NetworkPolicies - Replace "layered product" wording with clearer description of RHDH workloads coexisting with unrelated workloads - Fix Helm pod labels to use app.kubernetes.io/name (developer-hub, postgresql) instead of app.kubernetes.io/component - Fix router ingress label inconsistency in the note - Rewrite Alternative 5 with concrete approach and 3 numbered rejection reasons from team discussion - Update positive consequence to include non-OCP clusters Assisted-by: Claude
Assisted-by: Claude
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 636250e |
Assisted-by: Claude
|
Merging as discussed. |
…to-the-install-methods-operands-and-helm-chart
Summary
Assisted-by: Claude
Related