-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
feat(server): make deep copies of objects returned by informers (#22173) #22179
feat(server): make deep copies of objects returned by informers (#22173) #22179
Conversation
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
❗ Preview Environment delete from Bunnyshell failedSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
Another way we could go about this is to wrap the informers. Maybe something like this:
|
I think I like the wrapping idea... seems better than sprinkling deep copies across the code base. |
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
…should-return-copy
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
…should-return-copy
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
@@ -888,7 +882,7 @@ func (s *Server) ListResourceEvents(ctx context.Context, q *application.Applicat | |||
if err != nil { | |||
return nil, fmt.Errorf("error listing resource events: %w", err) | |||
} | |||
return list, nil | |||
return list.DeepCopy(), nil |
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.
Trying to wrap the kubernetes.Interface
i think is too large of a task :-p. there are so too many methods.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #22179 +/- ##
=========================================
Coverage ? 55.84%
=========================================
Files ? 343
Lines ? 57290
Branches ? 0
=========================================
Hits ? 31996
Misses ? 22650
Partials ? 2644 ☔ View full report in Codecov by Sentry. |
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
@@ -3350,3 +3351,106 @@ func Test_RevisionMetadata(t *testing.T) { | |||
}) | |||
} | |||
} | |||
|
|||
func Test_DeepCopyInformers(t *testing.T) { |
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.
This is the "real" test. Ensuring the deep copy informers return an actual deep copy.
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
closes #22173
Checklist: