From 14dd439ce85eeff516c1c52625499e3a000cb655 Mon Sep 17 00:00:00 2001 From: Matej Marusak Date: Thu, 4 Aug 2022 12:51:44 +0200 Subject: [PATCH] Add annotation that cockpit created given container This helps us to recognize such containers and we can later better distinguish whether we can safely recreate it or not. --- src/ImageRunModal.jsx | 2 +- test/check-application | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ImageRunModal.jsx b/src/ImageRunModal.jsx index 7ba047199..01b1c1162 100644 --- a/src/ImageRunModal.jsx +++ b/src/ImageRunModal.jsx @@ -363,7 +363,7 @@ export class ImageRunModal extends React.Component { } getCreateConfig() { - const createConfig = {}; + const createConfig = { annotations: { created_by: "cockpit" } }; if (this.props.pod) { createConfig.pod = this.props.pod.Id; diff --git a/test/check-application b/test/check-application index 3704388ed..34d7adca5 100755 --- a/test/check-application +++ b/test/check-application @@ -1543,6 +1543,8 @@ class TestApplication(testlib.MachineCase): state='Running', owner="system" if auth else "admin") hasTTY = self.execute(auth, "podman inspect --format '{{.Config.Tty}}' busybox-with-tty").strip() self.assertEqual(hasTTY, 'true') + annotated = self.execute(auth, "podman inspect --format '{{.Config.Annotations.created_by}}' busybox-with-tty").strip() + self.assertEqual(annotated, 'cockpit') # Only works with CGroupsV2 if auth or self.has_cgroupsV2: memory = self.execute(auth, "podman inspect --format '{{.HostConfig.Memory}}' busybox-with-tty").strip()