Skip to content

Update the containerd-shim-wasm to v1.0#299

Merged
Mossaka merged 4 commits intomainfrom
bump-containerd-shim-wasm-v1
Mar 31, 2025
Merged

Update the containerd-shim-wasm to v1.0#299
Mossaka merged 4 commits intomainfrom
bump-containerd-shim-wasm-v1

Conversation

@Mossaka
Copy link
Copy Markdown
Member

@Mossaka Mossaka commented Mar 26, 2025

Preparing for the upcoming runwasi v1.0 release

Signed-off-by: Jiaxiao (mossaka) Zhou duibao55328@gmail.com

Copy link
Copy Markdown

@jprendes jprendes left a comment

Choose a reason for hiding this comment

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

LGTM, left a few nits

Comment thread containerd-shim-spin/src/engine.rs Outdated
Comment thread containerd-shim-spin/src/trigger.rs Outdated
@Mossaka Mossaka force-pushed the bump-containerd-shim-wasm-v1 branch from 1e6050c to 88df5c0 Compare March 27, 2025 03:26
Copy link
Copy Markdown

@jprendes jprendes left a comment

Choose a reason for hiding this comment

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

LGTM!
Great work @Mossaka !

@Mossaka Mossaka force-pushed the bump-containerd-shim-wasm-v1 branch from 88df5c0 to 402d9a6 Compare March 27, 2025 19:27
Signed-off-by: Jiaxiao (mossaka) Zhou <duibao55328@gmail.com>
@Mossaka Mossaka force-pushed the bump-containerd-shim-wasm-v1 branch from 5b80069 to 2dd59d7 Compare March 28, 2025 21:48
@Mossaka Mossaka marked this pull request as ready for review March 28, 2025 21:48
Copy link
Copy Markdown
Collaborator

@kate-goldenring kate-goldenring left a comment

Choose a reason for hiding this comment

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

Thank you @Mossaka

@kate-goldenring kate-goldenring mentioned this pull request Mar 28, 2025
@kate-goldenring
Copy link
Copy Markdown
Collaborator

@Mossaka, it looks like the Systemd cgroup is not being set correctly for k3s: SystemdCgroup is not set to true, Maybe there is some issue with these changes: #301?

Copy link
Copy Markdown

@jprendes jprendes left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread containerd-shim-spin/Cargo.toml
@shirok1
Copy link
Copy Markdown
Contributor

shirok1 commented Mar 29, 2025

@Mossaka, it looks like the Systemd cgroup is not being set correctly for k3s: SystemdCgroup is not set to true, Maybe there is some issue with these changes: #301?

On my machine K3S generated SystemdCgroup = true itself:

# k3s -v
k3s version v1.32.2+k3s1 (381620ef)
go version go1.23.6
# ls /var/lib/rancher/k3s/agent/etc/containerd/
certs.d  config.toml
# cat /var/lib/rancher/k3s/agent/etc/containerd/config.toml
# irrelevant skipped...
[plugins.'io.containerd.cri.v1.runtime'.containerd.runtimes.'spin']
  runtime_type = "io.containerd.spin.v2"

[plugins.'io.containerd.cri.v1.runtime'.containerd.runtimes.'spin'.options]
  BinaryName = "/opt/kwasm/bin/containerd-shim-spin-v2"
  SystemdCgroup = true

All runtimes K3S found will share a global SystemdCgroup setting

In templates: https://github.com/k3s-io/k3s/blob/441a42e8ce5a850e32546593ecad750a7ccc3ab1/pkg/agent/templates/templates.go#L25

Also see https://github.com/k3s-io/k3s/blob/441a42e8ce5a850e32546593ecad750a7ccc3ab1/pkg/agent/containerd/config_linux.go#L88 where this value is from

@shirok1
Copy link
Copy Markdown
Contributor

shirok1 commented Mar 29, 2025

@kate-goldenring So I found the problem in #299 (comment) might be

if sudo cat /var/lib/rancher/k3s/agent/etc/containerd/config.toml | grep -A2 "runtimes.spin.options" | grep -q "SystemdCgroup = true"; then

requiring runtimes.spin.options in config.toml, but K3S generates runtimes."spin".options for containerd v3 config (and runtimes.'spin'.options for v2), see https://github.com/search?q=repo%3Ak3s-io%2Fk3s%20containerd.runtimes&type=code

To totally avoid such bug we might need something like jq but for toml

… different quoting styles for spin

Signed-off-by: Jiaxiao (mossaka) Zhou <duibao55328@gmail.com>
Signed-off-by: Jiaxiao (mossaka) Zhou <duibao55328@gmail.com>
@Mossaka
Copy link
Copy Markdown
Member Author

Mossaka commented Mar 31, 2025

Okay the CI's passing now! I did push two commits to fix it:

Please take a look, @kate-goldenring and @jprendes

Thank you for helping, @shirok1

Copy link
Copy Markdown

@jprendes jprendes left a comment

Choose a reason for hiding this comment

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

LGTM

# A bug in containerd makes BinaryName not work with shim not in PATH, so this statically links the kwasm installation to path
# https://github.com/containerd/containerd/issues/11480
mkdir -p $NODE_ROOT/usr/local/bin/
ln -s $KWASM_DIR/bin/containerd-shim-spin-v2 $NODE_ROOT/usr/local/bin/containerd-shim-spin
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How did this ever work? Or is this change not released yet?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not released yet but I am not sure how the CI was not able to detect it

Copy link
Copy Markdown
Member Author

@Mossaka Mossaka Mar 31, 2025

Choose a reason for hiding this comment

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

Oh wait, the CI was skipped for this change - I don't know why though: https://github.com/spinframework/containerd-shim-spin/actions/runs/14123812940. But this explains why this error went undetected to the main tree

Signed-off-by: Jiaxiao (mossaka) Zhou <duibao55328@gmail.com>
@Mossaka Mossaka requested a review from jprendes March 31, 2025 14:12
Copy link
Copy Markdown

@jprendes jprendes 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 @Mossaka !

@Mossaka Mossaka merged commit 57712f0 into main Mar 31, 2025
13 checks passed
@Mossaka Mossaka deleted the bump-containerd-shim-wasm-v1 branch March 31, 2025 16: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.

4 participants