-
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
Support --ipc=(shareable|container:<container>)
flag
#2757
Conversation
if !strings.Contains(combined, "no such container: abcd1234") && | ||
!strings.Contains(combined, "No such container: abcd1234") { |
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.
Q. For docker compatible, I added "No such container: abcd1234"
. But, in many cases, nerdctl prints it as lowercase. How can I deal with it?
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 you can just use case-insensitive regexp
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 just change the string to lowercases before comparing it.
Thanks to reply.
pkg/ipcutil/ipcutil.go
Outdated
|
||
// ShmSize is only used when mode is private or shareable | ||
// Devshm size in bytes | ||
ShmSize string `json:"shm_size,omitempty"` |
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 IPC marshalized as JSON?
We do not use this_json_style
in other places.
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 fixed it. I'm sorry.
b46f57c
to
7647f5d
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 for the work. Left a few comments
pkg/ipcutil/ipcutil_linux.go
Outdated
} | ||
shmproperty += ",size=" + strconv.FormatInt(shmBytes, 10) | ||
} | ||
err := os.MkdirAll(shmPath, 0o700) |
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.
should it be 0o700
or 0700
?
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.
No, it doesn't. Should I change it?
I think 0700
or 0755
can be. How do you think about it?
func DetectFlags(ctx context.Context, client *containerd.Client, stateDir string, ipc string, shmSize string) (IPC, error) { | ||
var res IPC | ||
res.ShmSize = shmSize | ||
switch ipc { |
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.
It might be cleaner to have a standalone func to convert string -> IPCMode? e.g.
func stringToIPCMode(s string) (IPCMode, error) {
switch s {
case "private", "host", "shareable", "container":
return IPCMode(s), nil
default:
return "", errors.New("invalid IPCMode string")
}
}
Then we can have other logic based on the converted IPCMode
.
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 cannot find the better way to solve it.
Because, before searching the containers' status, we cannot know that the ipc string value is valid.
Can I get more detailed advice, please?
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.
sorry for the delay. I'll take another 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.
LGTM, thanks
Looks good, but please squash commits |
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.
HI @minuk-dev
Great Work. There are some comments for reference only.
1e8d072
to
75ba518
Compare
Signed-off-by: Min Uk Lee <minuk.dev@gmail.com> - support ipc namespace - support /dev/shm
75ba518
to
b452c64
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
#1293
(Late reviews are also okay. Please review carefully.)
ipcutil
:--ipc=shareable
, a container mounts a path on host as an intermediary for/dev/shm
.ipcutil.CleanUp()
to clean mounted/dev/shm
.