]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephadm: add more ContainerDeamonForm methods to the keepalived class
authorJohn Mulligan <jmulligan@redhat.com>
Fri, 20 Oct 2023 22:55:17 +0000 (18:55 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 14 Nov 2023 21:05:48 +0000 (16:05 -0500)
Add methods customize_{container_args,container_envs} to the keepalived
daemon type class. Use those methods in the get_container function.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/cephadm.py

index ba2dc68bdd0b03d87f6cecafe380f725bef454f0..242f2fa35cab80bb563200e93f2110cb3a8569d5 100755 (executable)
@@ -1756,6 +1756,16 @@ class Keepalived(ContainerDaemonForm):
         ctr = get_container(ctx, self.identity)
         return to_deployment_container(ctx, ctr)
 
+    def customize_container_envs(
+        self, ctx: CephadmContext, envs: List[str]
+    ) -> None:
+        envs.extend(self.get_container_envs())
+
+    def customize_container_args(
+        self, ctx: CephadmContext, args: List[str]
+    ) -> None:
+        args.extend(['--cap-add=NET_ADMIN', '--cap-add=NET_RAW'])
+
 
 ##################################
 
@@ -2905,9 +2915,9 @@ def get_container(
         d_args.extend(haproxy.get_daemon_args())
         mounts = get_container_mounts(ctx, ident)
     elif daemon_type == Keepalived.daemon_type:
-        name = ident.daemon_name
-        envs.extend(Keepalived.get_container_envs())
-        container_args.extend(['--cap-add=NET_ADMIN', '--cap-add=NET_RAW'])
+        keepalived = Keepalived.create(ctx, ident)
+        keepalived.customize_container_envs(ctx, envs)
+        keepalived.customize_container_args(ctx, container_args)
         mounts = get_container_mounts(ctx, ident)
     elif daemon_type == CephNvmeof.daemon_type:
         nvmeof = CephNvmeof.create(ctx, ident)