Skip to content

OCPBUGS-87204: Enable endpoint validation when hostNetwork is used on cloud providers#1464

Closed
rikatz wants to merge 1 commit into
openshift:masterfrom
rikatz:ocpbugs-86729
Closed

OCPBUGS-87204: Enable endpoint validation when hostNetwork is used on cloud providers#1464
rikatz wants to merge 1 commit into
openshift:masterfrom
rikatz:ocpbugs-86729

Conversation

@rikatz

@rikatz rikatz commented Jun 8, 2026

Copy link
Copy Markdown
Member

When a custom ingress controller is deployed, and it is intentionally using hostNetwork, some extra validations must be added so a user doesn't use the router to bypass network restrictions.

This change makes CIO enforce the new endpoint-address-validation flag on custom ingress controllers deployed on cloud environments.

This PR is related with openshift/router#788 and should be merged after it

@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. labels Jun 8, 2026
@coderabbitai

coderabbitai Bot commented Jun 8, 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: 0f6cdf2e-ffe4-4faa-906f-22576ad5f972

📥 Commits

Reviewing files that changed from the base of the PR and between 6cc4a70 and 3ab8f48.

📒 Files selected for processing (4)
  • pkg/operator/controller/ingress/deployment.go
  • pkg/operator/controller/ingress/deployment_test.go
  • test/e2e/all_test.go
  • test/e2e/operator_test.go
✅ Files skipped from review due to trivial changes (1)
  • test/e2e/all_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/operator/controller/ingress/deployment.go
  • test/e2e/operator_test.go

📝 Walkthrough

Walkthrough

This PR adds the exported ENDPOINT_ADDRESS_VALIDATION environment variable and, in desiredRouterDeployment, sets it to "true" for non-default ingress controllers using HostNetwork on specific cloud platforms (AWS, Azure, GCP, AlibabaCloud, IBMCloud, PowerVS, OpenStack). Unit tests cover expected presence/absence, env var sorting, and deploymentConfigChanged detection. An e2e test creates a host-network ingresscontroller, verifies the router Deployment gets ENDPOINT_ADDRESS_VALIDATION="true", and verifies the default router does not.


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 3 warnings)

Check name Status Explanation Resolution
Ote Binary Stdout Contract ❌ Error The new test/e2e/operator_test.go file contains TestMain() with 5 fmt.Printf() calls writing to stdout, violating OTE Binary Stdout Contract for process-level code. Replace fmt.Printf calls in TestMain() with fmt.Fprintf(os.Stderr, ...) or use a configured logger that writes to stderr.
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Microshift Test Compatibility ⚠️ Warning Test uses config.openshift.io/v1 APIs (Infrastructure, DNS) and operator.openshift.io/v1 which aren't available on MicroShift, with no protection mechanism. Add [apigroup:config.openshift.io] tag to test name or implement IsMicroShiftCluster() check with g.Skip().
Single Node Openshift (Sno) Test Compatibility ⚠️ Warning Test TestHostNetworkEndpointAddressValidation lacks SNO protection: no [Skipped:SingleReplicaTopology] label, no exutil.IsSingleNode() check, or topology mode detection for SNO compatibility. Add [Skipped:SingleReplicaTopology] label to test name or guard with if exutil.IsSingleNode(...) { g.Skip(...) } check in test body.
✅ Passed checks (11 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main change: enabling endpoint validation when hostNetwork is used on cloud providers.
Description check ✅ Passed The description clearly relates to the changeset, explaining the motivation (prevent router from bypassing network restrictions) and implementation scope (enforce endpoint-address-validation flag for custom ingress controllers on cloud environments).
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 Test names are stable: table-driven tests use static case names, e2e test function name is static. No dynamic generation, timestamps, or UUIDs in test titles.
Test Structure And Quality ✅ Passed Tests added are standard Go tests (testing.T), not Ginkgo tests. Custom check explicitly targets Ginkgo code patterns (Describe/It/BeforeEach), which are not present here.
Topology-Aware Scheduling Compatibility ✅ Passed PR adds an environment variable for endpoint validation; no scheduling constraints, affinity rules, nodeSelectors, TopologySpreadConstraints, tolerations, or PodDisruptionBudgets are modified.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed TestHostNetworkEndpointAddressValidation has no IPv4 hardcoded addresses, IPv4 localhost, external connectivity, or network calls. All operations use cluster-internal resources only.
No-Weak-Crypto ✅ Passed No weak crypto (MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB), custom crypto, or non-constant-time secret comparisons detected in PR changes.
Container-Privileges ✅ Passed PR adds only an environment variable ENDPOINT_ADDRESS_VALIDATION for endpoint validation on cloud platforms. No privileged flags, capabilities, or privilege escalation settings are introduced.
No-Sensitive-Data-In-Logs ✅ Passed No sensitive data logging detected. The new ENDPOINT_ADDRESS_VALIDATION env var uses non-sensitive values ("true"), and error messages only log the env var name and generic timeout errors.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

Command failed


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci-robot openshift-ci-robot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Jun 8, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@rikatz: This pull request references Jira Issue OCPBUGS-87204, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

When a custom ingress controller is deployed, and it is intentionally using hostNetwork, some extra validations must be added so a user doesn't use the router to bypass network restrictions.

This change makes CIO enforce the new endpoint-address-validation flag on custom ingress controllers deployed on cloud environments.

This PR is related with openshift/router#788 and should be merged after it

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.

@openshift-ci openshift-ci Bot requested review from frobware and knobunc June 8, 2026 14:25
@openshift-ci

openshift-ci Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign candita for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

… cloud providers

When a custom ingress controller is deployed, and it is intentionally using hostNetwork, some extra validations
must be added so a user doesn't use the router to bypass network restrictions.

This change makes CIO enforce the new endpoint-address-validation flag on custom ingress controllers
deployed on cloud environments.
@rikatz

rikatz commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

/payload-job-with-prs prow/e2e-aws-operator openshift/router#788 #1464

@openshift-ci

openshift-ci Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

@rikatz: it appears that you have attempted to use some version of the payload command, but your comment was incorrectly formatted and cannot be acted upon. See the docs for usage info.

@rikatz

rikatz commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

/payload-job-with-prs prow/e2e-aws-operator openshift/router#788 #1464

@openshift-ci

openshift-ci Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

@rikatz: it appears that you have attempted to use some version of the payload command, but your comment was incorrectly formatted and cannot be acted upon. See the docs for usage info.

@openshift-ci

openshift-ci Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

@rikatz: 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-azure-operator 3ab8f48 link true /test e2e-azure-operator

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.

@rikatz

rikatz commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

/hold

This should not be merged, if we decide to go with the current approach of openshift/router#788 (no flag anymore, validate any fqdn endpoint)

@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 10, 2026
@rikatz

rikatz commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

I am closing this, given the approach will be directly on router to filter invalid IPs
/close

@openshift-ci openshift-ci Bot closed this Jul 1, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@rikatz: This pull request references Jira Issue OCPBUGS-87204. The bug has been updated to no longer refer to the pull request using the external bug tracker.

Details

In response to this:

When a custom ingress controller is deployed, and it is intentionally using hostNetwork, some extra validations must be added so a user doesn't use the router to bypass network restrictions.

This change makes CIO enforce the new endpoint-address-validation flag on custom ingress controllers deployed on cloud environments.

This PR is related with openshift/router#788 and should be merged after it

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.

@openshift-ci

openshift-ci Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@rikatz: Closed this PR.

Details

In response to this:

I am closing this, given the approach will be directly on router to filter invalid IPs
/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants