STOR-2807: Add e2e test to verify CSI driver operators use service CA signed certificates#30980
STOR-2807: Add e2e test to verify CSI driver operators use service CA signed certificates#30980radeore wants to merge 1 commit intoopenshift:mainfrom
Conversation
…A signed certificates
|
Pipeline controller notification For optional jobs, comment This repository is configured in: automatic mode |
|
@radeore: This pull request references STOR-2807 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. |
WalkthroughA new test file was added to validate CSI driver operator secure-certificate behavior. The test waits for the Storage Cluster Operator to become healthy, identifies CSI driver operator pods, inspects their logs for certificate-related issues, and reports failures if insecure self-signed certificates or missing secure service-serving-cert logs are detected. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: radeore The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/extended/storage/csi_certificates.go (1)
53-60: Usedeferfor stream cleanup to prevent resource leaks.If
io.ReadAllpanics or the test is interrupted, the log stream won't be closed. MoveClose()to a defer immediately after the successfulStream()call.♻️ Proposed fix
logStream, err := oc.AdminKubeClient().CoreV1().Pods(CSINamespace).GetLogs(pod.Name, &corev1.PodLogOptions{ Container: operatorContainer, }).Stream(ctx) if err != nil { e2e.Logf("Failed to get logs for pod %s, skipping: %v", pod.Name, err) continue } + defer logStream.Close() logBytes, err := io.ReadAll(logStream) - logStream.Close() o.Expect(err).NotTo(o.HaveOccurred(), "failed to read logs for pod %s", pod.Name)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/extended/storage/csi_certificates.go` around lines 53 - 60, The log stream cleanup currently calls logStream.Close() after io.ReadAll, which can leak the stream if ReadAll panics or the test is interrupted; after successfully obtaining the log stream (the variable logStream from the pod logs Stream call), immediately schedule its closure with defer logStream.Close(), then proceed to call io.ReadAll and handle the error as before, removing the standalone logStream.Close() call later so the defer is the sole cleanup.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@test/extended/storage/csi_certificates.go`:
- Around line 53-60: The log stream cleanup currently calls logStream.Close()
after io.ReadAll, which can leak the stream if ReadAll panics or the test is
interrupted; after successfully obtaining the log stream (the variable logStream
from the pod logs Stream call), immediately schedule its closure with defer
logStream.Close(), then proceed to call io.ReadAll and handle the error as
before, removing the standalone logStream.Close() call later so the defer is the
sole cleanup.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0ebc06ff-061c-46a5-b2d2-4c645488a646
📒 Files selected for processing (1)
test/extended/storage/csi_certificates.go
|
Scheduling required tests: |
|
@radeore: This pull request references STOR-2807 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. |
|
@radeore: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
Risk analysis has seen new tests most likely introduced by this PR. New tests seen in this PR at sha: 10f486a
|
Summary
CSI driver operators should use service-serving-cert provided certificates by default, not insecure self-signed certificates. This PR adds an automated e2e test to enforce that guarantee across all CSI driver operators.
What does the test do
openshift-cluster-csi-driversnamespace-csi-driver-operatorSkip conditions
Test results:
For 4.21 AWS-EBS-CSI-DRIVER-OPERATOR (Test fails as expected):
For 4.22 AWS-EBS-CSI-DRIVER-OPERATOR:
For GCP-PD-CSI-DRIVER-OPERATOR:
For AZURE-DISK & AZURE-FILE-CSI-DRIVER-OPERATOR:
For VMWARE-VSPHERE-CSI-DRIVER-OPERATOR:
For IBM-VPC-BLOCK-CSI-DRIVER-OPERATOR: