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

controller: Handle snapshotter per handler #303

Conversation

fidencio
Copy link
Member

Let's start properly setting a specific snapshotter per runtime handler configured for containerd.

This work depends on a work done on the Kata Containers side to better support setting snapshotters per runtime handler.

The PR from the Kata Containers side is:
kata-containers/kata-containers#8655.

@fidencio fidencio force-pushed the topic/controller-properly-set-snapshotter-per-runtime-handler branch from b11460f to 5f42870 Compare December 13, 2023 14:50
@stevenhorsman
Copy link
Member

/test

@stevenhorsman stevenhorsman force-pushed the topic/controller-properly-set-snapshotter-per-runtime-handler branch from 5f42870 to b78fbde Compare December 22, 2023 16:44
@stevenhorsman
Copy link
Member

During testing of this I found a bug in kata-deploy, so waiting on kata-containers/kata-containers#8721 to be merged to fix this.

@fidencio fidencio force-pushed the topic/controller-properly-set-snapshotter-per-runtime-handler branch 2 times, most recently from 5c2e16a to 4ee7f81 Compare December 26, 2023 10:02
@fidencio
Copy link
Member Author

I found a few more issues on the kata-deploy side, all addressed as part of: kata-containers/kata-containers#8733

I've also created a new PR on the Operator side in order to test with the kata-deploy payload, before this one / and the Kata Containers one gets merged: #310

Copy link
Member

@stevenhorsman stevenhorsman left a comment

Choose a reason for hiding this comment

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

LGTM now. Thanks!

Copy link
Member

@beraldoleal beraldoleal left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

Comment on lines 637 to 642
shim := strings.TrimPrefix(runtimeClass.Name, "kata-")
if snapshotter_handler_mapping == "" {
snapshotter_handler_mapping += shim + ":" + runtimeClass.Snapshotter
} else {
snapshotter_handler_mapping += "," + shim + ":" + runtimeClass.Snapshotter
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this kata- prefix processing is repeated below. Can we do it only once? I also think preparing snapshotter_handler_mapping can follow the same strings.Join() approach used by runtimeClassNames.

Copy link
Member Author

Choose a reason for hiding this comment

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

So, the prefix processing is done for a different reason here, and looking at the code is quite hard to make this only once, as kata-containers explicitly requires the shim name for all the operations, and for the sake of the user's experience the operator requires a full runtime class name (as in kata-qemu).

About the string.Join(), this can be done, I just need to either make sure , is correctly treated on the kata-containers side, or that we remove the last , that would be added by the strings.Join().

Copy link
Contributor

Choose a reason for hiding this comment

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

or that we remove the last , that would be added by the strings.Join().

The doc example suggests that it is not added: https://pkg.go.dev/strings#example-Join

Copy link
Member Author

Choose a reason for hiding this comment

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

Cool, I've updated the PR and simplified a little bit the logic.
Thanks for the rveiew, @mythi!

@fidencio fidencio force-pushed the topic/controller-properly-set-snapshotter-per-runtime-handler branch from 4ee7f81 to 0ba092b Compare January 5, 2024 14:50
Let's start properly setting a specific snapshotter per runtime handler
configured for containerd.

This work depends on a work done on the Kata Containers side to better
support setting snapshotters per runtime handler.

The PR from the Kata Containers side is:
kata-containers/kata-containers#8655.

Signed-off-by: Fabiano Fidêncio <[email protected]>
@fidencio fidencio force-pushed the topic/controller-properly-set-snapshotter-per-runtime-handler branch from 0ba092b to a0400af Compare January 5, 2024 15:08
Copy link
Contributor

@mythi mythi left a comment

Choose a reason for hiding this comment

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

LGTM

@fidencio fidencio merged commit 4f8e8c8 into confidential-containers:main Jan 5, 2024
9 checks passed
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.

5 participants