Skip to content

CM-1043: add IstioCSR P0 e2e coverage and OpenShift Service Mesh smoke tests#427

Open
arun717 wants to merge 16 commits into
openshift:masterfrom
arun717:istio-csr-add-e2e
Open

CM-1043: add IstioCSR P0 e2e coverage and OpenShift Service Mesh smoke tests#427
arun717 wants to merge 16 commits into
openshift:masterfrom
arun717:istio-csr-add-e2e

Conversation

@arun717

@arun717 arun717 commented May 29, 2026

Copy link
Copy Markdown
Contributor

Adds end-to-end coverage for IstioCSR reconciler and operand behavior that was not covered by existing istio_csr_test.go specs, plus two opt-in OpenShift Service Mesh (OSM) smoke tests.

New file test/e2e/istio_csr_p0_test.go introduces 12 P0 scenarios under Feature:IstioCSR / Platform:Generic, covering:

  • CR validation (singleton name, multi-instance rejection)
  • Issuer paths (ClusterIssuer happy path, unsupported ACME negative)
  • Operand configuration (custom gRPC port, log level/format + deployment drift reconciliation)
  • Managed resource reconciliation (ServiceAccount, Service, NetworkPolicy)
  • Status contract (IstioCSRImage, gRPC endpoint, SA, ClusterRole/Binding)
  • User-provided CA ConfigMap negatives (missing key, missing namespace)

Also adds an OSM smoke context (Feature:ServiceMesh) with two cases that auto-skip when no istiod control plane is present:

  • Maistra-labeled member namespace receives istio-ca-root-cert
  • gRPC CreateCertificate succeeds for a mesh workload SPIFFE identity

Supporting changes:

utils_test.go: waitForIstioCSRConditionMessage helper for degraded-condition assertions
istio_csr_test.go: traceability label on existing grpc smoke (CM-867-TC-010)

Test plan

Default e2e (no mesh required):
E2E_GINKGO_LABEL_FILTER='Feature:IstioCSR && Platform:Generic' make test-e2e

Run P0 specs individually if needed:
E2E_GINKGO_LABEL_FILTER='ISTIOCSR-P0-001' make test-e2e

OSM smoke (cluster with ready istiod required):
E2E_GINKGO_LABEL_FILTER='Feature:IstioCSR && Feature:ServiceMesh' make test-e2e

Confirm existing IstioCSR grpc spec still passes:
E2E_GINKGO_LABEL_FILTER='CM-867-TC-010' make test-e2e

Verify OSM smokes are skipped cleanly on clusters without Service Mesh / istiod

Notes

  • OSM tests use maistra.io/member-of= and discover the control-plane namespace dynamically.
  • IstioCSR CR is created in a dedicated test namespace while spec.istioCSRConfig.istio.namespace targets the discovered istiod namespace.
  • No production code changes; test-only diff under test/e2e/.

Summary by CodeRabbit

  • Tests

    • Added extensive e2e coverage for Istio-CSR: validation, reconciliation across issuers, degraded states, resource recovery/drift correction, status contract checks, OpenShift Service Mesh smoke tests, and ACME HTTP-01 ingress handling. Improved stability with targeted timeouts, polling, and clearer auth error reporting.
  • Chores

    • Pinned Vault test image, hardened Vault setup/command handling, and tightened test invocation quoting for CI reliability.
  • Documentation

    • Added a detailed e2e test plan with 10 scenarios, coverage mapping, and run guidance.

@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a Ginkgo E2E suite and helpers to test IstioCSR reconciliation, degraded states, drift correction, and optional OpenShift Service Mesh gRPC certificate retrieval, plus Vault setup robustness, an ACME ingress helper, Makefile quoting, and a new e2e test plan.

Changes

Istio-CSR E2E Test Suite

Layer / File(s) Summary
Test infra, Vault PKI and diagnostics
test/e2e/utils_test.go, test/e2e/issuer_vault_test.go, test/e2e/testdata/vault/helm-values.yaml
Refactors Vault CLI invocation to use an in-pod token file and helper vaultShellCmd, adds Vault setup and pod-start timeouts, pod-status formatting and early failure detection, runs Vault setup under a dedicated timeout context, and pins the Vault image tag to 1.17.2.
Istio-CSR P0 helpers and main suite
test/e2e/istio_csr_p0_test.go, test/e2e/utils_test.go, test/e2e/istio_csr_test.go
Adds istiod control-plane discovery, mesh workload CSR generation, secret-copy helper, waitForIstioCSRConditionMessage, OLM-aware subscription patching, and the ordered Istio-CSR P0 Ginkgo suite validating reconciliation, drift correction, resource recreation, degraded states, and an optional OpenShift Service Mesh smoke test.
ACME ingress helper, Makefile and docs
test/e2e/issuer_acme_http01_test.go, Makefile, test/e2e/condition_matcher_test.go, test/e2e/plans/pr-379/test-cases.md
Introduces a shared OpenShift HTTP-01 ingress-class constant and helper, applies it across ACME solver configs, quotes the E2E_GINKGO_LABEL_FILTER in the Makefile test-e2e recipe, treats unauthorized/forbidden Get errors distinctly in a condition matcher, and adds a new e2e test plan document.

🎯 3 (Moderate) | ⏱️ ~25 minutes


Important

Pre-merge checks failed

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

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
No-Sensitive-Data-In-Logs ❌ Error PR logs raw pod output from Helm installer via GetLogs() in error messages at test/e2e/utils_test.go:2016-2017 and 2024-2025, which may expose secrets, tokens, or credentials. Replace GetLogs calls with formatVaultPodsStatus() calls, or sanitize output by logging only metadata/conditions instead of raw stderr/stdout from the installer pod.
Test Structure And Quality ⚠️ Warning Tests lack meaningful assertion messages. ~75 assertions without messages vs. only 5 with; violates diagnostic clarity requirement when tests fail in CI. Add descriptive messages to Expect() assertions to help diagnose failures, e.g., Expect(err).NotTo(HaveOccurred(), "failed to create namespace") instead of Expect(err).NotTo(HaveOccurred())
✅ Passed checks (13 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the primary changes: adding IstioCSR P0 e2e test coverage and OpenShift Service Mesh smoke tests, matching the substantial new test file (istio_csr_p0_test.go) and related test enhancements.
Docstring Coverage ✅ Passed Docstring coverage is 86.36% which is sufficient. The required threshold is 80.00%.
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 All Ginkgo test titles (It, Describe, Context) use stable, deterministic strings with no dynamic values like pod names, timestamps, UUIDs, or dynamic namespaces.
Microshift Test Compatibility ✅ Passed Test suite in istio_csr_p0_test.go uses operator.openshift.io API but is protected by [apigroup:operator.openshift.io] tag. OSM context auto-skips when istiod unavailable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed New test suite is SNO-compatible: 12 main tests have no multi-node assumptions; ServiceMesh context auto-skips if istiod unavailable; no pod anti-affinity or topology constraints found.
Topology-Aware Scheduling Compatibility ✅ Passed This PR only adds/modifies test files and test configuration. No deployment manifests, operator code, or controllers were added or modified, so the topology-aware scheduling check does not apply.
Ote Binary Stdout Contract ✅ Passed No process-level stdout writes. istio_csr_p0_test.go has no fmt.Print/log.Print/klog. All log.Printf() in utils_test.go are in helpers called from test blocks. Ginkgo's By() uses safe GinkgoWriter.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed New test uses only IPv6-compatible cluster-internal DNS and properly marks external-image test with [Skipped:Disconnected].
No-Weak-Crypto ✅ Passed PR uses only strong cryptographic algorithms (SHA256WithRSA, ECDSA-256); no weak algorithms, custom implementations, or insecure comparisons found.
Container-Privileges ✅ Passed PR introduces no privileged, hostPID/Network/IPC, SYS_ADMIN, or allowPrivilegeEscalation settings in new/modified Kubernetes manifests or test code.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot requested review from bharath-b-rh and swghosh May 29, 2026 07:25
@openshift-ci

openshift-ci Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: arun717
Once this PR has been reviewed and has the lgtm label, please assign bharath-b-rh 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 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

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

Inline comments:
In `@test/e2e/istio_csr_p0_test.go`:
- Around line 658-662: The test currently overwrites meshMemberNS.Labels with a
new map containing istioCSRP0MaistraMemberOfLabel, which drops any existing
labels; instead, before calling clientset.CoreV1().Namespaces().Update, merge
the new label into the existing meshMemberNS.Labels (create the map if nil) and
set meshMemberNS.Labels[istioCSRP0MaistraMemberOfLabel] = istioCPNamespace, then
call Update—this preserves other labels set by helpers/fixtures while applying
the Maistra label.
- Around line 371-374: The test currently sets acmev1.ACMEIssuer.Server to the
public LetsEncrypt endpoint, which creates an external dependency; change the
ACMEIssuer.Server value (the Server field on acmev1.ACMEIssuer in
istio_csr_p0_test.go) to a non-routable placeholder or local mock URL (e.g.
"https://example.invalid/directory" or the test harness mock endpoint) so the
negative-path e2e test does not attempt external network access; ensure any
related setup uses the mock URL so no real ACME calls are attempted.
🪄 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: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3455e985-372e-4c5f-8df8-1305f85b60a5

📥 Commits

Reviewing files that changed from the base of the PR and between e8a646d and ca8a8c1.

📒 Files selected for processing (2)
  • test/e2e/istio_csr_p0_test.go
  • test/e2e/utils_test.go

Comment thread test/e2e/istio_csr_p0_test.go
Comment thread test/e2e/istio_csr_p0_test.go Outdated
@arun717 arun717 changed the title e2e: add IstioCSR P0 coverage and OpenShift Service Mesh smoke tests CM-1043: add IstioCSR P0 e2e coverage and OpenShift Service Mesh smoke tests May 29, 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 May 29, 2026
@openshift-ci-robot

openshift-ci-robot commented May 29, 2026

Copy link
Copy Markdown

@arun717: This pull request references CM-1043 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Adds end-to-end coverage for IstioCSR reconciler and operand behavior that was not covered by existing istio_csr_test.go specs, plus two opt-in OpenShift Service Mesh (OSM) smoke tests.

New file test/e2e/istio_csr_p0_test.go introduces 12 P0 scenarios under Feature:IstioCSR / Platform:Generic, covering:

  • CR validation (singleton name, multi-instance rejection)
  • Issuer paths (ClusterIssuer happy path, unsupported ACME negative)
  • Operand configuration (custom gRPC port, log level/format + deployment drift reconciliation)
  • Managed resource reconciliation (ServiceAccount, Service, NetworkPolicy)
  • Status contract (IstioCSRImage, gRPC endpoint, SA, ClusterRole/Binding)
  • User-provided CA ConfigMap negatives (missing key, missing namespace)

Also adds an OSM smoke context (Feature:ServiceMesh) with two cases that auto-skip when no istiod control plane is present:

  • Maistra-labeled member namespace receives istio-ca-root-cert
  • gRPC CreateCertificate succeeds for a mesh workload SPIFFE identity

Supporting changes:

utils_test.go: waitForIstioCSRConditionMessage helper for degraded-condition assertions
istio_csr_test.go: traceability label on existing grpc smoke (CM-867-TC-010)

Test plan

Default e2e (no mesh required):
E2E_GINKGO_LABEL_FILTER='Feature:IstioCSR && Platform:Generic' make test-e2e

Run P0 specs individually if needed:
E2E_GINKGO_LABEL_FILTER='ISTIOCSR-P0-001' make test-e2e

OSM smoke (cluster with ready istiod required):
E2E_GINKGO_LABEL_FILTER='Feature:IstioCSR && Feature:ServiceMesh' make test-e2e

Confirm existing IstioCSR grpc spec still passes:
E2E_GINKGO_LABEL_FILTER='CM-867-TC-010' make test-e2e

Verify OSM smokes are skipped cleanly on clusters without Service Mesh / istiod

Notes

  • OSM tests use maistra.io/member-of= and discover the control-plane namespace dynamically.
  • IstioCSR CR is created in a dedicated test namespace while spec.istioCSRConfig.istio.namespace targets the discovered istiod namespace.
  • No production code changes; test-only diff under test/e2e/.

Summary by CodeRabbit

  • Tests
  • Added comprehensive end-to-end test coverage for Istio-CSR functionality, including validation scenarios, reconciliation behavior, status reporting, and error handling.
  • Added polling helper utility to improve test reliability and robustness.

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.

Arun Maurya and others added 6 commits May 29, 2026 15:21
Vault BeforeEach setup chains TLS cert, Helm, and pod init waits that can
exceed highTimeout on slow CI. Use a separate 30m context for setupVaultServer
and configureVaultPKI while keeping highTimeout for per-test issuer work.

Co-authored-by: Cursor <cursoragent@cursor.com>

@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

🤖 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 `@Makefile`:
- Around line 191-193: Update the Makefile comment that shows how to skip OSM
smoke tests to use Ginkgo v2's negation syntax: replace the invalid example that
uses `isSubsetOf`/`Feature:!ServiceMesh` with the correct `--label-filter` form
such as `Platform:Generic && !Feature:ServiceMesh` (or grouped as
`Platform:Generic && !(Feature:ServiceMesh)`), and update the explanatory line
that currently states `Feature:!ServiceMesh is invalid Ginkgo syntax.` to
clarify that the `!` must prefix the whole label (e.g., `!Feature:ServiceMesh`),
referencing the existing comment text fragments `Platform:Generic &&
!(Feature:ServiceMesh)` and `Feature:!ServiceMesh` to locate and change them.
🪄 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: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2e0cbe82-fbaf-4324-bcf3-967cf0d251cb

📥 Commits

Reviewing files that changed from the base of the PR and between 04dc97b and 36b073f.

📒 Files selected for processing (7)
  • Makefile
  • test/e2e/condition_matcher_test.go
  • test/e2e/issuer_acme_http01_test.go
  • test/e2e/istio_csr_p0_test.go
  • test/e2e/istio_csr_test.go
  • test/e2e/plans/pr-379/test-cases.md
  • test/e2e/utils_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/e2e/istio_csr_p0_test.go

Comment thread Makefile Outdated

@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

🤖 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/e2e/issuer_vault_test.go`:
- Line 467: The test currently splices oidcIssuer directly into a shell snippet
via vaultShellCmd which is then executed with execInPod("sh","-c",...), creating
a shell injection risk; change the call to avoid composing a shell string with
untrusted data by passing the issuer as an argv element instead (e.g. refactor
vaultShellCmd or add a new helper to accept variadic args and call execInPod
with the command and arguments directly), and update the other occurrence around
line 513 similarly so oidcIssuer is not interpolated into a shell command.
🪄 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: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1fe2f448-4ae8-4c9a-8ef5-ee88356092c2

📥 Commits

Reviewing files that changed from the base of the PR and between 36b073f and 44ffd31.

📒 Files selected for processing (4)
  • Makefile
  • test/e2e/issuer_vault_test.go
  • test/e2e/istio_csr_p0_test.go
  • test/e2e/utils_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • Makefile
  • test/e2e/istio_csr_p0_test.go

Comment thread test/e2e/issuer_vault_test.go Outdated
Arun Maurya and others added 7 commits June 3, 2026 00:58
Add Feature:ServiceMesh coverage that installs OSSM v3 when enabled,
validates root CA distribution, mesh workload gRPC signing, workload
CertificateRequests, and cross-namespace envoy traffic.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use a generated test namespace so BeforeEach setup does not time out
when OSSM smoke tests already created the real istio-system namespace.

Co-authored-by: Cursor <cursoragent@cursor.com>
The operator accepts only one IstioCSR per cluster. OSSM smoke left an
operand in istio-csr that blocked cert-manager-istio-csr deployment in
istio-csr-e2e-* namespaces. Exclude Feature:ServiceMesh from the default
CI label filter, clean up the OSSM operand after smoke tests, and add a
clear timeout hint when a second instance is rejected.

Co-authored-by: Cursor <cursoragent@cursor.com>
After moving grpc tests into istio-csr-e2e-* namespaces, the operand
template still pointed issuer lookup at istio-system, so the operator
never created cert-manager-istio-csr. Template the istio namespace,
clean up leftover operands before the grpc suite, and improve timeout
diagnostics.

Co-authored-by: Cursor <cursoragent@cursor.com>
@openshift-ci

openshift-ci Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@arun717: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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

Labels

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.

2 participants