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 crio runtime #31

Merged
merged 3 commits into from
Oct 10, 2022
Merged

Add crio runtime #31

merged 3 commits into from
Oct 10, 2022

Conversation

maiqueb
Copy link
Collaborator

@maiqueb maiqueb commented Oct 6, 2022

This PR adds code to enable the controller to work with a CRIO runtime.

It also provides a manifest to deploy this option.

Fixes: #22

@maiqueb maiqueb force-pushed the add-crio-runtime branch 6 times, most recently from 9c0d9f0 to 721bc72 Compare October 6, 2022 16:27
- name: containerd-socket
mountPath: {{ CRI_SOCKET_PATH }}
- name: cri-socket
mountPath: /host{{ CRI_SOCKET_PATH }}
Copy link
Member

Choose a reason for hiding this comment

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

You can remove the attribute from here. You can parametrize the host path in volumes to fit the system. Inside the container you may be able to keep it always on the same path, removing some of the complexity

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the host, I'll have either:

  • /run/containerd/containerd.sock
  • /run/crio/crio.sock

IIUC, your suggestion is to mount to the pod something like: /host/cri-socket.sock .

Not saying this is bad, but I don't see the proposed alternative as more complex than hard-coding.

Plus, if I have access to the container - but not its configuration - I will always know which type of runtime I'm using.
(I do wonder if this scenario is common ...)

Copy link
Member

Choose a reason for hiding this comment

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

I prefer keeping an abstract path as an "interface" in a way, so the manifest serves as a mapper between the two realms. I don't have any stronger reasoning for it, so I won't fight

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
@maiqueb maiqueb force-pushed the add-crio-runtime branch 2 times, most recently from c3b9449 to d05ca4f Compare October 7, 2022 14:23
@maiqueb maiqueb modified the milestone: MVP Oct 7, 2022
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.

Pair of nits

}, nil
}

func getConnection(socketPath string, timeout time.Duration) (*grpc.ClientConn, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Let's call this just connectSocket or openConnection so it's not "just" a getter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll see what I can do.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done - called it connect.

@@ -146,5 +148,9 @@ func handleSignals(stopChannel chan struct{}, signals ...os.Signal) {

func newContainerRuntime(configuration *config.Multus) (cri.ContainerRuntime, error) {
const withoutTimeout = 0
if configuration.CriType == cri.Crio {
crioTimeout := 5 * time.Second
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we need this for containerd ? maybe it's better to pass this as a "cmd" argument, so users decide what timeout they want.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have no clue why. I can only say a 0 will not work there - you get a Context deadline exceeded error instantly.

Going forward I agree this could be an interesting parameter to have in the configuration. Right now, I think it doesn't make much sense, given the early stage of the project.

I'll unify these for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, I do know why (just had to look).

If you pass a 0, containerd defaults to 10 seconds. Why 10 ? No clue.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
This PR changes the manifest templating to also provide a manifest for
CRIO based installations.

This manifest features a different runtime configuration, which will
cause the controller to use a different container runtime to access the
pod's sandbox ID, and namespace.

The golang code is also updated to use this new runtime, when
configured.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
@maiqueb maiqueb requested review from qinqon and removed request for qinqon October 10, 2022 10:30
@qinqon
Copy link
Member

qinqon commented Oct 10, 2022

/lgtm

@maiqueb maiqueb merged commit 3bc8324 into main Oct 10, 2022
@maiqueb maiqueb deleted the add-crio-runtime branch October 10, 2022 10:51
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 crio support
3 participants