nri icon indicating copy to clipboard operation
nri copied to clipboard

Drop tinygo requirement

Open saschagrunert opened this issue 8 months ago • 8 comments

Fixes https://github.com/containerd/nri/issues/140

saschagrunert avatar Mar 11 '25 13:03 saschagrunert

main is not called anymore with a WASI reactor. https://github.com/containerd/nri/blob/82c65a7af0df946a547cd934370e950bb289d9ee/plugins/wasm/plugin.go#L27-L29

You need to use init() instead. https://github.com/knqyf263/go-plugin/blob/7819d6147c952d109df10990fe555029aff6c3bc/examples/host-function-library/plugin/plugin.go#L13-L18

Note that main() is still needed for Go to compile Wasm modules.

knqyf263 avatar Mar 11 '25 17:03 knqyf263

main is not called anymore with a WASI reactor.

https://github.com/containerd/nri/blob/82c65a7af0df946a547cd934370e950bb289d9ee/plugins/wasm/plugin.go#L27-L29

You need to use init() instead. https://github.com/knqyf263/go-plugin/blob/7819d6147c952d109df10990fe555029aff6c3bc/examples/host-function-library/plugin/plugin.go#L13-L18

Note that main() is still needed for Go to compile Wasm modules.

Yes, thank you now it works when vendoring the NRI into CRI-O. :+1:

saschagrunert avatar Mar 12 '25 11:03 saschagrunert

@knqyf263 CI is green now, do we want to cut a new go-plugin release first?

saschagrunert avatar Mar 12 '25 12:03 saschagrunert

@saschagrunert Thanks for testing it out. I'll cut a new release.

knqyf263 avatar Mar 12 '25 12:03 knqyf263

@saschagrunert Is this something that would be important to get behind an NRI tag, so we could pull it in on the CRI-O side ?

If it is, then maybe one alternative would be to branch off a 0.9 release branch and merge this there, but keep if off main until all parties involved/affected are content with moving to go 1.24 as the minimum version.

klihub avatar Mar 13 '25 17:03 klihub

If it is, then maybe one alternative would be to branch off a 0.9 release branch and merge this there, but keep if off main until all parties involved/affected are content with moving to go 1.24 as the minimum version.

I think that's a valuable solution, yes. We will move to go 1.24 in the future in any case.

A build tag will not work with the go module requirements if I think about it, because go modules are not tag aware. Means we need the go 1.24 requirement independently of any build constraints.

saschagrunert avatar Mar 14 '25 08:03 saschagrunert

@klihub do you have a new base branch where I could rebase on?

saschagrunert avatar Mar 25 '25 13:03 saschagrunert

@klihub do you have a new base branch where I could rebase on?

No, sorry, not yet.

klihub avatar Mar 25 '25 14:03 klihub

I think this can be rebased on main now. containerd will also move to 1.24 for our next release (2.2).

samuelkarp avatar May 23 '25 18:05 samuelkarp

@saschagrunert Now we could rebase this and try to get it merged. I tried to do that, but I was hasty with my push (to your original source branch, argh... sorry :see_no_evil:) and now I can't figure out what I screwed up compared to your saved original branch, or if it is something extra that the additions since the base branch of that tree would require, since the WASM plugin compiles in your original but not in the updated version.

klihub avatar Jun 12 '25 18:06 klihub

@saschagrunert Now we could rebase this and try to get it merged. I tried to do that, but I was hasty with my push (to your original source branch, argh... sorry 🙈) and now I can't figure out what I screwed up compared to your saved original branch, or if it is something extra that the additions since the base branch of that tree would require, since the WASM plugin compiles in your original but not in the updated version.

@saschagrunert I think I managed to figure it out now... will update with a fixed branch.

klihub avatar Jun 13 '25 06:06 klihub

@klihub thank you!

saschagrunert avatar Jun 23 '25 07:06 saschagrunert

The matrix for go still includes 1.23.9 but during the setup for that version in switches to 1.24.3 instead.. thus we end up using 1.24.3 twice in CI..

I removed that version from the matrix.

nit because this can be said for all the plugins.. TODO: need some readme docs for the WASM implementation... linking to https://github.com/knqyf263/go-plugin docs if nec..; explanation of special pkg/api; something for the plugin; and a test would be nice.

Yeah I can follow-up on docs and tests.

saschagrunert avatar Jul 02 '25 10:07 saschagrunert