cleanup sample app namespaces#2130
cleanup sample app namespaces#2130openshift-merge-bot[bot] merged 1 commit intoopenshift:oadp-devfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
e3061bf to
b364837
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/controller/registry.go (1)
345-367: Unused variablehasStsFieldscan be removed.The variable
hasStsFieldsis set totrueon line 361 but the function returns immediately on line 365, so it's never actually used. This appears to be leftover from a refactoring.♻️ Suggested simplification
- // Check if this profile contains STS fields - hasStsFields := false for _, profLine := range splitString[index+1:] { if profLine == "" { continue } if keyNameRegex.MatchString(profLine) { // We've reached the next profile break } // Check for STS-specific fields if roleArnRegex.MatchString(profLine) || webIdentityTokenFileRegex.MatchString(profLine) || stsRegionalEndpointsRegex.MatchString(profLine) { - hasStsFields = true r.Log.Info(fmt.Sprintf("Detected STS authentication in profile %s", matchProfile)) // For STS profiles, we return empty strings for access key and secret key // but don't error out return "", "", nil } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/controller/registry.go` around lines 345 - 367, The local boolean hasStsFields is unused and should be removed: in the STS-detection loop inside the profile-parsing block (the loop that iterates splitString[index+1:] and checks roleArnRegex, webIdentityTokenFileRegex, stsRegionalEndpointsRegex for matchProfile), delete the declaration "hasStsFields := false" and the assignment "hasStsFields = true"; keep the existing r.Log.Info(...) and the early return ("return \"\", \"\", nil") when any of roleArnRegex, webIdentityTokenFileRegex, or stsRegionalEndpointsRegex matches, so the logic is preserved without the dead variable.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@internal/controller/registry.go`:
- Around line 345-367: The local boolean hasStsFields is unused and should be
removed: in the STS-detection loop inside the profile-parsing block (the loop
that iterates splitString[index+1:] and checks roleArnRegex,
webIdentityTokenFileRegex, stsRegionalEndpointsRegex for matchProfile), delete
the declaration "hasStsFields := false" and the assignment "hasStsFields =
true"; keep the existing r.Log.Info(...) and the early return ("return \"\",
\"\", nil") when any of roleArnRegex, webIdentityTokenFileRegex, or
stsRegionalEndpointsRegex matches, so the logic is preserved without the dead
variable.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7b82a774-6ac7-467c-9472-550a8ea14416
📒 Files selected for processing (3)
Makefileinternal/controller/registry.gointernal/controller/registry_test.go
There was a problem hiding this comment.
Pull request overview
Updates AWS credential parsing to tolerate STS/web-identity style profiles and improves e2e cleanup by removing leftover sample app namespaces.
Changes:
- Extend
parseAWSSecretto detect STS-related fields and avoid failing when static access keys are absent. - Add unit tests for
parseAWSSecret, including an STS profile scenario, and extend existing secret fixtures. - Update
test-e2e-cleanupto deletemongo-persistentandmysql-persistentnamespaces.
Reviewed changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/controller/registry.go | Adds STS field detection to AWS secret parsing logic. |
| internal/controller/registry_test.go | Adds new table-driven tests for parseAWSSecret and updates AWS secret test data with an STS profile. |
| Makefile | Cleans up persistent sample namespaces as part of e2e cleanup target. |
Comments suppressed due to low confidence (1)
Makefile:615
oc delete nscan block for a long time (default--wait=true), and namespaces often get stuck terminating due to finalizers. Consider adding--wait=false(and/or a finalizer cleanup) here sotest-e2e-cleanupdoesn’t hang the pipeline when these namespaces are slow/stuck to delete.
if [ -n "$$INSTALL_PLAN" ]; then \
echo "InstallPlan $$INSTALL_PLAN found"; \
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kaovilai, mpryc, weshayutin 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 |
|
@kaovilai: all tests passed! 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. |
cleanup: remove persistent namespaces after e2e tests
Adds deletion of
mongo-persistentandmysql-persistentnamespaces in thetest-e2e-cleanupMakefile target. These sample app namespaces were left behind after e2e test runs, causing namespace pollution in the cluster.Why the changes were made
E2E tests create
mongo-persistentandmysql-persistentnamespaces for sample application deployments but the cleanup target did not remove them. This left stale namespaces in the cluster after test runs.How to test the changes made
make test-e2e-cleanupafter e2e tests and verifymongo-persistentandmysql-persistentnamespaces are deleted--ignore-not-found=trueensures the command succeeds even if the namespaces don't exist