Skip to content

Commit

Permalink
kata: support large ConfigMaps
Browse files Browse the repository at this point in the history
  • Loading branch information
burgerdev committed Nov 21, 2024
1 parent 187ea01 commit c432201
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Markus Rudy <[email protected]>
Date: Thu, 21 Nov 2024 19:54:09 +0100
Subject: [PATCH] genpolicy: allow non-watchable ConfigMaps

If a ConfigMap has more than 8 files it will not be mounted watchable
[1]. However, genpolicy assumes that ConfigMaps are always mounted at a
watchable path, so containers with large ConfigMap mounts fail
verification.

This commit allows mounting ConfigMaps from watchable and non-watchable
directories. ConfigMap mounts can't be meaningfully verified anyway, so
the exact location of the data does not matter, except that we stay in
the sandbox data dirs.

[1]: https://github.com/kata-containers/kata-containers/blob/0ce3f5fc6fd86c53d8b5e197d12887b712ce57d4/docs/design/inotify.md?plain=1#L11-L21

Signed-off-by: Markus Rudy <[email protected]>
---
src/tools/genpolicy/genpolicy-settings.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tools/genpolicy/genpolicy-settings.json b/src/tools/genpolicy/genpolicy-settings.json
index e3b36a6555a646ffefc7733c807d6b0da9967dea..e854a79f149307b92914cb2b2880e710bf44eab2 100644
--- a/src/tools/genpolicy/genpolicy-settings.json
+++ b/src/tools/genpolicy/genpolicy-settings.json
@@ -179,7 +179,7 @@
"configMap": {
"mount_type": "bind",
"mount_source": "$(sfprefix)",
- "mount_point": "^$(cpath)/watchable/$(bundle-id)-[a-z0-9]{16}-",
+ "mount_point": "^$(cpath)/(watchable/)?$(bundle-id)-[a-z0-9]{16}-",
"driver": "watchable-bind",
"fstype": "bind",
"options": [
5 changes: 5 additions & 0 deletions packages/by-name/kata/kata-runtime/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ buildGoModule rec {
./0014-kata-sys-util-remove-obsolete-cgroups-dependency.patch
./0015-kata-sys-util-move-json-parsing-to-protocols-crate.patch
./0016-protocols-only-build-RLimit-impls-on-Linux.patch

# Fixes a bug with ConfigMaps exceeding 8 entries, see description.
# TODO(burgerdev): report upstream
# TODO(burgerdev): backport
./0017-genpolicy-allow-non-watchable-ConfigMaps.patch
];
};

Expand Down

0 comments on commit c432201

Please sign in to comment.