Skip to content

CONSOLE-5431: Add allow-all NetworkPolicy to openshift-console namespace - #1199

Open
spadgett wants to merge 1 commit into
openshift:mainfrom
spadgett:console-network-policy
Open

CONSOLE-5431: Add allow-all NetworkPolicy to openshift-console namespace#1199
spadgett wants to merge 1 commit into
openshift:mainfrom
spadgett:console-network-policy

Conversation

@spadgett

@spadgett spadgett commented Jul 27, 2026

Copy link
Copy Markdown
Member

Add an operator-managed NetworkPolicy that allows all ingress and egress traffic in the openshift-console namespace. This ensures console pods have an explicit allow-all policy so that other default-deny policies do not block console traffic.

/cc @wking @TheRealJon

Summary by CodeRabbit

  • New Features
    • Added network access configuration for the console interface, supporting communication with the Kubernetes API and related services.
    • Enabled both inbound and outbound connectivity for console components.

@openshift-ci
openshift-ci Bot requested review from TheRealJon and wking July 27, 2026 16:49
@coderabbitai

coderabbitai Bot commented Jul 27, 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: ee8340d1-8818-421e-b45f-902555230512

📥 Commits

Reviewing files that changed from the base of the PR and between d6b33f2 and 2881c50.

📒 Files selected for processing (1)
  • manifests/03-networkpolicy-console.yaml
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • openshift/console (manual)
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{yaml,yml,json}

📄 CodeRabbit inference engine (Custom checks)

**/*.{yaml,yml,json}: Flag privileged: true, hostPID, hostNetwork, hostIPC, SYS_ADMIN capability, running as root without justification, and allowPrivilegeEscalation: true in container/Kubernetes manifests
When deployment manifests, operator code, or controllers are added/modified, ensure they do not introduce scheduling constraints assuming standard HA topology (3+ control-plane nodes, dedicated workers). Flag: required pod anti-affinity with maxUnavailable: 0 (deadlocks on SNO/TNF/TNA), pod topology spread with DoNotSchedule and hostname key (breaks on SNO), replica counts derived from node count without topology awareness, nodeSelector/node affinity targeting control-plane nodes (fails on HyperShift), scheduling to all control-plane nodes equally without excluding arbiter nodes (TNA), assuming dedicated worker nodes exist (SNO/TNF), or PodDisruptionBudgets designed for 3+ nodes (TNF/TNA). Do not flag if change checks ControlPlaneTopology, node counts, or topology labels before applying constraints.

Files:

  • manifests/03-networkpolicy-console.yaml
{manifests,bindata/assets,quickstarts,examples,profile-patches}/**/*.{yaml,yml}

📄 CodeRabbit inference engine (.claude/skills/manifest-review.md)

{manifests,bindata/assets,quickstarts,examples,profile-patches}/**/*.{yaml,yml}: Kubernetes manifests under manifests/, bindata/assets/, quickstarts/, examples/, and profile-patches/ must include the appropriate cluster profile annotations when they are CVO-deployed resources (for example include.release.openshift.io/hypershift, include.release.openshift.io/ibm-cloud-managed, include.release.openshift.io/self-managed-high-availability, and include.release.openshift.io/single-node-developer).
Console resources in the manifest trees must include the capability annotation capability.openshift.io/name: Console.
RBAC manifests must follow least-privilege design: grant only the permissions needed, avoid wildcards unless truly justified, use verbs that match the actual operation set, and set correct apiGroups ("" for core APIs and specific groups for CRDs).
Resources must use the correct namespace for their role: openshift-console for console workload resources and openshift-console-operator for operator resources; any cross-namespace reference must be explicit and intentional.
YAML manifests should use 2-space indentation, keep fields in a consistent order, and include --- separators between multiple resources in the same file.
When binding roles to service accounts, use console-operator in the openshift-console-operator namespace for operator cross-namespace access, and use console in the openshift-console namespace for console workload-scoped access.

Files:

  • manifests/03-networkpolicy-console.yaml
**/*.yaml

⚙️ CodeRabbit configuration file

**/*.yaml: Review YAML manifests based on content and kind.

Refer to /manifest-review when YAML contains:

  • kind: Role or kind: ClusterRole (RBAC review)
  • kind: RoleBinding or kind: ClusterRoleBinding
  • annotations: section (check for cluster profiles)
  • verbs: ["*"] or wildcard permissions
  • apiGroups: ["*"] or overly broad permissions
  • ServiceAccount references in subjects

Check for required annotations in manifests/:

  • include.release.openshift.io/hypershift
  • include.release.openshift.io/ibm-cloud-managed
  • include.release.openshift.io/self-managed-high-availability
  • include.release.openshift.io/single-node-developer
  • capability.openshift.io/name: Console

For quickstarts/, additionally check:

  • QuickStart spec structure
  • Task descriptions and prerequisites
  • See quickstarts/README.md for guidelines

Files:

  • manifests/03-networkpolicy-console.yaml
**/*.{yaml,yml}

⚙️ CodeRabbit configuration file

**/*.{yaml,yml}: If this is a Kubernetes/OpenShift manifest or Helm template:

  • securityContext: runAsNonRoot, readOnlyRootFilesystem,
    allowPrivilegeEscalation: false
  • Drop ALL capabilities, add only what is required
  • Resource limits (cpu, memory) on every container
  • No hostPID, hostNetwork, hostIPC, privileged: true
  • NetworkPolicy defined for the namespace
  • OpenShift: SCC must be restricted or custom-scoped
  • Liveness + readiness probes defined
  • automountServiceAccountToken: false unless needed
  • RBAC: least privilege; no cluster-admin for workloads
  • Helm: no .Values interpolation in shell commands

Files:

  • manifests/03-networkpolicy-console.yaml
🧠 Learnings (1)
📚 Learning: 2026-07-24T17:22:48.776Z
Learnt from: redhat-chai-bot
Repo: openshift/console-operator PR: 1198
File: manifests/03-networkpolicy-operator-allow-apiserver-egress.yaml:19-22
Timestamp: 2026-07-24T17:22:48.776Z
Learning: For CVO-managed OpenShift operator NetworkPolicy manifests that must allow egress to the Kubernetes API server (TCP 6443), do not rely on podSelector/namespaceSelector targeting for the API server, because the API server may be host-networked and therefore not reliably matchable. Also avoid static ipBlock rules since API server addresses vary by cluster and topology. Instead, use a destination-less egress rule for TCP port 6443 only when the manifest explicitly documents the rationale explaining why selectors/ipBlock cannot be used.

Applied to files:

  • manifests/03-networkpolicy-console.yaml
🔇 Additional comments (1)
manifests/03-networkpolicy-console.yaml (1)

1-25: LGTM!


Walkthrough

Adds a Kubernetes NetworkPolicy for all pods in the openshift-console namespace, enabling ingress and egress policy types with unrestricted traffic rules and OpenShift-specific metadata.

Changes

Console network policy

Layer / File(s) Summary
Allow console pod traffic
manifests/03-networkpolicy-console.yaml
Adds a NetworkPolicy selecting all openshift-console pods and allowing unrestricted ingress and egress traffic.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: wking, therealjon

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is far too brief and omits the required analysis, solution, test setup, test cases, conformance, and reviewer sections. Fill in the template sections with root cause, solution details, test setup, test cases, browser conformance, additional info, and reviewers/assignees.
✅ Passed checks (14 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the change: it clearly states an allow-all NetworkPolicy added to the openshift-console namespace.
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.
Stable And Deterministic Test Names ✅ Passed Diff only adds a NetworkPolicy manifest; no Ginkgo test titles were added or modified.
Test Structure And Quality ✅ Passed Only manifests/03-networkpolicy-console.yaml changed; no Ginkgo test files were added or modified, so the test-quality check is not applicable.
Microshift Test Compatibility ✅ Passed Only a NetworkPolicy manifest changed; no new Ginkgo tests or MicroShift-relevant test code were added.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR only adds a YAML NetworkPolicy manifest; no Ginkgo/e2e tests were added, so SNO compatibility is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed Only a NetworkPolicy was added; it has no nodeSelector, affinity, topology spread, replicas, or PDB changes, so it adds no scheduling constraints.
Ote Binary Stdout Contract ✅ Passed PR only adds a NetworkPolicy manifest; no process-level code or stdout writes were introduced.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Only a NetworkPolicy manifest was added; no Ginkgo/e2e tests or IPv4/external-connectivity assumptions were introduced.
No-Weak-Crypto ✅ Passed PR only adds a NetworkPolicy YAML; it introduces no crypto primitives, ciphers, or secret comparisons.
Container-Privileges ✅ Passed The only added manifest is a NetworkPolicy and contains none of the flagged container-privilege fields.
No-Sensitive-Data-In-Logs ✅ Passed PASS: The only added content is a NetworkPolicy manifest; no log statements or sensitive values (tokens, PII, hostnames, customer data) are present.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 27, 2026
@spadgett spadgett changed the title Add allow-all NetworkPolicy to openshift-console namespace CONSOLE-5431: Add allow-all NetworkPolicy to openshift-console namespace Jul 27, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 27, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@spadgett: This pull request references CONSOLE-5431 which is a valid jira issue.

Details

In response to this:

Add an operator-managed NetworkPolicy that allows all ingress and egress traffic in the openshift-console namespace. This ensures console pods have an explicit allow-all policy so that other default-deny policies do not block console traffic.

/cc @wking @TheRealJon

Summary by CodeRabbit

  • New Features
  • Added automatic management of a default network policy for the console.
  • Managed mode allows console ingress and egress traffic.
  • Unmanaged mode leaves the policy unchanged; Removed mode deletes it.
  • Permissions
  • Granted the console operator permissions to create, update, monitor, and delete network policies.

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 openshift-eng/jira-lifecycle-plugin repository.

@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

🧹 Nitpick comments (3)
pkg/console/controllers/networkpolicy/controller.go (2)

3-27: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use the repository’s commented import groups.

This file groups imports only by blank lines; it omits the required standard-library, third-party, kube, OpenShift, and internal comment sections.

As per coding guidelines, “Group imports with commented sections for standard library, third-party, kube, openshift, and operator/internal packages.”

🤖 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 `@pkg/console/controllers/networkpolicy/controller.go` around lines 3 - 27,
Update the import block in the network policy controller to use the repository’s
required commented sections: standard library, third-party, Kubernetes,
OpenShift, and operator/internal packages. Preserve all existing imports and
only reorganize them under the appropriate comments.

Sources: Coding guidelines, Path instructions


36-42: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add Godoc for the exported constructor.

NewNetworkPolicyController needs an immediately preceding comment describing what it constructs.

As per coding guidelines, “Document exported Go functions with a Godoc comment that explains what the function does.”

🤖 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 `@pkg/console/controllers/networkpolicy/controller.go` around lines 36 - 42,
Add an immediately preceding Godoc comment for the exported
NewNetworkPolicyController function, beginning with its name and briefly
describing that it constructs and returns a network policy controller. Do not
change the constructor signature or implementation.

Sources: Coding guidelines, Path instructions

manifests/03-rbac-role-ns-console.yaml (1)

80-90: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Scope named mutations to allow-all.

The controller applies the fixed policy and deletes only api.ConsoleNetworkPolicyName (Lines 88 and 96 in pkg/console/controllers/networkpolicy/controller.go), but this grants get, update, and delete on every NetworkPolicy in the namespace. Split those verbs into a resourceNames: ["allow-all"] rule; retain unrestricted list, watch, and create only where Kubernetes RBAC requires it.

As per coding guidelines, “RBAC manifests must follow least-privilege design: grant only the permissions needed.”

🤖 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 `@manifests/03-rbac-role-ns-console.yaml` around lines 80 - 90, Update the
NetworkPolicy rules in the RBAC manifest to scope get, update, and delete
permissions with resourceNames containing only allow-all. Keep list, watch, and
create unrestricted in a separate rule as required by Kubernetes RBAC,
preserving only the permissions needed by the controller.

Sources: Coding guidelines, Path instructions, Linters/SAST tools

🤖 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 `@pkg/console/controllers/networkpolicy/controller.go`:
- Around line 65-67: Wrap the error returned by operatorConfigLister.Get in the
controller reconciliation flow with fmt.Errorf using the context “failed to get
operator config: %w”. Also wrap non-NotFound errors from the network policy
delete path with “failed to delete network policy: %w”, while preserving the
existing NotFound handling.
- Around line 71-92: Move creation of the status handler and the
NetworkPolicySync status update/flush flow before the management-state switch in
the controller reconciliation method. Ensure the Removed path reports and
flushes failures from removeNetworkPolicy, and the unknown-state path records
and flushes its error, while Managed and Unmanaged retain their existing
behavior.

---

Nitpick comments:
In `@manifests/03-rbac-role-ns-console.yaml`:
- Around line 80-90: Update the NetworkPolicy rules in the RBAC manifest to
scope get, update, and delete permissions with resourceNames containing only
allow-all. Keep list, watch, and create unrestricted in a separate rule as
required by Kubernetes RBAC, preserving only the permissions needed by the
controller.

In `@pkg/console/controllers/networkpolicy/controller.go`:
- Around line 3-27: Update the import block in the network policy controller to
use the repository’s required commented sections: standard library, third-party,
Kubernetes, OpenShift, and operator/internal packages. Preserve all existing
imports and only reorganize them under the appropriate comments.
- Around line 36-42: Add an immediately preceding Godoc comment for the exported
NewNetworkPolicyController function, beginning with its name and briefly
describing that it constructs and returns a network policy controller. Do not
change the constructor signature or implementation.
🪄 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: 1625d09e-4e42-4790-8b3e-ba3b42a7decf

📥 Commits

Reviewing files that changed from the base of the PR and between 694a2de and d6b33f2.

📒 Files selected for processing (5)
  • bindata/assets/networkpolicies/allow-all.yaml
  • manifests/03-rbac-role-ns-console.yaml
  • pkg/api/api.go
  • pkg/console/controllers/networkpolicy/controller.go
  • pkg/console/starter/starter.go
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • openshift/console (manual)
📜 Review details
🧰 Additional context used
📓 Path-based instructions (12)
bindata/assets/**/*.yaml

📄 CodeRabbit inference engine (ARCHITECTURE.md)

Store static YAML assets in bindata/assets/ organized by resource type (configmaps/, deployments/, pdb/, routes/, services/)

Files:

  • bindata/assets/networkpolicies/allow-all.yaml
**/*.{yaml,yml,json}

📄 CodeRabbit inference engine (Custom checks)

**/*.{yaml,yml,json}: Flag privileged: true, hostPID, hostNetwork, hostIPC, SYS_ADMIN capability, running as root without justification, and allowPrivilegeEscalation: true in container/Kubernetes manifests
When deployment manifests, operator code, or controllers are added/modified, ensure they do not introduce scheduling constraints assuming standard HA topology (3+ control-plane nodes, dedicated workers). Flag: required pod anti-affinity with maxUnavailable: 0 (deadlocks on SNO/TNF/TNA), pod topology spread with DoNotSchedule and hostname key (breaks on SNO), replica counts derived from node count without topology awareness, nodeSelector/node affinity targeting control-plane nodes (fails on HyperShift), scheduling to all control-plane nodes equally without excluding arbiter nodes (TNA), assuming dedicated worker nodes exist (SNO/TNF), or PodDisruptionBudgets designed for 3+ nodes (TNF/TNA). Do not flag if change checks ControlPlaneTopology, node counts, or topology labels before applying constraints.

Files:

  • bindata/assets/networkpolicies/allow-all.yaml
  • manifests/03-rbac-role-ns-console.yaml
{manifests,bindata/assets,quickstarts,examples,profile-patches}/**/*.{yaml,yml}

📄 CodeRabbit inference engine (.claude/skills/manifest-review.md)

{manifests,bindata/assets,quickstarts,examples,profile-patches}/**/*.{yaml,yml}: Kubernetes manifests under manifests/, bindata/assets/, quickstarts/, examples/, and profile-patches/ must include the appropriate cluster profile annotations when they are CVO-deployed resources (for example include.release.openshift.io/hypershift, include.release.openshift.io/ibm-cloud-managed, include.release.openshift.io/self-managed-high-availability, and include.release.openshift.io/single-node-developer).
Console resources in the manifest trees must include the capability annotation capability.openshift.io/name: Console.
RBAC manifests must follow least-privilege design: grant only the permissions needed, avoid wildcards unless truly justified, use verbs that match the actual operation set, and set correct apiGroups ("" for core APIs and specific groups for CRDs).
Resources must use the correct namespace for their role: openshift-console for console workload resources and openshift-console-operator for operator resources; any cross-namespace reference must be explicit and intentional.
YAML manifests should use 2-space indentation, keep fields in a consistent order, and include --- separators between multiple resources in the same file.
When binding roles to service accounts, use console-operator in the openshift-console-operator namespace for operator cross-namespace access, and use console in the openshift-console namespace for console workload-scoped access.

Files:

  • bindata/assets/networkpolicies/allow-all.yaml
  • manifests/03-rbac-role-ns-console.yaml
**/*.yaml

⚙️ CodeRabbit configuration file

**/*.yaml: Review YAML manifests based on content and kind.

Refer to /manifest-review when YAML contains:

  • kind: Role or kind: ClusterRole (RBAC review)
  • kind: RoleBinding or kind: ClusterRoleBinding
  • annotations: section (check for cluster profiles)
  • verbs: ["*"] or wildcard permissions
  • apiGroups: ["*"] or overly broad permissions
  • ServiceAccount references in subjects

Check for required annotations in manifests/:

  • include.release.openshift.io/hypershift
  • include.release.openshift.io/ibm-cloud-managed
  • include.release.openshift.io/self-managed-high-availability
  • include.release.openshift.io/single-node-developer
  • capability.openshift.io/name: Console

For quickstarts/, additionally check:

  • QuickStart spec structure
  • Task descriptions and prerequisites
  • See quickstarts/README.md for guidelines

Files:

  • bindata/assets/networkpolicies/allow-all.yaml
  • manifests/03-rbac-role-ns-console.yaml
**/*.{yaml,yml}

⚙️ CodeRabbit configuration file

**/*.{yaml,yml}: If this is a Kubernetes/OpenShift manifest or Helm template:

  • securityContext: runAsNonRoot, readOnlyRootFilesystem,
    allowPrivilegeEscalation: false
  • Drop ALL capabilities, add only what is required
  • Resource limits (cpu, memory) on every container
  • No hostPID, hostNetwork, hostIPC, privileged: true
  • NetworkPolicy defined for the namespace
  • OpenShift: SCC must be restricted or custom-scoped
  • Liveness + readiness probes defined
  • automountServiceAccountToken: false unless needed
  • RBAC: least privilege; no cluster-admin for workloads
  • Helm: no .Values interpolation in shell commands

Files:

  • bindata/assets/networkpolicies/allow-all.yaml
  • manifests/03-rbac-role-ns-console.yaml
**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

**/*.go: Follow Go coding standards and patterns documented in CONVENTIONS.md
Organize imports according to conventions documented in CONVENTIONS.md
Use gofmt to format Go code with standard formatting
Run go vet checks on all Go packages

Follow Go coding standards and patterns as documented in CONVENTIONS.md, including proper import organization

Organize Go code following the repository structure: main entry point in cmd/console/main.go, API constants in pkg/api/, operator command setup in pkg/cmd/operator/, and version command in pkg/cmd/version/

**/*.go: Use gofmt for formatting Go code
Follow standard Go naming conventions
Group imports in order: standard lib, 3rd party, kube/openshift, internal (marked with comments)
Use meaningful error messages with context in Go code
Set status conditions using status.Handle* functions with type prefixes (*Degraded, *Progressing, *Available, *Upgradeable)
Use typed errors and wrap errors to preserve stack context

Flag MD5, SHA1, DES, RC4, 3DES, Blowfish, and ECB mode cryptographic usage. Also flag custom crypto implementations and non-constant-time comparison of secrets or tokens.

**/*.go: Do not use deprecated Go APIs such as ioutil.ReadFile, ioutil.WriteFile, ioutil.ReadAll, or net.Dial in Dial callbacks; use os.ReadFile, os.WriteFile, io.ReadAll, and DialContext instead.
When returning errors in Go, wrap them with %w and include meaningful context instead of returning the raw error or using %v.
Use specific error checks such as apierrors.IsNotFound(err) instead of matching error strings with strings.Contains(err.Error(), ...).
Propagate the caller’s context.Context through operations and avoid replacing it with context.Background() inside request/controller code.
Use defer to release acquired resources so cleanup happens on all return paths.
Avoid god functions: keep Go functions to roughly under 100 lines and split code with too many responsibilities into smaller...

Files:

  • pkg/api/api.go
  • pkg/console/starter/starter.go
  • pkg/console/controllers/networkpolicy/controller.go

⚙️ CodeRabbit configuration file

**/*.go: Review Go code following OpenShift operator patterns.
See CONVENTIONS.md for coding standards and patterns.

Refer to the following skills based on CODE PATTERNS, not just file paths:

Refer to /controller-review when code contains:

  • Controller struct types (e.g., type *Controller struct)
  • func New*Controller( factory functions
  • factory.New().WithFilteredEventsInformers( pattern
  • .ToController( method calls
  • Sync(ctx context.Context, controllerContext factory.SyncContext) methods
  • operatorConfig.Spec.ManagementState checks
  • status.NewStatusHandler or status.Handle* functions

Refer to /sync-handler-review when code contains:

  • Main operator sync functions (e.g., sync_v400.go content)
  • Sequential resource syncing with early returns
  • Incremental reconciliation loops
  • Multiple resourceapply.Apply*() calls in sequence
  • Dependency ordering of ConfigMaps → Secrets → Service Accounts → RBAC → Services → Deployments → Routes
  • Feature gate conditional logic

Refer to /go-quality-review for all Go code to check:

  • Deprecated imports: ioutil.ReadFile, ioutil.WriteFile, ioutil.ReadAll
  • Deprecated patterns: Dial without DialContext
  • Error handling: missing %w in fmt.Errorf
  • Code smells: deep nesting (4+ levels), functions >100 lines
  • Magic values: unexplained numbers/strings
  • Context propagation: context.Background() instead of passed ctx
  • Missing godoc on exported functions

Files:

  • pkg/api/api.go
  • pkg/console/starter/starter.go
  • pkg/console/controllers/networkpolicy/controller.go
{pkg,cmd}/**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

Use gofmt for code formatting on pkg and cmd directories

{pkg,cmd}/**/*.go: Format code using gofmt -w ./pkg ./cmd
Run go vet checks on all Go packages in ./pkg and ./cmd

Files:

  • pkg/api/api.go
  • pkg/console/starter/starter.go
  • pkg/console/controllers/networkpolicy/controller.go
**/*.{py,js,ts,go,rs,java,rb,php,kt,swift,cs}

⚙️ CodeRabbit configuration file

**/*.{py,js,ts,go,rs,java,rb,php,kt,swift,cs}: Injection prevention (prodsec-skills):

  • SQL: parameterized queries only; no string concatenation
  • Command: no shell=True, os.system, or backtick exec with user input
  • LDAP/XPath: escape special characters in filters
  • Path traversal: canonicalize paths, reject ../
  • Deserialization: no pickle/yaml.load()/eval on untrusted data
  • Prototype pollution: no recursive merge of untrusted objects
  • Validate at trust boundaries with allow-lists, not deny-lists
  • Normalize Unicode and anchor regexes (^$); watch for ReDoS

Files:

  • pkg/api/api.go
  • pkg/console/starter/starter.go
  • pkg/console/controllers/networkpolicy/controller.go
pkg/console/starter/**/*.go

📄 CodeRabbit inference engine (ARCHITECTURE.md)

Access feature gates via featuregates.FeatureGateAccess in starter.go for features like ExternalOIDC and ConsolePluginContentSecurityPolicy

Files:

  • pkg/console/starter/starter.go
pkg/console/controllers/**/*.go

📄 CodeRabbit inference engine (ARCHITECTURE.md)

Place all controller implementations in pkg/console/controllers/ subdirectory, with each controller in its own package (e.g., clidownloads/, oauthclients/, route/, service/)

Files:

  • pkg/console/controllers/networkpolicy/controller.go
**/*controller*.go

📄 CodeRabbit inference engine (CONVENTIONS.md)

Use the OpenShift library-go factory pattern for controllers

**/*controller*.go: Use the controller factory pattern with factory.New().WithFilteredEventsInformers(), util.IncludeNamesFilter() for informer filtering, and a descriptive ToController() call with a recorder.
In controller sync logic, handle all operatorConfig.Spec.ManagementState values: Managed, Unmanaged, Removed, and return an error for unknown states.
Create and use status.NewStatusHandler(c.operatorClient), set the appropriate status condition helpers (HandleProgressingOrDegraded(), HandleDegraded(), HandleProgressing(), HandleAvailable()), and always call FlushAndReturn() at the end of sync.
Group imports with commented sections for standard library, third-party, kube, openshift, and operator/internal packages.
Wrap errors with context using fmt.Errorf("failed to X: %w", err), handle apierrors.IsNotFound() appropriately for delete operations, optional resources, and get-before-create flows, and return meaningful error messages.
Use resourceapply.Apply*() functions from library-go, pass the controller recorder for events, and handle returned errors properly.
Set owner references with util.OwnerRefFrom(cr) from pkg/console/subresource/util, ensure only one owner reference has controller=true, and clean up owner references when replacing existing resources.

Files:

  • pkg/console/controllers/networkpolicy/controller.go
**/*controller.go

📄 CodeRabbit inference engine (.claude/skills/sync-handler-review.md)

**/*controller.go: Controller Sync methods must reconcile dependent resources in dependency order: ConfigMaps and Secrets first, then Service Accounts, RBAC (Roles and RoleBindings), Services, Deployments, and finally Routes.
Status updates must track reconciliation progress accurately by adding progressing/degraded conditions on failures and marking the resource available only after reconciliation completes successfully.
Return immediately on reconciliation errors instead of logging and continuing, to preserve incremental reconciliation behavior.
Use resourceapply.Apply*() helpers for resource creation and updates instead of writing separate create/update logic.
When a resource is removed from the desired config, the controller must delete the corresponding cluster object and treat NotFound as a successful no-op.
Check feature gates before syncing gated resources, and only reconcile the gated resources when the feature is enabled.
Respect ManagementState, including missing cleanup logic for Removed state.
Do not mutate live Kubernetes objects directly; build desired state and apply it through reconciliation helpers.
Always update status conditions during reconciliation; missing status condition updates is an anti-pattern.

Files:

  • pkg/console/controllers/networkpolicy/controller.go
🪛 Trivy (0.72.0)
manifests/03-rbac-role-ns-console.yaml

[error] 80-90: Manage Kubernetes networking

Role 'console-operator' should not have access to resources ["services", "endpoints", "endpointslices", "networkpolicies", "ingresses"] for verbs ["create", "update", "patch", "delete", "deletecollection", "impersonate", "*"]

Rule: KSV-0056

Learn more

(IaC/Kubernetes)

🔇 Additional comments (3)
bindata/assets/networkpolicies/allow-all.yaml (1)

1-14: LGTM!

pkg/api/api.go (1)

59-59: LGTM!

pkg/console/starter/starter.go (1)

35-35: LGTM!

Also applies to: 627-634, 688-688

Comment thread pkg/console/controllers/networkpolicy/controller.go Outdated
Comment thread pkg/console/controllers/networkpolicy/controller.go Outdated
Add a CVO-managed NetworkPolicy that allows all ingress and egress
traffic in the openshift-console namespace. This ensures console pods
have an explicit allow-all policy so that other default-deny policies
do not block console traffic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@spadgett
spadgett force-pushed the console-network-policy branch from d6b33f2 to 2881c50 Compare July 27, 2026 18:12

@wking wking left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

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

openshift-ci Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: spadgett, wking

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

@spadgett

Copy link
Copy Markdown
Member Author

Marking px- and docs-approved for the same reasoning as #1195 (comment)

/label px-approved
/label docs-approved

@openshift-ci openshift-ci Bot added px-approved Signifies that Product Support has signed off on this PR docs-approved Signifies that Docs has signed off on this PR labels Jul 27, 2026
@openshift-ci

openshift-ci Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@spadgett: The following test 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-gcp-ovn 2881c50 link true /test e2e-gcp-ovn

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.

@spadgett

Copy link
Copy Markdown
Member Author

@verified by @spadgett

Console is working. The network policy is there.

Screenshot 2026-07-28 at 2 12 03 PM

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. docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants