-
Notifications
You must be signed in to change notification settings - Fork 39.7k
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
WIP: node: cm: use maps.Clone instead of reinvent it #128679
base: master
Are you sure you want to change the base?
WIP: node: cm: use maps.Clone instead of reinvent it #128679
Conversation
As pointed out in kubernetes#128657 (comment) Signed-off-by: Francesco Romani <[email protected]>
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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 kubernetes-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ffromani The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
WIP because I'd like to lookup for more instances and clean them up |
sure. Ping when ready. |
@@ -36,11 +37,7 @@ func NewContainerMap() ContainerMap { | |||
|
|||
// Clone creates a deep copy of the ContainerMap | |||
func (cm ContainerMap) Clone() ContainerMap { |
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.
personally I'd drop this function entirely as it just uses a stdlib function anyway
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 thought about it. I'd argue that if we bothered to create a type around essentially a map, we should not break the abstraction, and if so we need the trivial Clone
method.
Other (more far-fetching?) options:
- dissolve
ContainerMap
and make use an actual map + helper functions - make
ContainerMap
more opaque, fully wrap it into a struct, to open the option in the future to add locks (spoiler: node: cm: don't share containerMap instances between managers #128657 was caused largely because I incorrectly rememberedContainerMap
is more than such a thin wrapper. I confused it withpod_devices
)
I'm open to conversation here.
/retest |
@ffromani: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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 kubernetes-sigs/prow repository. I understand the commands that are listed here. |
/kind cleanup
What this PR does / why we need it:
As emerged during the review of #128657 (comment) , golang stdlib now features helpers in
maps
andslices
package we can use instead of reinventing in our codebaseWhich issue(s) this PR fixes:
Fixes N/A
Special notes for your reviewer:
N/A
Does this PR introduce a user-facing change?