-
Notifications
You must be signed in to change notification settings - Fork 714
fix:forbid to restart/start container created by k8s #4516
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
Conversation
0a432e1 to
bba4942
Compare
pkg/cmd/container/restart.go
Outdated
| return fmt.Errorf("can't get container %s info ", found.Container.ID()) | ||
| } | ||
| if _, ok := info.Labels[k8slabels.ContainerType]; ok { | ||
| return fmt.Errorf("can't restart container %s created by k8s", info.ID) |
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.
Printing a warning may suffice
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.
done, thanks
bba4942 to
b1051da
Compare
pkg/cmd/container/restart.go
Outdated
| } | ||
| if _, ok := info.Labels[k8slabels.ContainerType]; ok { | ||
| log.L.Warnf("can't restart container %s created by k8s", info.ID) | ||
| return 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.
| return 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.
if remove return nerdctl will try to restart container created by k8s @AkihiroSuda
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.
Yes, and the user will learn that it is an unsupported operation.
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.
ok
790f239 to
f3b8f14
Compare
Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
f3b8f14 to
2e888f4
Compare
ChengyuZhu6
left a comment
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
AkihiroSuda
left a comment
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
some people want to use nerdctl to restart container created by k8s, It is necessary to return an error to forbid user start/restart the container.
ping @AkihiroSuda @djdongjin Thanks