-
Notifications
You must be signed in to change notification settings - Fork 112
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
Remove compatability code to remove service account with -sa suffix #957
Remove compatability code to remove service account with -sa suffix #957
Conversation
/approve should we have in previous PRs updated the doc for the generate SAs at https://github.com/shipwright-io/build/blob/main/docs/buildrun.md#defining-the-serviceaccount with some expectation of what the name of the generated service account is? if so, perhaps we can address that with this one WDYT @SaschaSchwarze0 ? |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gabemontero 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 |
Done @gabemontero. |
if apierrors.IsNotFound(err) { | ||
serviceAccount.Name = GetHeritageGeneratedServiceAccountName(completedBuildRun) | ||
ctxlog.Info(ctx, "deleting service account", namespace, completedBuildRun.Namespace, name, completedBuildRun.Name, "serviceAccount", serviceAccount.Name) | ||
err = client.Delete(ctx, serviceAccount) | ||
} | ||
|
||
if err != nil && !apierrors.IsNotFound(err) { | ||
if !apierrors.IsNotFound(err) { |
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.
I think it would be nice if we remove the nested if and use the &&
if err := client.Delete(ctx, serviceAccount); err != nil && !apierrors.IsNotFound(err) {
return err
}
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.
Indeed, done @shahulsonhal.
5960bf3
to
2100eee
Compare
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.
/lgtm
Changes
Fixes #892
This removes the compatibility code that removes a generated service account with the
-sa
suffix on BuildRun completion created by old releases. Should a user have a running old BuildRun or make a large version jump, then the owner reference will make sure the service account gets deleted on BuildRun deletion.Submitter Checklist
Release Notes