Skip to content

Commit

Permalink
Add annotations for sysbox pods (#1229)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljguarino authored Aug 30, 2023
1 parent 13d5bd7 commit 875f62c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/core/lib/core/services/shell/pods.ex
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ defmodule Core.Services.Shell.Pods do
metadata: %MetaV1.ObjectMeta{
name: name,
namespace: @ns,
annotations: %{"platform.plural.sh/expire-after" => "6h", "platform.plural.sh/shell-email" => email},
annotations: Map.merge(
%{"platform.plural.sh/expire-after" => "6h", "platform.plural.sh/shell-email" => email},
annotations(runtime)
),
labels: %{"app.plural.sh/type" => "shell"}
},
spec: %CoreV1.PodSpec{
Expand All @@ -79,6 +82,9 @@ defmodule Core.Services.Shell.Pods do
}
end

defp annotations("sysbox-runc"), do: %{"io.kubernetes.cri-o.userns-mode" => "auto:size=65536"}
defp annotations(_), do: %{}

defp node_selector("sysbox-runc"), do: %{"sysbox-runtime" => "running"}
defp node_selector(_), do: %{"platform.plural.sh/instance-class" => "shell"}

Expand Down
1 change: 1 addition & 0 deletions apps/core/test/services/shell/pods_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ defmodule Core.Shell.PodsTest do
test "a whitelisted user gets the sysbox class" do
%{spec: %{volumes: [volume]}} = pod = Pods.pod("plrl-shell-1", "[email protected]")

assert pod.metadata.annotations["io.kubernetes.cri-o.userns-mode"] == "auto:size=65536"
assert pod.spec.runtime_class_name == "sysbox-runc"
assert pod.spec.node_selector["sysbox-runtime"] == "running"

Expand Down

0 comments on commit 875f62c

Please sign in to comment.