-
Notifications
You must be signed in to change notification settings - Fork 612
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
[Refactor] Refactor the (container) create command flagging process #1970
Conversation
fa7578e
to
cde45a3
Compare
1cdf3bd
to
a2c6d43
Compare
e14ae66
to
dd82e4b
Compare
fc68d9d
to
73f0bc3
Compare
4352fbf
to
327fe3f
Compare
@djdongjin Sorry for delay. |
pkg/containerutil/gc.go
Outdated
) | ||
|
||
// GenerateGcFunc returns a function that can be used to garbage collect a container | ||
func GenerateGcFunc(ctx context.Context, container containerd.Container, ns, id, name, dataStore string, containerErr error, containerNameStore namestore.NameStore, netManager NetworkOptionsManager, internalLabels InternalLabels) func() { |
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.
where is this func used?
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.
When an error occurs during creation client.NewContainer(ctx, id, cOpts...)
or due to a network error netManager.SetupNetworking(ctx, id)
, GenerateGcFunc
uses to generate gc func.
I haven't looked into if the newly created files make sense (i.e. if they're created in the correct pkg/location etc). Will take a look later. |
Thanks! I got it and I will deal above comments firstly. |
058c49e
to
27ebb3a
Compare
27ebb3a
to
691e367
Compare
92d9896
to
ee342bb
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.
@Laitr0n thanks for the change.
An overall suggestion is to first make the file name changes more consistent with the existing pattern, instead of creating new packages (cgrouputil
) or moving to other packages (containerutil
) unless the code is reused by other functions/commands other than run.
E.g., move cmd/nerdctl/container_run_xxx_linux.go
to pkg/cmd/container/run_xxx_linux.go
.
This will be quite helpful to identify where a new file/code come from.
Thanks!
Got what you mean. I'll make the update for these changes. |
a44450c
to
09cc240
Compare
@Zheaoli @djdongjin LGTY? 🙏 |
@AkihiroSuda sorry I haven't gotten a chance to take a look at the latest change. Will take a look today. |
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.
Overall LGTM, I left some minor suggestions. Thanks!
Since it's a large PR it might be good to have another review/approval.
memSwap, err := cmd.Flags().GetString("memory-swap") | ||
if err != nil { | ||
return nil, err | ||
func generateCgroupPath(id string, cgroupManager, cgroupParent string) (string, error) { |
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.
nit: can we keep the argument order unchanged and remove the redundant string
arg type (cgroupManager, cgroupParent, id string). Also if you move this func to after
GenerateOptsand before
ParseDevice`, the diff will be much smaller.
LGTM! Thanks for your work! ❤️ @Zheaoli Could you take a look at this? |
Signed-off-by: Laitron <meetlq@outlook.com>
09cc240
to
e7855d0
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.
Thanks
Checklist:
Signed-off-by: Laitron meetlq@outlook.com