Skip to content
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

Add containerd cri #19

Merged
merged 5 commits into from
Sep 30, 2022
Merged

Add containerd cri #19

merged 5 commits into from
Sep 30, 2022

Conversation

maiqueb
Copy link
Collaborator

@maiqueb maiqueb commented Sep 16, 2022

This PR adds the containerd CRI implementation to the project, along with unit tests.

Fixes: #20

@maiqueb maiqueb force-pushed the add-containerd-cri branch 3 times, most recently from b333e6d to ea527a1 Compare September 16, 2022 15:47
@maiqueb maiqueb assigned maiqueb and phoracek and unassigned maiqueb Sep 16, 2022
Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
Copy link
Member

@qinqon qinqon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of them are nits on naming

pkg/cri/containerd/fake/runtime.go Show resolved Hide resolved
templates/dynamic-networks-controller.yaml.j2 Outdated Show resolved Hide resolved
pkg/controller/pod.go Outdated Show resolved Hide resolved
pkg/controller/pod.go Outdated Show resolved Hide resolved
pkg/cri/containerd/fake/runtime.go Show resolved Hide resolved
cmd/dynamic-networks-controller/networks-controller.go Outdated Show resolved Hide resolved
Comment on lines +206 to +218
netnsPath, err := pnc.netnsPath(newPod)
if err != nil {
klog.Errorf("failed to figure out the pod's network namespace: %v", err)
return
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A DynamicAttachmentRequest without PodNetNS is legit ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then why we don't return the error ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the UpdateFunc of the controller; how can it return errors?

	podInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
		UpdateFunc: podNetworksController.handlePodUpdate,
	})

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then maybe better send an event more than an error ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be, but events go away after an hour. I prefer to just log.

pkg/controller/pod.go Show resolved Hide resolved
pkg/controller/pod.go Outdated Show resolved Hide resolved
pkg/controller/pod_test.go Show resolved Hide resolved
Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
By making the `DynamicAttachmentRequest` implement the stringer
interface, we can have proper information whenever we log those
requests.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
pkg/controller/pod.go Show resolved Hide resolved
Comment on lines +69 to +83
func (c Container) ID() string {
return c.id
}

func (Container) Info(context.Context, ...containerd.InfoOpts) (containers.Container, error) {
return containers.Container{}, nil
}

func (Container) Delete(context.Context, ...containerd.DeleteOpts) error {
return nil
}

func (Container) NewTask(context.Context, cio.Creator, ...containerd.NewTaskOpts) (containerd.Task, error) {
return nil, nil
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My fault I se it now

"github.com/containerd/containerd"
)

type Client interface {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My fault the containerd concept is called Client https://github.com/containerd/containerd/blob/main/client.go#L85

@@ -9,3 +9,9 @@ const (
// Containerd represents the containerd container runtime
Containerd RuntimeType = "containerd"
)

// ContainerRuntime interface
type ContainerRuntime interface {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah all fine

@maiqueb maiqueb merged commit 519f63d into main Sep 30, 2022
@maiqueb maiqueb deleted the add-containerd-cri branch September 30, 2022 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add containerd support
3 participants