-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix potential nil pointer dereference in reconcile loop #1138
Conversation
Fix potential for a panic due to nil pointer dereference if the workspace ServiceAccount does not exist. Signed-off-by: Angel Misevski <amisevsk@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me.
Was able to reproduce the original bug on the main branch and verified that this PR fixes it.
Setting Config.Workspace.ServiceAccount.DisableCreation = true
and Config.Workspace.ServiceAccount.DisableCreation = "test"
now results in the workspace safely failing, as expected:
NAME DEVWORKSPACE ID PHASE INFO
plain-devworkspace workspacefbc5a709fd0e4913 Failed Error creating DevWorkspace deployment: Detected unrecoverable deployment condition: FailedCreate pods "workspacefbc5a709fd0e4913-b8dd747df-" is forbidden: error looking up service account devworkspace-controller/test: serviceaccount "test" not found
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: amisevsk, AObuchow, l0rd The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
/retest |
1 similar comment
/retest |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1138 +/- ##
==========================================
- Coverage 52.42% 52.41% -0.01%
==========================================
Files 81 81
Lines 7380 7381 +1
==========================================
Hits 3869 3869
- Misses 3231 3232 +1
Partials 280 280
☔ View full report in Codecov by Sentry. |
What does this PR do?
Fix potential for a panic due to nil pointer dereference if the workspace ServiceAccount does not exist.
What issues does this PR fix or reference?
Closes #1137
Is it tested? How?
PR Checklist
/test v8-devworkspace-operator-e2e, v8-che-happy-path
to trigger)v8-devworkspace-operator-e2e
: DevWorkspace e2e testv8-che-happy-path
: Happy path for verification integration with Che