-
Notifications
You must be signed in to change notification settings - Fork 228
Implement the containerd runtime for Ignite #337
Conversation
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 this initial piece of work!
Can you please split this up however, to do the containerd vendor bump in a totally different PR so this PR can be pretty small?
pkg/runtime/containerd/client.go
Outdated
) | ||
|
||
const ( | ||
ctdSocket = constants.DATA_DIR + "/containerd.sock" |
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.
Hmm, this looks strange? The default containerd socket is /run/containerd/containerd.sock
, and it should point there
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.
Changed, it seems that there's no way to ask containerd
where the socket is, so we might want to make this configurable in the future.
pkg/runtime/containerd/client.go
Outdated
|
||
func (cc *ctdClient) AttachContainer(container string) error { | ||
// TODO: Implement attach for containerd | ||
return unsupported("logs") |
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.
attach
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.
Fixed, thanks
pkg/runtime/containerd/client.go
Outdated
func (cc *ctdClient) ExportImage(image string) (io.ReadCloser, string, error) { | ||
r, w := io.Pipe() | ||
err := cc.client.Export(context.Background(), w) | ||
return r, "", err // We don't need a temporary container, leave the ID string blank |
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.
Update our code to support a blank string here
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 does already support a blank string there. I might refactor the interface to handle a specific ContainerID
type which can be nil
so we can avoid confusion.
pkg/runtime/types.go
Outdated
@@ -49,7 +49,7 @@ type ContainerConfig struct { | |||
|
|||
type Interface interface { | |||
InspectImage(image string) (*ImageInspectResult, error) | |||
PullImage(image string) (io.ReadCloser, error) | |||
PullImage(image string) (io.ReadCloser, error) // TODO: This doesn't need to return the io.ReadCloser |
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.
please update the existing ignite code to support this
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.
👍
pkg/runtime/containerd/client.go
Outdated
} | ||
|
||
func (cc *ctdClient) RunContainer(image string, config *runtime.ContainerConfig, name string) (s string, err error) { | ||
img, err := cc.client.GetImage(context.Background(), image) |
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.
after this, add: https://gist.github.com/luxas/38fb8a5d3edca73414b6ef9c40300962#file-main-go-L61-L69
unpacked, err := image.IsUnpacked(ctx, containerd.DefaultSnapshotter)
if err != nil {
return err
}
if !unpacked {
if err := image.Unpack(ctx, containerd.DefaultSnapshotter); err != nil {
return err
}
}
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.
Solved using containerd.WithPullUnpack
when pulling
Also see https://github.com/containerd/containerd/blob/master/docs/getting-started.md for a guide |
The containerd vendoring has been separated in #348, this PR has now been rebased on top of it. |
Rebased on top of #356. |
I implemented RunContainer now based off previous PoC code I had created |
The |
Awesome work 🎉 ✨!! |
This PR implements the alternative
containerd
runtime for Ignite. containerdv1.2.7
, the latest stable version, was automatically vendored, but this bumps that tov1.3.0-beta.1
for multiple reasons:v1.2.7
, the old extractor was already dropped in that release before transitioning to the new implementation forv1.3.0
attach
is natively implemented, this also enableslogs
The runtime interface has also received some changes to better adapt to both container runtimes.
Fixes #209.
cc @luxas