Skip to content

[NE-2821] Implement e2e test for TLSAdherence on Gateway API - #31415

Closed
rikatz wants to merge 4 commits into
openshift:mainfrom
rikatz:tls-gateway-config
Closed

[NE-2821] Implement e2e test for TLSAdherence on Gateway API#31415
rikatz wants to merge 4 commits into
openshift:mainfrom
rikatz:tls-gateway-config

Conversation

@rikatz

@rikatz rikatz commented Jul 22, 2026

Copy link
Copy Markdown
Member

Gateway API, implemented via Istio and Sail Library can now respect centralized TLS configuration from OpenShift.

This centralized configuration is implemented and respected with TLSAdherence set as strict.

The current change implements an e2e test for Gateway API when TLSAdherence is available and can be used by admins to also define that Gateways provisioned through OCP Gateway API must respect a specific TLS profile

Marking as draft while openshift/cluster-ingress-operator#1480 is not merged

Summary by CodeRabbit

  • New Features

    • Added end-to-end Gateway API TLS enforcement tests that verify listener behavior over externally provisioned load balancers.
    • Validate accepted/rejected connections against configured minimum and maximum TLS versions, using correct SNI and strict adherence.
    • Expanded TLS reconciliation test coverage to include additional Gateway-based TLS targets when supported.
  • Tests

    • Introduced automated Gateway provisioning with HTTPS TLS listeners and certificate setup.
    • Enhanced polling and target reporting to wait for Gateway programming and external load balancer address readiness.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@openshift-ci

openshift-ci Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 22, 2026
@openshift-ci

openshift-ci Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rikatz
Once this PR has been reviewed and has the lgtm label, please assign gangwgr 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

@coderabbitai

coderabbitai Bot commented Jul 22, 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: Pro Plus

Run ID: dd4c3aaa-02dd-4bae-80cf-5ed4067fba77

📥 Commits

Reviewing files that changed from the base of the PR and between 630cda2 and b34c811.

📒 Files selected for processing (2)
  • test/extended/tls/gateway_tls.go
  • test/extended/tls/tls_observed_config.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/extended/tls/gateway_tls.go
  • test/extended/tls/tls_observed_config.go

Walkthrough

Adds Gateway API LoadBalancer TLS validation with prerequisite checks, resource lifecycle handling, TLS probing, and integration into disruptive API server TLS profile reconciliation.

Changes

Gateway TLS adherence validation

Layer / File(s) Summary
Gateway prerequisites and provisioning
test/extended/tls/gateway_tls.go
Checks feature, platform, and service-network prerequisites; creates or reuses Gateway resources, waits for programming and an external address, and performs best-effort cleanup.
External Gateway TLS probing
test/extended/tls/gateway_tls.go
Connects to the external LoadBalancer address using listener SNI and verifies accepted and rejected TLS configurations.
TLS reconciliation integration
test/extended/tls/tls_observed_config.go
Adds extra TLS targets, conditionally provisions the Gateway target, sets TLS adherence policy, and includes the target in reconciliation and validation.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TLSConfigTest
  participant GatewayAPI
  participant GatewayController
  participant LoadBalancer
  participant gatewayLBTarget
  TLSConfigTest->>GatewayAPI: Create GatewayClass, Secret, and HTTPS Gateway
  GatewayController-->>GatewayAPI: Set Programmed=True
  GatewayAPI->>LoadBalancer: Provision external address
  LoadBalancer-->>TLSConfigTest: Return hostname or IP
  TLSConfigTest->>gatewayLBTarget: Add Gateway TLS target
  gatewayLBTarget->>LoadBalancer: Test accepted and rejected TLS profiles
  LoadBalancer-->>gatewayLBTarget: Return TLS success or failure
Loading

Possibly related PRs

  • openshift/origin#31436: Extends the disruptive TLS reconciliation flow with additional wire-level TLS targets.

Suggested labels: jira/valid-reference

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Ipv6 And Disconnected Network Test Compatibility ⚠️ Warning The new Gateway API TLS test dials an external cloud LoadBalancer and resolves its hostname via DNS, which can fail in disconnected/IPv6 CI. Add a [Skipped:Disconnected] guard or skip on disconnected clusters, and ensure the test uses only cluster-internal endpoints or documented cloud-LB reachability.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: an end-to-end TLSAdherence test for Gateway API.
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 PASS: The changed files use fixed Ginkgo titles only; gateway_tls.go adds no test titles, and none interpolate dynamic values or generated identifiers.
Test Structure And Quality ✅ Passed The new Gateway TLS path has bounded waits, cleanup for created resources, and follows the suite’s existing Ginkgo/exutil patterns.
Microshift Test Compatibility ✅ Passed The Gateway API TLS logic is inside the existing [Serial][Disruptive] TLSObservedConfig Describe, which skips MicroShift in BeforeAll before any It runs.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The new Gateway API TLS check only provisions one Gateway/LB target and uses no node-count, anti-affinity, drain, or failover assumptions; no SNO skip is needed.
Topology-Aware Scheduling Compatibility ✅ Passed Only test-only TLS e2e helpers changed; no manifests/controllers, node selectors, anti-affinity, replica logic, or topology-based scheduling constraints were introduced.
Ote Binary Stdout Contract ✅ Passed No process-level stdout writes found; package search showed no fmt.Print/log/klog/RunSpecs/TestMain/BeforeSuite, and new e2e.Logf calls are inside test setup/It blocks.
No-Weak-Crypto ✅ Passed No MD5/SHA1/DES/RC4/3DES/Blowfish/ECB or custom secret comparisons were added; crypto usage is standard tls/ecdsa with certgen and cipher-suite slice equality only.
Container-Privileges ✅ Passed PR only adds Go e2e TLS helpers and API objects; no privileged/hostNetwork/hostPID/hostIPC/SYS_ADMIN/root settings or K8s manifests were added.
No-Sensitive-Data-In-Logs ✅ Passed New logs only emit resource names, TLS profile info, and LB hostname/IP for test debugging; no passwords, tokens, PII, or secret material found.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/extended/tls/tls_observed_config.go (1)

1296-1313: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Restore APIServer adherence before the test finishes.

When Gateway API TLS validation runs, this test sets APIServer.spec.tlsAdherence = StrictAllComponents but leaves no cleanup path. Since tlsAdherence cannot be unset once set, re-running the same disruptive test or another test that needs a different adherence value on the same cluster can hit a permanent API validation error instead of a retryable 409 conflict. Capture and restore the compliance-affected adherence value, or avoid modifying the immutable field unless absolutely required.

🤖 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 `@test/extended/tls/tls_observed_config.go` around lines 1296 - 1313, Update
the test cleanup around setAPIServerTLSProfile so any tlsAdherence value changed
to StrictAllComponents is captured before modification and restored before the
test completes. Preserve the existing NoOpinion behavior for callers that do not
need adherence changes, and ensure restoration uses the same APIServer update
path with conflict retry.
🧹 Nitpick comments (2)
test/extended/tls/gateway_tls.go (2)

230-256: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low value

Ephemeral test private key isn't explicitly zeroized after use.

privateKey/pemKey hold the private key material for the self-signed test cert and are only released via GC. The crypto-security guideline for files matching *tls* calls for zeroizing key material rather than relying on the garbage collector. Given this is a throwaway, non-sensitive test certificate, the practical risk is minimal, but flagging for guideline compliance.

As per path instructions, "Zeroize key material after use (no garbage-collector reliance)."

🤖 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 `@test/extended/tls/gateway_tls.go` around lines 230 - 256, Explicitly zeroize
the private key material in the certificate-generation flow after it is no
longer needed, including the `privateKey` and any mutable key bytes represented
by `pemKey`, while preserving the existing Secret creation behavior and ensuring
cleanup occurs on error paths as well.

Source: Path instructions


125-134: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

Consider tls.Dialer.DialContext instead of tls.DialWithDialer.

DialWithDialer uses context.Background() internally and only respects the dialer's fixed 10s timeout; it ignores the ctx parameter already passed into testTLS. Switching to (&tls.Dialer{NetDialer: dialer, Config: cfg}).DialContext(ctx, "tcp", hostPort) would let the dial respect the caller's overall test deadline/cancellation in addition to the per-dial timeout.

🤖 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 `@test/extended/tls/gateway_tls.go` around lines 125 - 134, Update testTLS to
use a tls.Dialer configured with the existing dialer and expected TLS
configuration, then call DialContext with the provided ctx, "tcp", and hostPort.
Preserve the existing connection error reporting and close the returned
connection as before.
🤖 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 `@test/extended/tls/tls_observed_config.go`:
- Around line 512-521: Ensure the gatewayFixture returned by
setupGatewayTLSTarget is cleaned up regardless of whether setup succeeds or
returns an error. Register gatewayFixture.cleanup(ctx) immediately after
setupGatewayTLSTarget returns, before branching on err, while preserving the
existing error logging and successful target registration behavior.

---

Outside diff comments:
In `@test/extended/tls/tls_observed_config.go`:
- Around line 1296-1313: Update the test cleanup around setAPIServerTLSProfile
so any tlsAdherence value changed to StrictAllComponents is captured before
modification and restored before the test completes. Preserve the existing
NoOpinion behavior for callers that do not need adherence changes, and ensure
restoration uses the same APIServer update path with conflict retry.

---

Nitpick comments:
In `@test/extended/tls/gateway_tls.go`:
- Around line 230-256: Explicitly zeroize the private key material in the
certificate-generation flow after it is no longer needed, including the
`privateKey` and any mutable key bytes represented by `pemKey`, while preserving
the existing Secret creation behavior and ensuring cleanup occurs on error paths
as well.
- Around line 125-134: Update testTLS to use a tls.Dialer configured with the
existing dialer and expected TLS configuration, then call DialContext with the
provided ctx, "tcp", and hostPort. Preserve the existing connection error
reporting and close the returned connection as before.
🪄 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: 14ea05da-bef0-4fd0-b1f2-52e8ff5ddea2

📥 Commits

Reviewing files that changed from the base of the PR and between c367745 and d8306b4.

📒 Files selected for processing (2)
  • test/extended/tls/gateway_tls.go
  • test/extended/tls/tls_observed_config.go

Comment thread test/extended/tls/tls_observed_config.go
@openshift-ci openshift-ci Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jul 22, 2026
@gcs278

gcs278 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

/test ?

@rikatz

rikatz commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

/testwith openshift/origin/main/e2e-gcp-ovn-techpreview-serial-1of2 openshift/cluster-ingress-operator#1480

@rikatz

rikatz commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

/testwith openshift/origin/main/e2e-gcp-ovn-techpreview-serial-2of2 openshift/cluster-ingress-operator#1480

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@rikatz, testwith: could not generate prow job. ERROR:

BUG: test 'e2e-gcp-ovn-techpreview-serial-2of2' not found in injected config

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@rikatz, testwith: could not generate prow job. ERROR:

BUG: test 'e2e-gcp-ovn-techpreview-serial-1of2' not found in injected config

@rikatz

rikatz commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

/testwith e2e-gcp-ovn-techpreview-serial-1of2 openshift/cluster-ingress-operator#1480

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@rikatz, testwith: Error processing request. ERROR:

could not determine job runs: requested job is invalid. needs to be formatted like: <org>/<repo>/<branch>/<variant?>/<job>. instead it was: e2e-gcp-ovn-techpreview-serial-1of2

@rikatz

rikatz commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

/testwith openshift/origin/main/e2e-gcp-ovn-techpreview-serial-1of2 openshift/cluster-ingress-operator#1480

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@rikatz, testwith: could not generate prow job. ERROR:

BUG: test 'e2e-gcp-ovn-techpreview-serial-1of2' not found in injected config

@gcs278

gcs278 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

/testwith openshift/origin/main/e2e-gcp-ovn-techpreview-serial-1of2 openshift/cluster-ingress-operator#1480

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@gcs278, testwith: could not generate prow job. ERROR:

BUG: test 'e2e-gcp-ovn-techpreview-serial-1of2' not found in injected config

@gcs278

gcs278 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

/testwith openshift/origin/main/e2e-gcp-ovn openshift/api#2883 openshift/cluster-ingress-operator#1480

@gcs278

gcs278 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

/testwith openshift/origin/main/e2e-aws-ovn-serial-1of2 openshift/api#2883 openshift/cluster-ingress-operator#1480

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@gcs278, testwith: could not generate prow job. ERROR:

BUG: test 'e2e-aws-ovn-serial-1of2' not found in injected config

@gcs278

gcs278 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

/testwith openshift/origin/main/e2e-aws-ovn-serial-2of2 openshift/api#2883 openshift/cluster-ingress-operator#1480

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@gcs278, testwith: could not generate prow job. ERROR:

BUG: test 'e2e-aws-ovn-serial-2of2' not found in injected config

@gcs278

gcs278 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

/testwith openshift/origin/main/e2e-gcp-ovn-techpreview-serial openshift/cluster-ingress-operator#1480

@rikatz

rikatz commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

/test e2e-aws-tls-observed-config

@rikatz

rikatz commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

/test periodic-ci-openshift-tls-scanner-main-periodic-tls13-conformance

@openshift-ci

openshift-ci Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@rikatz: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

/test agentic-images
/test e2e-aws-csi
/test e2e-aws-jenkins
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-image-registry
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-builds
/test e2e-gcp-ovn-image-ecosystem
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi
/test go-verify-deps
/test images
/test lint
/test okd-scos-images
/test unit
/test verify
/test verify-deps
/test verify-image-manifest-lists

The following commands are available to trigger optional jobs:

/test e2e-agent-compact-ipv4-iso-no-registry
/test e2e-agnostic-ovn-cmd
/test e2e-aws-disruptive
/test e2e-aws-etcd-certrotation
/test e2e-aws-etcd-recovery
/test e2e-aws-ovn
/test e2e-aws-ovn-cgroupsv2
/test e2e-aws-ovn-dra-example
/test e2e-aws-ovn-edge-zones
/test e2e-aws-ovn-etcd-scaling
/test e2e-aws-ovn-kube-apiserver-rollout
/test e2e-aws-ovn-kubevirt
/test e2e-aws-ovn-serial-fast
/test e2e-aws-ovn-serial-ipsec
/test e2e-aws-ovn-serial-publicnet-1of2
/test e2e-aws-ovn-serial-publicnet-2of2
/test e2e-aws-ovn-single-node
/test e2e-aws-ovn-single-node-serial
/test e2e-aws-ovn-single-node-techpreview
/test e2e-aws-ovn-single-node-techpreview-serial
/test e2e-aws-ovn-single-node-upgrade
/test e2e-aws-ovn-upgrade
/test e2e-aws-ovn-upgrade-rollback
/test e2e-aws-ovn-upi
/test e2e-aws-proxy
/test e2e-aws-tls-observed-config
/test e2e-aws-tls-observed-config-fips
/test e2e-aws-tls-observed-config-hypershift
/test e2e-azure
/test e2e-azure-ovn-etcd-scaling
/test e2e-azure-ovn-upgrade
/test e2e-baremetalds-kubevirt
/test e2e-external-aws
/test e2e-external-aws-ccm
/test e2e-external-vsphere-ccm
/test e2e-gcp-disruptive
/test e2e-gcp-fips-serial-1of2
/test e2e-gcp-fips-serial-2of2
/test e2e-gcp-ovn-etcd-scaling
/test e2e-gcp-ovn-kube-apiserver-rollout
/test e2e-gcp-ovn-rt-upgrade
/test e2e-gcp-ovn-techpreview
/test e2e-gcp-ovn-techpreview-pkiconfig
/test e2e-gcp-ovn-techpreview-serial-1of2
/test e2e-gcp-ovn-techpreview-serial-2of2
/test e2e-gcp-ovn-usernamespace
/test e2e-hypershift-conformance
/test e2e-metal-ipi-ovn
/test e2e-metal-ipi-ovn-bgp-virt-dualstack
/test e2e-metal-ipi-ovn-bgp-virt-dualstack-techpreview
/test e2e-metal-ipi-ovn-dualstack
/test e2e-metal-ipi-ovn-dualstack-bgp
/test e2e-metal-ipi-ovn-dualstack-bgp-local-gw
/test e2e-metal-ipi-ovn-dualstack-local-gateway
/test e2e-metal-ipi-ovn-kube-apiserver-rollout
/test e2e-metal-ipi-serial-1of2
/test e2e-metal-ipi-serial-2of2
/test e2e-metal-ipi-serial-ovn-ipv6-1of2
/test e2e-metal-ipi-serial-ovn-ipv6-2of2
/test e2e-metal-ipi-virtualmedia
/test e2e-metal-ovn-single-node-live-iso
/test e2e-metal-ovn-single-node-with-worker-live-iso
/test e2e-metal-ovn-two-node-arbiter
/test e2e-metal-ovn-two-node-fencing
/test e2e-metal-ovn-two-node-fencing-recovery
/test e2e-openstack-dualstack-v6primary
/test e2e-openstack-ovn
/test e2e-openstack-serial
/test e2e-vsphere-ovn-etcd-scaling
/test okd-scos-e2e-aws-ovn

Use /test all to run the following jobs that were automatically triggered:

pull-ci-openshift-origin-main-agentic-images
pull-ci-openshift-origin-main-go-verify-deps
pull-ci-openshift-origin-main-images
pull-ci-openshift-origin-main-lint
pull-ci-openshift-origin-main-okd-scos-images
pull-ci-openshift-origin-main-unit
pull-ci-openshift-origin-main-verify
pull-ci-openshift-origin-main-verify-deps
Details

In response to this:

/test periodic-ci-openshift-tls-scanner-main-periodic-tls13-conformance

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.

@rikatz

rikatz commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

/testwith openshift/origin/main/e2e-aws-tls-observed-config openshift/cluster-ingress-operator#1480

@openshift-ci

openshift-ci Bot commented Jul 24, 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-aws-tls-observed-config 42baf75 link false /test e2e-aws-tls-observed-config

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 Jul 24, 2026

Copy link
Copy Markdown
Member Author

/testwith openshift/origin/main/e2e-aws-tls-observed-config openshift/cluster-ingress-operator#1480

@rikatz

rikatz commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

/testwith openshift/origin/main/e2e-aws-tls-observed-config openshift/cluster-ingress-operator#1480,openshift/api#2883

@rikatz

rikatz commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

/testwith openshift/origin/main/e2e-aws-tls-observed-config openshift/cluster-ingress-operator#1480 openshift/api#2883

rikatz added 3 commits July 27, 2026 19:20
Gateway API, implemented via Istio and Sail Library can now respect centralized
TLS configuration from OpenShift.

This centralized configuration is implemented and respected with TLSAdherence
set as strict.

The current change implements an e2e test for Gateway API when TLSAdherence is available
and can be used by admins to also define that Gateways provisioned through OCP Gateway API
must respect a specific TLS profile
@rikatz
rikatz force-pushed the tls-gateway-config branch from 42baf75 to 48acc8a Compare July 27, 2026 22:20
@rikatz

rikatz commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

/testwith openshift/origin/main/e2e-aws-tls-observed-config openshift/cluster-ingress-operator#1480 openshift/api#2883

@redhat-chai-bot

Copy link
Copy Markdown
Contributor

Code Review — Gateway API TLS Adherence e2e Test

Reviewed the full diff across both files. Well-structured test code with good documentation, proper cleanup patterns, and thoughtful platform/feature-gate gating. A few findings below.


🔴 Critical — TLS version floor mismatch (likely root cause of CI failure)

The gatewayLBTarget uses the same targetTLSConfig as all other operator targets in waitForTLSReconciliation. When StrictAllComponents is set, the Gateway API endpoint enforces a TLS 1.3 floor. However, generateDifferentTLSProfile produces a target with minTLSVersion=VersionTLS11, and the expected.tlsShouldWork TLS config is built around that lower version.

The problem: With Strict enforcement, the Gateway endpoint rejects TLS 1.1/1.2 connections — so expected.tlsShouldWork fails on the Gateway target even though it should succeed for TLS 1.3+.

Fix: The gatewayLBTarget needs a Gateway-specific tlsConfig that accounts for the Strict Component TLS 1.3 floor:

  • tlsShouldWork.MinVersion = tls.VersionTLS13
  • tlsShouldNotWork.MaxVersion = tls.VersionTLS12

Consider adding a gatewayExpectedTLSConfig that overrides the cluster-wide expectation for the Gateway target, or have testTLS accept an optional override.

Relevant code:

// tls_observed_config.go — same config for all targets including Gateway:
waitErr := waitForTLSReconciliation(oc, configChangeCtx, false, targetsWithGateway, targetTLSConfig)

// gateway_tls.go — testTLS uses whatever it's given, no Strict floor awareness:
shouldWorkDialer := &tls.Dialer{NetDialer: netDialer, Config: expected.tlsShouldWork}

🟠 Medium — Not IPv6-safe address formatting

gateway_tls.go:133:

hostPort := fmt.Sprintf("%s:%s", t.address, t.port)

If the LB publishes an IPv6 address, this produces ::1:443 instead of [::1]:443. Use net.JoinHostPort(t.address, t.port). The test currently skips IPv6, but JoinHostPort is still the right practice and would allow removing that skip later.


🟠 Medium — Fragile Service naming convention

gateway_tls.go:314:

serviceName := createdGateway.Name + "-" + gatewayClassName

This assumes the ingress controller names the per-Gateway LB Service as <gateway-name>-<gatewayclass-name>. If that convention changes in the operator, the test silently times out. Consider discovering the Service via a label selector (e.g. gateway.networking.k8s.io/gateway-name=<name>) or by reading the Gateway's .status.addresses directly for resilience.


🟠 Medium — Immutable tlsAdherence not restored

The doc comment correctly notes tlsAdherence is immutable once set. Running this test permanently sets StrictAllComponents on the cluster with no restore path. If CI always uses ephemeral clusters for this [Disruptive] suite, add a comment documenting that assumption. Otherwise, check whether adherence is already set before attempting to set it.


🟡 Low — Self-signed cert and InsecureSkipVerify

The Gateway uses a self-signed certificate from certgen.GenerateKeyPair. Verify that the shared tlsConfig used in testTLS has InsecureSkipVerify: true — otherwise the TLS handshake fails on certificate verification before TLS version negotiation is even tested, masking the actual version enforcement check.


✅ Good patterns

  • Cleanup before error checkdefer gatewayFixture.cleanup(ctx) registered before branching on error prevents cloud LB leaks on partial failures.
  • Key zeroizationprivateKey.D.SetInt64(0) in a defer is good hygiene even for test certs.
  • GatewayClass reuseensureGatewayClass reuses existing GatewayClasses instead of always creating.
  • GenerateName — Used throughout to prevent name collisions across concurrent runs.
  • DNS resolution waitwaitForLoadBalancerAddress correctly waits for hostname DNS resolution on AWS.

Review posted via Chai Bot on behalf of a reviewer.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Note

The previously reviewed commits are no longer reachable (likely due to a force-push or rebase), so CodeRabbit is performing a full review instead of an incremental one. This review may take a little longer.

// unset. This suite is [Disruptive] and runs on ephemeral CI
// clusters, so permanently setting StrictAllComponents for the
// Gateway wire-level check is acceptable.
adherence = configv1.TLSAdherencePolicyStrictAllComponents

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't know if this is doable and will not break other things.

@rikatz

rikatz commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

/testwith openshift/origin/main/e2e-aws-tls-observed-config openshift/cluster-ingress-operator#1480 openshift/api#2883

1 similar comment
@rikatz

rikatz commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

/testwith openshift/origin/main/e2e-aws-tls-observed-config openshift/cluster-ingress-operator#1480 openshift/api#2883

@rikatz

rikatz commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

/close

this is not the rightplace to add it, suggestion is to make this change as part of CIO tls-scanner

@openshift-ci openshift-ci Bot closed this Jul 28, 2026
@openshift-ci

openshift-ci Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@rikatz: Closed this PR.

Details

In response to this:

/close

this is not the rightplace to add it, suggestion is to make this change as part of CIO tls-scanner

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/work-in-progress Indicates that a PR should not merge because it is a work in progress. ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants