OCPBUGS-114728: [release-5.0] [CORENET-7243](https://redhat.atlassian.net/browse/CORENET-7243): Add TLS profile compliance e2e tests for ingress-node-firewall - #783
Conversation
|
@openshift-cherrypick-robot: Ignoring requests to cherry-pick non-bug issues: CORENET-7243 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Implements comprehensive TLS compliance testing to verify that ingress-node-firewall-daemon adheres to OpenShift cluster-wide TLS security profiles (Intermediate, Modern) with different adherence policies (LegacyAdheringComponentsOnly, StrictAllComponents). Changes: - Add new test/e2e/tls/tls.go package with TLS compliance utilities: * ConfigureTLSProfileWithAdherence() - Configure cluster TLS profile * VerifyIngressNodeFirewallTLSComplianceInPod() - Verify daemon TLS compliance * TLS cipher suite validation against expected profiles * Machine Config Pool rollout monitoring * Feature gate management for TLSAdherence API - Add TLS Profile Compliance test suite in test/e2e/functional/tests/e2e.go: * Test Intermediate profile with LegacyAdheringComponentsOnly * Test Modern profile with LegacyAdheringComponentsOnly * Test Modern profile with StrictAllComponents * Auto-skip on non-OpenShift clusters or unsupported API versions - Update dependencies: * Add github.com/openshift/client-go for config API access * Update vendor with config v1alpha1, v1alpha2, and machineconfiguration APIs * Update go.mod and go.sum - Update environment configuration for daemon TLS settings Test Results: All 3 TLS compliance tests passed successfully: ✓ Intermediate TLS Profile with LegacyAdheringComponentsOnly ✓ Modern TLS Profile with LegacyAdheringComponentsOnly ✓ Modern TLS Profile with StrictAllComponents Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Implements comprehensive TLS compliance testing to verify that ingress-node-firewall-daemon adheres to OpenShift cluster-wide TLS security profiles (Intermediate, Modern) with different adherence policies (LegacyAdheringComponentsOnly, StrictAllComponents). Changes: - Add new test/e2e/tls/tls.go package with TLS compliance utilities: * ConfigureTLSProfileWithAdherence() - Configure cluster TLS profile * VerifyIngressNodeFirewallTLSComplianceInPod() - Verify daemon TLS compliance * TLS cipher suite validation against expected profiles * Machine Config Pool rollout monitoring * Feature gate management for TLSAdherence API * Refactored to use untyped controller-runtime client (no client-go dependency) - Add TLS Profile Compliance test suite in test/e2e/functional/tests/e2e.go: * Test Intermediate profile with LegacyAdheringComponentsOnly * Test Modern profile with LegacyAdheringComponentsOnly * Test Modern profile with StrictAllComponents * Auto-skip on non-OpenShift clusters or unsupported API versions - Update test/e2e/client/client.go: * Add OpenShift config v1 and machineconfiguration v1 to controller-runtime scheme * Enables untyped client access to OpenShift-specific APIs - Update dependencies: * Uses only github.com/openshift/api (no client-go dependency) * Removed 521 vendor files (~55,000 lines of unused code) * Update go.mod and go.sum - Update Makefile to increase test timeout to 90m (TLS tests require ~42m for MCP rollouts) Technical Implementation: - Uses controller-runtime's untyped client.Client for all Kubernetes API access - Avoids github.com/openshift/client-go dependency by using controller-runtime patterns - All OpenShift config resources accessed via controller-runtime client with proper scheme registration Test Results: All 3 TLS compliance tests passed successfully: ✓ Intermediate TLS Profile with LegacyAdheringComponentsOnly ✓ Modern TLS Profile with LegacyAdheringComponentsOnly ✓ Modern TLS Profile with StrictAllComponents Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit adds comprehensive end-to-end tests to validate TLS profile
compliance for the ingress-node-firewall daemon's kube-rbac-proxy endpoint.
Changes:
- Add test/e2e/tls/tls.go with TLS compliance testing utilities (795 lines)
* ConfigureTLSProfileWithAdherence: Configures cluster TLS profile
* VerifyIngressNodeFirewallTLSComplianceInPod: Validates TLS behavior
* Waits for MachineConfigPool rollouts and cluster stabilization
* Handles transient connection issues with retry logic
- Add TLS Profile Compliance test context to test/e2e/functional/tests/e2e.go
* Tests 3 profile/adherence combinations:
- Intermediate + LegacyAdheringComponentsOnly (TLS 1.2 & 1.3 work)
- Modern + LegacyAdheringComponentsOnly (TLS 1.2 & 1.3 work)
- Modern + StrictAllComponents (TLS 1.3 only, 1.2 rejected)
Test Implementation:
- Uses OpenShift TLSAdherence feature gate and APIServer configuration
- Verifies actual TLS protocol behavior via curl in pod exec
- Properly waits for cluster components (MCPs, operators, nodes) to stabilize
- Follows e2e golden rules (self-contained, no downstream references)
Code Quality:
- Modern Kubernetes 1.21+ APIs (wait.PollUntilContextTimeout)
- Uses standard utilities (podutil.IsPodReady)
- Zero dead code, zero duplications
- Proper error handling with context-aware operations
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit addresses all 6 CodeRabbit review comments to improve code quality, prevent bugs, and ensure correct test behavior. Fixes: 1. Increase functional test timeout from 90m to 180m - Aligns timeout with TLS test worst-case timing (60m waits in sequence) - Prevents go test SIGKILL that would lose JUnit reports - Addresses comment #3754883537 2. Fix namespace hardcoding bug - Remove hardcoded OpenShiftNameSpace constant - Use dynamic OperatorNameSpace variable (respects OO_INSTALL_NAMESPACE) - Fixes TLS test to work in all environments (CI, local dev, custom namespaces) - Addresses comment #3754883539 3. Document cluster state mutations - Add warning about FeatureGate.Spec.FeatureSet -> CustomNoUpgrade (irreversible) - Document APIServer TLS profile changes not being restored - Explain why restoration not implemented (ephemeral cluster, expensive, irreversible) - Warn local developers about permanent cluster modifications - Addresses comment #3754883543 4. Add nil pointer checks for TLSSecurityProfile - Guard determineTLSTestBehavior against nil TLSSecurityProfile - Guard log statement in VerifyIngressNodeFirewallTLSComplianceInPod - Prevents panics, makes exported functions defensive - Consistent with verifyAPIServerTLSProfile which already has nil check - Addresses comment #3754883546 5. Fix error wrapping in execCommandInPodWithRetry - Rename err -> findErr for clarity - Wrap pollErr (timeout error) instead of closure-scoped findErr - Fixes misleading error messages like "failed to find ready pod: %!w(<nil>)" - Proper Go error wrapping idiom with full context - Addresses comment #3754883566 6. Fix critical error discard bug in testTLS12Connection - Check error in TLS 1.2 rejection test instead of discarding with _ - Distinguish infrastructure failure (exec didn't run) from TLS rejection - Prevents FALSE POSITIVES where strictest assertion passes without testing - Modern + StrictAllComponents test can now properly fail if pod exec fails - Addresses comment #3754883574 Impact: - 4 bugs fixed (namespace, nil pointer, error wrapping, error discard) - 1 critical fix preventing false positives in most important assertion - 1 defensive improvement (timeout alignment) - 1 documentation enhancement (cluster state warning) All changes verified to compile successfully. Co-Authored-By: CodeRabbit AI <noreply@coderabbit.ai>
This commit addresses all review feedback from PR openshift#766: 1. Combine wasteful test setup (tpantelis) - Merge 3 separate It specs into single It spec - Reduces test time by ~2-4 hours (avoids redundant MCP rollouts) 2. Use configv1 typed constants (tpantelis) - Replace string literals with configv1.TLSProfileType - Replace string literals with configv1.TLSAdherencePolicy - Update all function signatures and comparisons 3. Fix pod readiness check (tpantelis) - Use podutil.IsPodReady() instead of only checking Phase==Running - Prevents race conditions by ensuring pod is actually ready 4. Simplify node readiness check (tpantelis) - Use slices.ContainsFunc() for cleaner code 5. Fix step numbering (tpantelis) - Renumber steps to start from 1 instead of 2 6. Use errors.As() for error type checking (tpantelis) - Replace type assertion with errors.As() - Future-proof for wrapped errors 7. Rename variable for clarity (tpantelis) - Rename featureGateEnabled to alreadyEnabled 8. Add [OCPFeatureGate:TLSAdherence][Serial] tags (CodeRabbit) - Ensures tests run on dedicated, disposable CI infrastructure - Update documentation to match openshift/origin#31500 pattern Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
TLS Test Changes: - Reorder TLS profile test cases for better coverage - Replace Intermediate+LegacyAdheringComponentsOnly with Intermediate+StrictAllComponents - Update MCP rollout logic to handle Intermediate profile with StrictAllComponents - New test order: Modern+Legacy, Modern+Strict, Intermediate+Strict Build Changes: - Bump Golang version from 1.25 to 1.26 in Dockerfiles Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit fixes three critical issues in the TLS profile compliance
e2e tests that caused failures when testing TLS 1.2 rejection:
1. Remove exit code 35 from transient error list
- Exit code 35 is an SSL protocol error (handshake failure), not
an infrastructure/network issue
- When testing TLS 1.2 rejection, this is the expected behavior
- Previously caused 3 retries with empty output and test failure
2. Add RestartDaemonPods() function
- Ensures kube-rbac-proxy containers pick up new TLS configuration
- Deletes old daemon pods and waits for new pods with different UIDs
- Critical for testing multiple TLS profiles in sequence
- Without this, pods retain previous TLS settings
3. Enhance TLS 1.2 rejection test logic
- Properly handle SSL errors when expecting connection rejection
- Check for SSL/alert messages in curl verbose output
- Return success when TLS handshake fails as expected
- Only fail if connection succeeds when it should be rejected
Test Results:
- Modern + LegacyAdheringComponentsOnly: PASS (TLS 1.2 & 1.3 work)
- Modern + StrictAllComponents: PASS (TLS 1.3 only, 1.2 rejected)
- Intermediate + StrictAllComponents: PASS (TLS 1.2 & 1.3 work)
Signed-off-by: Wei Liang <weliang@redhat.com>
Fix two test reliability issues in TLS 1.2 rejection verification: 1. Recognize exit codes 35/60 as valid TLS rejection When TLS 1.2 is correctly rejected by StrictAllComponents policy, curl exits with code 35 (SSL handshake failure). The test previously required non-empty output to recognize this as success, causing false failures when curl produced minimal output. 2. Add 30-second propagation delay after pod restart After restarting daemon pods, the new TLS configuration needs time to propagate to kube-rbac-proxy before testing can proceed reliably. Tested with all three profile combinations: - Modern + LegacyAdheringComponentsOnly: TLS 1.2/1.3 both allowed - Modern + StrictAllComponents: TLS 1.3 only, TLS 1.2 rejected - Intermediate + StrictAllComponents: TLS 1.2/1.3 both allowed Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The 30-second wait was insufficient when transitioning between StrictAllComponents profiles (e.g., Modern→Intermediate). The daemon pods' kube-rbac-proxy containers need more time to pick up the new TLS configuration in strict mode. Fixes test failure in Intermediate + StrictAllComponents test case where TLS 1.2 was incorrectly rejected due to residual Modern profile enforcement. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ness Replace the fixed 60-second sleep with an intelligent polling mechanism that waits for TLS configuration to actually propagate to restarted pods. Changes: - Add waitForTLSConfigurationReady() that polls every 5 seconds - Tests TLS 1.3 connection (supported by all profiles) to verify readiness - Timeout after 2 minutes if configuration doesn't propagate - Returns immediately once TLS is ready (no unnecessary waiting) Benefits: - More robust: verifies actual configuration state vs. arbitrary delay - More efficient: waits only as long as needed (typically 10-30 seconds) - Better error handling: explicit timeout with clear error message Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add -timeout 180m to go test commands in openshift-ci/run_e2e.sh to prevent test timeout failures. The TLS compliance tests require extended time for MachineConfigPool rollouts (up to 60 minutes), node stability checks (60 minutes), and operator settling (60 minutes), totaling ~130-140 minutes in worst case. The Makefile was already updated with this timeout in commit 7bb5452, but the CI script bypassed it and used Go's default 10-minute timeout, causing: panic: test timed out after 10m0s This fix aligns the CI script timeout with the Makefile configuration. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
ca9e3f2 to
6af7eba
Compare
|
RCA ingress-node-firewall-e2e-metal-ipi failed on release-5.0 CI with 2 e2e failures after successful operator deploy (DaemonSet 3/3). TLS Profile Compliance — After Modern+StrictAllComponents → Intermediate+StrictAllComponents, daemon metrics on :9301 still reject TLS 1.2 (curl exit 35). Operator did not propagate relaxed --metrics-tls-min-version=VersionTLS12 before the test asserted. waitForTLSConfigurationReady only checks TLS 1.3, causing a false ready signal. Statistics/Endpoints — Cascading timing failure: Endpoints test ran 1s after TLS test recycled all daemon pods; 10s poll timed out. Metrics test passed afterward. |
|
/test ingress-node-firewall-e2e-metal-ipi |
|
@danwinship It would be OK to override job to get this merged so that I can cherry pick latest commit from PR 771, it also fixed failed test. |
|
/test ingress-node-firewall-e2e-metal-ipi |
|
@weliang1 sorry, I screwed this up with the 5.1 commit, but in the future, PRs should be squashed into a reasonable number of commits where each commit represents a single coherent change. There should not be buggy commits followed by fixes for those commits. |
|
/approve |
|
/label backport-risk-assessed |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danwinship, openshift-cherrypick-robot, raphaelvrosa The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@openshift-ci-robot: once the present PR merges, I will cherry-pick it on top of DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retitle [release-5.0] OCPBUGS-114727 CORENET-7243: Add TLS profile compliance e2e tests for ingress-node-firewall |
|
@openshift-cherrypick-robot: This pull request references Jira Issue OCPBUGS-114727, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. This pull request references CORENET-7243 which is a valid jira issue. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/retitle [release-5.0] OCPBUGS-114728 CORENET-7243: Add TLS profile compliance e2e tests for ingress-node-firewall |
|
@openshift-cherrypick-robot: No Jira issue is referenced in the title of this pull request. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
@asood-rh: No Jira issue is referenced in the title of this pull request. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/retitle OCPBUGS-114728 [release-5.0] CORENET-7243: Add TLS profile compliance e2e tests for ingress-node-firewall |
|
/jira refresh |
|
@asood-rh: No Jira issue is referenced in the title of this pull request. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/retitle OCPBUGS-114728: [release-5.0] CORENET-7243: Add TLS profile compliance e2e tests for ingress-node-firewall |
|
@openshift-cherrypick-robot: This pull request references Jira Issue OCPBUGS-114728, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
@asood-rh: This pull request references Jira Issue OCPBUGS-114728, which is invalid:
Comment DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
@asood-rh: This pull request references Jira Issue OCPBUGS-114728, which is valid. The bug has been moved to the POST state. 7 validation(s) were run on this bug
No GitHub users were found matching the public email listed for the QA contact in Jira (core-networking-bot@redhat.com), skipping review request. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
15cbf38
into
openshift:release-5.0
|
@openshift-cherrypick-robot: Jira Issue OCPBUGS-114728: All pull requests linked via external trackers have merged: All linked pull requests have the DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@openshift-ci-robot: cannot checkout DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
This is an automated cherry-pick of #766
/assign asood-rh