Skip to content

chore(rosaeng-8224): reapply openshift-ingress network policies for HCPs - #2775

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
Ajpantuso:apantuso/rosaeng-8224
Jun 4, 2026
Merged

openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
Ajpantuso:apantuso/rosaeng-8224

Conversation

@Ajpantuso

@Ajpantuso Ajpantuso commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

chore

What this PR does / why we need it?

Reapplies openshift-ingress network policies for HCPs which were removed in openshift/hypershift#7872.

Which Jira/Github issue(s) this PR fixes?

Fixes # ROSAENG-8224

Special notes for your reviewer:

Pre-checks (if applicable):

  • Tested latest changes against a cluster

  • Included documentation changes with PR

  • If this is a new object that is not intended for the FedRAMP environment (if unsure, please reach out to team FedRAMP), please exclude it with:

    matchExpressions:
    - key: api.openshift.com/fedramp
      operator: NotIn
      values: ["true"]

Summary by CodeRabbit

  • New Features
    • Added selector-driven deployment configuration to target specific cluster subsets.
    • Enforced a network policy in hosted control plane namespaces that restricts ingress to namespaces with a designated policy-group label; generated policies are applied and pruned automatically.
    • Introduced placement rule and binding to apply the above policy set to designated management clusters.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: b6c6f2dc-6d50-4036-acaa-78105786b3b4

📥 Commits

Reviewing files that changed from the base of the PR and between b893563 and 67373c2.

⛔ Files ignored due to path filters (3)
  • hack/00-osd-managed-cluster-config-integration.yaml.tmpl is excluded by !hack/**
  • hack/00-osd-managed-cluster-config-production.yaml.tmpl is excluded by !hack/**
  • hack/00-osd-managed-cluster-config-stage.yaml.tmpl is excluded by !hack/**
📒 Files selected for processing (2)
  • deploy/rosaeng-8224/config.yaml
  • deploy/rosaeng-8224/rosaeng-8224.Policy.yaml
✅ Files skipped from review due to trivial changes (1)
  • deploy/rosaeng-8224/config.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • deploy/rosaeng-8224/rosaeng-8224.Policy.yaml

Walkthrough

This PR adds a network policy deployment targeting canary service clusters. It combines a SelectorSyncSet cluster selector configuration with an OCM Policy that enforces network segmentation in hosted control plane namespaces, selecting traffic sources by namespace labels and binding the policy to management clusters for orchestration.

Changes

Network Policy Deployment for Canary Service Clusters

Layer / File(s) Summary
Deployment cluster selector configuration
deploy/rosaeng-8224/config.yaml
SelectorSyncSet deployment mode targets clusters where ext-hypershift.openshift.io/cluster-type is service-cluster and ext-hypershift.openshift.io/cluster-sector is canary.
Network policy enforcement template
deploy/rosaeng-8224/rosaeng-8224.Policy.yaml
OCM Policy generates per-namespace ConfigurationPolicy objects in hosted control plane namespaces, enforcing a NetworkPolicy that restricts ingress to sources from namespaces labeled network.openshift.io/policy-group: ingress, with remediationAction: enforce and complianceType: musthave.
Policy placement and binding to management clusters
deploy/rosaeng-8224/rosaeng-8224.Policy.yaml
PlacementRule and PlacementBinding bind the Policy to management clusters selected by hypershift.open-cluster-management.io/management-cluster: true.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5 | ❌ 10

❌ Failed checks (10 inconclusive)

Check name Status Explanation Resolution
Stable And Deterministic Test Names ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Test Structure And Quality ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Microshift Test Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Single Node Openshift (Sno) Test Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Topology-Aware Scheduling Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Ote Binary Stdout Contract ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Ipv6 And Disconnected Network Test Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
No-Weak-Crypto ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Container-Privileges ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
No-Sensitive-Data-In-Logs ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the main change: reapplying openshift-ingress network policies for Hosted Control Planes (HCPs), which is the core purpose reflected in both the raw summary and PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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

@openshift-ci
openshift-ci Bot requested review from ravitri and rogbas June 4, 2026 12:58
@Ajpantuso

Copy link
Copy Markdown
Contributor Author

/hold

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 4, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@deploy/rosaeng-8224/config.yaml`:
- Around line 2-11: Update the clusterSelectors.matchExpressions to include the
required selector keys so the policy is scoped to product/platform/FedRAMP;
specifically add expressions for "api.openshift.com/product",
"hive.openshift.io/cluster-platform", and "api.openshift.com/fedramp" (using
operator: In and appropriate allowed values for your deployment), alongside the
existing "hypershift.open-cluster-management.io/management-cluster" and
"ext-hypershift.openshift.io/cluster-sector" entries; ensure these keys are
added within the same matchExpressions array in the config handling
clusterSelectors so the policy only targets clusters that meet all required
selectors.

In `@deploy/rosaeng-8224/rosaeng-8224.Policy.yaml`:
- Around line 10-11: The check using index .metadata.labels
"hypershift.openshift.io/hosted-control-plane" can panic when .metadata.labels
is nil; fix by defaulting the labels map to an empty dict before indexing
(create a local variable, e.g. $labels := .metadata.labels | default dict) and
then use index $labels "hypershift.openshift.io/hosted-control-plane" in the if
condition so the template is nil-safe.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 52c09514-784b-4ebe-9941-3abbbe7f1aa1

📥 Commits

Reviewing files that changed from the base of the PR and between 21d8fed and cd82fd0.

⛔ Files ignored due to path filters (3)
  • hack/00-osd-managed-cluster-config-integration.yaml.tmpl is excluded by !hack/**
  • hack/00-osd-managed-cluster-config-production.yaml.tmpl is excluded by !hack/**
  • hack/00-osd-managed-cluster-config-stage.yaml.tmpl is excluded by !hack/**
📒 Files selected for processing (4)
  • deploy/acm-policies/50-GENERATED-rosaeng-8224.Policy.yaml
  • deploy/rosaeng-8224/config.yaml
  • deploy/rosaeng-8224/rosaeng-8224.Policy.yaml
  • scripts/generate-policy-config.py

Comment thread deploy/rosaeng-8224/config.yaml Outdated
Comment on lines +2 to +11
clusterSelectors:
matchExpressions:
- key: hypershift.open-cluster-management.io/management-cluster
operator: In
values:
- "true"
- key: ext-hypershift.openshift.io/cluster-sector
operator: In
values:
- "canary"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add required platform/compliance selector keys to cluster targeting.

Current matchExpressions omit the mandated selector keys for product/platform/FedRAMP scoping, so this policy can be applied outside intended compliance boundaries.

Suggested selector shape
 clusterSelectors:
   matchExpressions:
+    - key: api.openshift.com/product
+      operator: In
+      values:
+        - "rosa"
+    - key: hive.openshift.io/cluster-platform
+      operator: In
+      values:
+        - "aws"
+        - "gcp"
+        - "azure"
+    - key: api.openshift.com/fedramp
+      operator: NotIn
+      values:
+        - "true"
     - key: hypershift.open-cluster-management.io/management-cluster
       operator: In
       values:
         - "true"
     - key: ext-hypershift.openshift.io/cluster-sector
       operator: In
       values:
         - "canary"

As per coding guidelines, deploy configs must use selector-based targeting with api.openshift.com/product, hive.openshift.io/cluster-platform, and api.openshift.com/fedramp.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@deploy/rosaeng-8224/config.yaml` around lines 2 - 11, Update the
clusterSelectors.matchExpressions to include the required selector keys so the
policy is scoped to product/platform/FedRAMP; specifically add expressions for
"api.openshift.com/product", "hive.openshift.io/cluster-platform", and
"api.openshift.com/fedramp" (using operator: In and appropriate allowed values
for your deployment), alongside the existing
"hypershift.open-cluster-management.io/management-cluster" and
"ext-hypershift.openshift.io/cluster-sector" entries; ensure these keys are
added within the same matchExpressions array in the config handling
clusterSelectors so the policy only targets clusters that meet all required
selectors.

Comment thread deploy/rosaeng-8224/rosaeng-8224.Policy.yaml Outdated
@Ajpantuso
Ajpantuso force-pushed the apantuso/rosaeng-8224 branch from cd82fd0 to b893563 Compare June 4, 2026 13:18
@Ajpantuso

Copy link
Copy Markdown
Contributor Author

/hold cancel

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 4, 2026
@Ajpantuso
Ajpantuso force-pushed the apantuso/rosaeng-8224 branch from b893563 to 67373c2 Compare June 4, 2026 13:23

@joshbranham joshbranham 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
/approve

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 4, 2026
@openshift-ci

openshift-ci Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Ajpantuso, joshbranham

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 4, 2026
@openshift-ci

openshift-ci Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@Ajpantuso: all tests passed!

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
openshift-merge-bot Bot merged commit 20927c3 into openshift:master Jun 4, 2026
4 checks passed
@Ajpantuso
Ajpantuso deleted the apantuso/rosaeng-8224 branch June 4, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants