From 3768dba607cd89893e3cda09cc6814ee215fa7eb Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Sun, 5 Nov 2023 07:18:55 -0500 Subject: [PATCH] cephadm: add more ContainerDeamonForm methods to the custom container class Add methods customize_{process_args,container_envs,container_args} and default_entrypoint to the custom container daemon type class. Use those methods in the get_container function. Signed-off-by: John Mulligan --- src/cephadm/cephadm.py | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index 8225553c927..2b30e2563ed 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -1981,6 +1981,24 @@ class CustomContainer(ContainerDaemonForm): if deployment_type == DeploymentType.DEFAULT: endpoints.extend([EndPoint('0.0.0.0', p) for p in self.ports]) + 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(self.get_container_args()) + + def customize_process_args( + self, ctx: CephadmContext, args: List[str] + ) -> None: + args.extend(self.get_daemon_args()) + + def default_entrypoint(self) -> str: + return self.entrypoint or '' + def uid_gid(self, ctx: CephadmContext) -> Tuple[int, int]: return self.uid, self.gid @@ -2898,11 +2916,11 @@ def get_container( mounts = get_container_mounts(ctx, ident) elif daemon_type == CustomContainer.daemon_type: cc = CustomContainer.init(ctx, ident.fsid, ident.daemon_id) - entrypoint = cc.entrypoint or '' + entrypoint = cc.default_entrypoint() host_network = False - envs.extend(cc.get_container_envs()) - container_args.extend(cc.get_container_args()) - d_args.extend(cc.get_daemon_args()) + cc.customize_container_envs(ctx, envs) + cc.customize_container_args(ctx, container_args) + cc.customize_process_args(ctx, d_args) binds = get_container_binds(ctx, ident) mounts = get_container_mounts(ctx, ident) elif daemon_type == SNMPGateway.daemon_type: -- 2.47.3