wasmCloud / krustlet-wasmcloud-provider

Kubernetes Rust Kubelet provider for wasmCloud
https://krustlet.dev
Apache License 2.0
15 stars 4 forks source link

Unable to start 2 pods at once #2

Open elebeaup opened 3 years ago

elebeaup commented 3 years ago

Hi, I'm able to run the "hello-world-assemblyscript" without issue. But, when I tried running 2 pods at once (the same wasm module but in two differents pod with different ports), I have the following issue :

Pod hello-world-wasmcloud-assemblyscript-2 container hello-world-wasmcloud-assemblyscript-2 transitioning to Terminated { message: "Pod hello-world-wasmcloud-assemblyscript-2 container hello-world-wasmcloud-assemblyscript-2 failed to start wasmCloud actor: Failed to add File System capability: Cannot start already running provider VA3XZJXPRTT7J7XXJE24LMPK7HQR73W2TOZSJ64ZZMO4YWMIO2SB3IB2", failed: true }.

Maybe, we shouldn't not start again the same capacity provider if it is already loaded but only link the new actor and the provider.

Below are the pod definitions :

apiVersion: v1
kind: Pod
metadata:
  name: hello-world-wasmcloud-assemblyscript
spec:
  containers:
    - name: hello-world-wasmcloud-assemblyscript
      image: webassembly.azurecr.io/hello-world-wasmcloud-assemblyscript:v0.2.0
      ports:
        - containerPort: 9090
          hostPort: 9190
  nodeSelector:
    kubernetes.io/arch: wasm32-wasmcloud
  tolerations:
    - key: "kubernetes.io/arch"
      operator: "Equal"
      value: "wasm32-wasmcloud"
      effect: "NoExecute"
    - key: "kubernetes.io/arch"
      operator: "Equal"
      value: "wasm32-wasmcloud"
      effect: "NoSchedule"

---

apiVersion: v1
kind: Pod
metadata:
  name: hello-world-wasmcloud-assemblyscript-2
spec:
  containers:
    - name: hello-world-wasmcloud-assemblyscript-2
      image: webassembly.azurecr.io/hello-world-wasmcloud-assemblyscript:v0.2.0
      ports:
        - containerPort: 9091
          hostPort: 9191
  nodeSelector:
    kubernetes.io/arch: wasm32-wasmcloud
  tolerations:
    - key: "kubernetes.io/arch"
      operator: "Equal"
      value: "wasm32-wasmcloud"
      effect: "NoExecute"
    - key: "kubernetes.io/arch"
      operator: "Equal"
      value: "wasm32-wasmcloud"
      effect: "NoSchedule"
brooksmtownsend commented 3 years ago

cc @thomastaylor312

thomastaylor312 commented 3 years ago

FYI I am working on this, but it lead to some bigger discussion with @brooksmtownsend and @autodidaddict about how things like this should be architected

autodidaddict commented 3 years ago

See 195 in the wasmCloud repository for the RFC that should solve this problem.

autodidaddict commented 3 years ago

tl;dr : image: webassembly.azurecr.io/hello-world-wasmcloud-assemblyscript:v0.2.0 this attempts to run multiple copies of the same actor on the same node (wasmCloud host), which triggers the multi-tenancy issue discussed in the previously linked item.