diff --git a/.github/workflows/lint-test-charts.yaml b/.github/workflows/lint-test-charts.yaml index bfb14db..87f5b68 100644 --- a/.github/workflows/lint-test-charts.yaml +++ b/.github/workflows/lint-test-charts.yaml @@ -44,4 +44,7 @@ jobs: if: steps.list-changed.outputs.changed == 'true' - name: Run chart-testing (install) - run: ct install --config ct.yaml --helm-extra-set-args "--set target=ubuntu_18_04" \ No newline at end of file + run: ct install --config ct.yaml --helm-extra-set-args "--set target=ubuntu_18_04" + + - name: Run chart-testing (install wasmtime) + run: ct install --config ct.yaml --helm-extra-set-args "--set target=ubuntu_18_04 --set ociType=crun-wasmtime" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 386deba..2c3f30e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,11 @@ -FROM ubuntu:18.04 as ubuntu18builder +FROM quay.io/knawd/libnode:ubuntu18 as ubuntu18builder -ENV DEBIAN_FRONTEND=noninteractive -ENV TZ=Etc/UTC ENV WASMTIME_VERSION=v5.0.0 -RUN apt-get update -RUN apt-get install -y curl make git gcc build-essential pkgconf libtool libsystemd-dev libprotobuf-c-dev libcap-dev libseccomp-dev libyajl-dev go-md2man libtool autoconf python3 automake xz-utils RUN curl https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -e all -p /usr/local --version=0.11.2 -RUN git clone --depth 1 --recursive https://github.com/containers/crun.git +WORKDIR / +RUN git clone --depth 1 -b 1.8 --recursive https://github.com/containers/crun.git WORKDIR /crun + RUN ./autogen.sh RUN ./configure --with-wasmedge --enable-embedded-yajl RUN make @@ -22,11 +20,6 @@ RUN make RUN ./crun --version RUN mv crun crun-wasmtime -WORKDIR /wasm_nodejs -RUN git clone --depth 1 -b napi-libnode https://github.com/mmomtchev/node.git -WORKDIR /wasm_nodejs/node -RUN ./configure --shared -RUN make WORKDIR /wasm_nodejs RUN git clone --depth 1 -b node-wasm-experiment https://github.com/mhdawson/crun.git WORKDIR /wasm_nodejs/crun @@ -41,15 +34,11 @@ RUN make RUN ./crun --version RUN mv crun crun-wasm-nodejs -FROM ubuntu:20.04 as ubuntu20builder - -ENV DEBIAN_FRONTEND=noninteractive -ENV TZ=Etc/UTC +FROM quay.io/knawd/libnode:ubuntu20 as ubuntu20builder ENV WASMTIME_VERSION=v5.0.0 -RUN apt update --fix-missing -RUN apt-get install -y curl make git gcc build-essential pkgconf libtool libsystemd-dev libprotobuf-c-dev libcap-dev libseccomp-dev libyajl-dev go-md2man libtool autoconf python3 automake xz-utils RUN curl https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -e all -p /usr/local --version=0.11.2 -RUN git clone --depth 1 --recursive https://github.com/containers/crun.git +WORKDIR / +RUN git clone --depth 1 -b 1.8 --recursive https://github.com/containers/crun.git WORKDIR /crun RUN ./autogen.sh RUN ./configure --with-wasmedge --enable-embedded-yajl @@ -65,11 +54,6 @@ RUN make RUN ./crun --version RUN mv crun crun-wasmtime -WORKDIR /wasm_nodejs -RUN git clone --depth 1 -b napi-libnode https://github.com/mmomtchev/node.git -WORKDIR /wasm_nodejs/node -RUN ./configure --shared -RUN make WORKDIR /wasm_nodejs RUN git clone --depth 1 -b node-wasm-experiment https://github.com/mhdawson/crun.git WORKDIR /wasm_nodejs/crun @@ -84,25 +68,15 @@ RUN make RUN ./crun --version RUN mv crun crun-wasm-nodejs -FROM docker.io/rockylinux/rockylinux:8 as rhel8builder +FROM quay.io/knawd/libnode:rocky8 as rhel8builder ENV WASMTIME_VERSION=v5.0.0 -RUN dnf update -y -RUN dnf install -y dnf-plugins-core -RUN dnf config-manager --set-enabled plus -RUN dnf config-manager --set-enabled devel -RUN dnf config-manager --set-enabled powertools -RUN dnf clean all -RUN dnf update -y -RUN dnf repolist --all -RUN dnf -y install epel-release - -RUN dnf install -y git python3 which redhat-lsb-core RUN curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -e all -p /usr/local --version=0.11.2 RUN dnf install -y systemd-devel yajl-devel libseccomp-devel pkg-config libgcrypt-devel \ glibc-static python3-libmount libtool libcap-devel -WORKDIR "/" -RUN git clone --depth 1 --recursive https://github.com/containers/crun.git +WORKDIR / +RUN git clone --depth 1 -b 1.8 --recursive https://github.com/containers/crun.git WORKDIR /crun + RUN ./autogen.sh RUN ./configure --with-wasmedge --enable-embedded-yajl RUN make @@ -119,11 +93,6 @@ RUN mv crun crun-wasmtime ### wasm_nodejs doesn't use the default crun so we are creating subfolders WORKDIR /wasm_nodejs -RUN git clone --depth 1 -b napi-libnode https://github.com/mmomtchev/node.git -WORKDIR /wasm_nodejs/node -RUN ./configure --shared -RUN make -WORKDIR /wasm_nodejs RUN git clone --depth 1 -b node-wasm-experiment https://github.com/mhdawson/crun.git WORKDIR /wasm_nodejs/crun RUN cp /wasm_nodejs/node/out/Release/libnode.so.* /lib64/libnode.so @@ -137,31 +106,25 @@ RUN make RUN ./crun --version RUN mv crun crun-wasm-nodejs -RUN yum install -y gcc openssl-devel && \ - rm -rf /var/cache/dnf && \ - curl https://sh.rustup.rs -sSf | sh -s -- -y - COPY manager /app-build/ WORKDIR "/app-build" -ENV PATH=/root/.cargo/bin:${PATH} - RUN cargo build --release RUN cargo test --release -FROM registry.access.redhat.com/ubi8:8.7-1054 +FROM registry.access.redhat.com/ubi8:8.7-1054.1675788412 WORKDIR "/vendor/rhel8" -COPY --from=rhel8builder /usr/local/lib/libwasmedge.so.0 /lib64/libnode.so /crun/crun-wasmedge /crun/crun-wasmtime /wasm_nodejs/crun/crun-wasm-nodejs ./ +COPY --from=rhel8builder /usr/local/lib/libwasmedge.so.0 /lib64/libnode.so /usr/local/lib/libwasmtime.so /crun/crun-wasmedge /crun/crun-wasmtime /wasm_nodejs/crun/crun-wasm-nodejs ./ WORKDIR "/vendor/ubuntu_20_04" -COPY --from=ubuntu20builder /usr/local/lib/libwasmedge.so.0 /lib64/libnode.so /crun/crun-wasmedge /crun/crun-wasmtime /wasm_nodejs/crun/crun-wasm-nodejs ./ +COPY --from=ubuntu20builder /usr/local/lib/libwasmedge.so.0 /lib64/libnode.so /usr/local/lib/libwasmtime.so /crun/crun-wasmedge /crun/crun-wasmtime /wasm_nodejs/crun/crun-wasm-nodejs ./ WORKDIR "/vendor/ubuntu_18_04" -COPY --from=ubuntu18builder /usr/local/lib/libwasmedge.so.0 /lib64/libnode.so /crun/crun-wasmedge /crun/crun-wasmtime /wasm_nodejs/crun/crun-wasm-nodejs ./ +COPY --from=ubuntu18builder /usr/local/lib/libwasmedge.so.0 /lib64/libnode.so /usr/local/lib/libwasmtime.so /crun/crun-wasmedge /crun/crun-wasmtime /wasm_nodejs/crun/crun-wasm-nodejs ./ WORKDIR "/app" COPY --from=rhel8builder /app-build/target/release/manager ./ diff --git a/FAQ.md b/FAQ.md new file mode 100644 index 0000000..72e248f --- /dev/null +++ b/FAQ.md @@ -0,0 +1,4 @@ +# Frequently Asked Questions + +* What do I do if I want to change the WASM runtime on a server. + All current WASM workloads will have to be drained from the server as the crun update will not work due to it being locked on the server. \ No newline at end of file diff --git a/README.md b/README.md index 9f44db8..9d62695 100644 --- a/README.md +++ b/README.md @@ -31,12 +31,13 @@ The deployment is performed copying files to 3 locations on each node: ## Supported Versions -|Release|WASMEdge|WASMtime|crun|Ubuntu|OpenShift| -|---|---|---|---|---|---| -|v1.0.0-theta|0.11.2|5.0.0|[main](https://github.com/containers/crun/commit/26fe1383a05279935e67ee31e7ff10c43e7d87ea)|18.04, 20.04|4.10, 4.11| -|v1.0.0-gamma|0.11.2|5.0.0|[main](https://github.com/containers/crun/commit/26fe1383a05279935e67ee31e7ff10c43e7d87ea)|18.04, 20.04|4.10, 4.11| -|v1.0.0-beta|0.11.2|N/A|[main](https://github.com/containers/crun/commit/26fe1383a05279935e67ee31e7ff10c43e7d87ea)|18.04, 20.04|4.10, 4.11| -|v1.0.0-alpha|0.11.2|N/A|[main](https://github.com/containers/crun/commit/26fe1383a05279935e67ee31e7ff10c43e7d87ea)|18.04, 20.04|4.10, 4.11| +|Release|WASMEdge|WASMtime|node-wasm|crun|Ubuntu|OpenShift| +|---|---|---|---|---|---|---| +|v1.0.0-iota|0.11.2|5.0.0|[experiment](https://github.com/mhdawson/crun/commit/23f346e3bc15ec7e6188b405df895aef5a5cbcdd)|[1.8](https://github.com/containers/crun/releases/tag/1.8)|18.04, 20.04|4.10, 4.11| +|v1.0.0-theta|0.11.2|5.0.0|N/A|[main](https://github.com/containers/crun/commit/26fe1383a05279935e67ee31e7ff10c43e7d87ea)|18.04, 20.04|4.10, 4.11| +|v1.0.0-gamma|0.11.2|5.0.0|N/A|[main](https://github.com/containers/crun/commit/26fe1383a05279935e67ee31e7ff10c43e7d87ea)|18.04, 20.04|4.10, 4.11| +|v1.0.0-beta|0.11.2|N/A|N/A|[main](https://github.com/containers/crun/commit/26fe1383a05279935e67ee31e7ff10c43e7d87ea)|18.04, 20.04|4.10, 4.11| +|v1.0.0-alpha|0.11.2|N/A|N/A|[main](https://github.com/containers/crun/commit/26fe1383a05279935e67ee31e7ff10c43e7d87ea)|18.04, 20.04|4.10, 4.11| N.B. Red Hat Core OS based instances have still to be tested and we expect some issues modifying the crio config and copying the WASM libs to the host. diff --git a/charts/knawd-deployer/Chart.yaml b/charts/knawd-deployer/Chart.yaml index afd31dc..8fe60dd 100644 --- a/charts/knawd-deployer/Chart.yaml +++ b/charts/knawd-deployer/Chart.yaml @@ -11,9 +11,9 @@ sources: type: application -version: v1.0.0-theta +version: v1.0.0-mu -appVersion: "v1.0.0-theta" +appVersion: "v1.0.0-mu" # icon: https://raw.githubusercontent.com/No9/core-dump-handler/master/assets/handle-with-care-svgrepo-com.svg @@ -25,13 +25,13 @@ maintainers: annotations: artifacthub.io/changes: | - kind: added - description: Streamline the chart options + description: Streamline builds and support for wasm nodejs links: - name: GitHub PR - url: https://github.com/knawd/deployer/pull/7 + url: https://github.com/knawd/deployer/pull/8 artifacthub.io/images: | - name: knawd-deployer - image: quay.io/knawd/deployer:v1.0.0-beta + image: quay.io/knawd/deployer:v1.0.0-mu artifacthub.io/license: MIT artifacthub.io/signKey: | fingerprint: BED079E67FD431E45301B1C9949E671B46AC8A34 diff --git a/charts/knawd-deployer/README.md b/charts/knawd-deployer/README.md index a0d6258..904120a 100644 --- a/charts/knawd-deployer/README.md +++ b/charts/knawd-deployer/README.md @@ -44,5 +44,5 @@ These are the values particular to the deployer service. **tag**: The tag in the repository where the image is located used to specifiy a custom image (default: latest) **autoRestart**: Should the deployer automatically restart the CRI service? Required for the config to be applied (default: true) **logLevel**: The log level. Supported options `info`, `error`, `warn`, `debug` (default: "info") -**ociType**: The type of the OCI Runtime to deploy. Currently `crun-wasmedge` and `crun-wasmtime` are supported (default: "crun-wasmedge") +**ociType**: The type of the OCI Runtime to deploy. Currently `crun-wasmedge`, `crun-wasmtime` and `crun-wasm-nodejs` are supported (default: "crun-wasmedge") **patchKnative**: Runs the patch to enable setting the runtime in a knative service definition. diff --git a/charts/knawd-deployer/templates/rbac.yaml b/charts/knawd-deployer/templates/rbac.yaml index cb8b7d6..c931a84 100644 --- a/charts/knawd-deployer/templates/rbac.yaml +++ b/charts/knawd-deployer/templates/rbac.yaml @@ -1,4 +1,3 @@ -{{- if eq .Values.target "rhel8" }} --- kind: Role apiVersion: rbac.authorization.k8s.io/v1 @@ -73,5 +72,4 @@ roleRef: kind: ClusterRole name: knawd-cluster-role apiGroup: rbac.authorization.k8s.io -{{- end }} {{- end }} \ No newline at end of file diff --git a/charts/knawd-deployer/values.schema.json b/charts/knawd-deployer/values.schema.json index 2c09600..e7a79af 100644 --- a/charts/knawd-deployer/values.schema.json +++ b/charts/knawd-deployer/values.schema.json @@ -21,6 +21,8 @@ "enum": [ "v1.0.0-gamma", "v1.0.0-theta", + "v1.0.0-iota", + "v1.0.0-mu", "latest" ], "default": "latest" @@ -42,7 +44,8 @@ "type": "string", "enum": [ "crun-wasmedge", - "crun-wasmtime" + "crun-wasmtime", + "crun-wasm-nodejs" ] }, "default": "crun-wasmedge" diff --git a/charts/knawd-deployer/values.yaml b/charts/knawd-deployer/values.yaml index a0babb9..effb921 100644 --- a/charts/knawd-deployer/values.yaml +++ b/charts/knawd-deployer/values.yaml @@ -1,5 +1,5 @@ target: rhel8 -tag: v1.0.0-theta +tag: v1.0.0-mu autoRestart: true logLevel: "info" ociType: "crun-wasmedge" diff --git a/manager/src/bin/manager.rs b/manager/src/bin/manager.rs index c5df003..d61c917 100644 --- a/manager/src/bin/manager.rs +++ b/manager/src/bin/manager.rs @@ -9,7 +9,7 @@ static VENDOR_BASE: &str = "vendor"; #[allow(clippy::while_immutable_condition)] #[tokio::main] async fn main() -> Result<(), std::io::Error> { - let mut lib_files = vec!["libwasmedge.so.0"]; + let mut lib_files = vec![]; // An output test so the build can be validated if env::args().count() >= 2 && env::args().nth(1) != Some("remove".to_string()) { @@ -46,8 +46,14 @@ async fn main() -> Result<(), std::io::Error> { no_path_exit(&config_location); no_path_exit(&oci_location); + if oci_type == *"crun-wasmedge" { + lib_files.push("libwasmedge.so.0"); + } + if oci_type == *"crun-wasmtime" { + lib_files.push("libwasmtime.so"); + } + if oci_type == *"crun-wasm-nodejs" { - //let mut libnode = "libnode.so"; lib_files.push("libnode.so"); } let auto_restart = env::var("AUTO_RESTART") @@ -131,13 +137,14 @@ async fn main() -> Result<(), std::io::Error> { manager::copy_to(VENDOR_BASE, oci_location.as_str(), &vendor, &oci_type)?; let full_oci_location = format!("{oci_location}/crun"); + let host_oci_location = full_oci_location.replace(&node_root, ""); match vendor.as_str() { "rhel8" => { for file_name in &lib_files { manager::copy_to(VENDOR_BASE, lib_location.as_str(), &vendor, file_name)?; } let crio_file = format!("{config_location}/crio.conf"); - manager::update_crio_config(crio_file.as_str(), full_oci_location.as_str())?; + manager::update_crio_config(crio_file.as_str(), host_oci_location.as_str())?; if auto_restart { manager::restart_oci_runtime(node_root, is_micro_k8s, "crio".to_string())?; } @@ -147,7 +154,7 @@ async fn main() -> Result<(), std::io::Error> { manager::copy_to(VENDOR_BASE, lib_location.as_str(), &vendor, file_name)? } let toml_file = format!("{config_location}/config.toml"); - manager::update_containerd_config(toml_file.as_str(), full_oci_location.as_str())?; + manager::update_containerd_config(toml_file.as_str(), host_oci_location.as_str())?; if auto_restart { manager::restart_oci_runtime(node_root, is_micro_k8s, "containerd".to_string())?; } diff --git a/manager/src/lib.rs b/manager/src/lib.rs index 078c01f..16677e3 100644 --- a/manager/src/lib.rs +++ b/manager/src/lib.rs @@ -19,12 +19,14 @@ pub fn copy_to( vendor: &str, file_name: &str, ) -> Result<(), std::io::Error> { - let location = format!("{vendor_base}/{vendor}/{file_name}"); + let location = format!("/{vendor_base}/{vendor}/{file_name}"); // Really software development is just about how neatly you can throw things away. // Here we are selecting which type of crun to deploy let destination: String = match file_name { - "crun-wasmedge" | "crun-wasmtime" => format!("{destination_base}/crun"), + "crun-wasmedge" | "crun-wasmtime" | "crun-wasm-nodejs" => { + format!("{destination_base}/crun") + } _ => format!("{destination_base}/{file_name}"), };