]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: add extra_container_args and custom_configs to CustomContainer
authorAdam King <adking@redhat.com>
Mon, 19 Jun 2023 19:46:45 +0000 (15:46 -0400)
committerAdam King <adking@redhat.com>
Tue, 5 Mar 2024 14:27:29 +0000 (09:27 -0500)
CustomContainer was skipped previously for the extra_container_args
and custom_configs feature as these could already be done
using other fields within the custom container service spec
(the "args" and "files" fields respectively). It seems
desirable for us to allow setting these things for custom
containers the same as for other services for uniformity sake
and this allows us to use custom containers to test
these features.

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit b66892a668d487f4b7ede147eb8855d166c3d1f9)

Conflicts:
src/python-common/ceph/deployment/service_spec.py

src/python-common/ceph/deployment/service_spec.py

index dae71c84f7631d6e068c5067203666241594988c..a8acf839f7d09a36f6fe739a8831b281ef2db8a5 100644 (file)
@@ -1120,7 +1120,6 @@ class CustomContainerSpec(ServiceSpec):
                  preview_only: bool = False,
                  image: Optional[str] = None,
                  entrypoint: Optional[str] = None,
-                 extra_entrypoint_args: Optional[List[str]] = None,
                  uid: Optional[int] = None,
                  gid: Optional[int] = None,
                  volume_mounts: Optional[Dict[str, str]] = {},
@@ -1131,6 +1130,9 @@ class CustomContainerSpec(ServiceSpec):
                  ports: Optional[List[int]] = [],
                  dirs: Optional[List[str]] = [],
                  files: Optional[Dict[str, Any]] = {},
+                 extra_container_args: Optional[List[str]] = None,
+                 extra_entrypoint_args: Optional[List[str]] = None,
+                 custom_configs: Optional[List[CustomConfig]] = None,
                  ):
         assert service_type == 'container'
         assert service_id is not None
@@ -1140,7 +1142,9 @@ class CustomContainerSpec(ServiceSpec):
             service_type, service_id,
             placement=placement, unmanaged=unmanaged,
             preview_only=preview_only, config=config,
-            networks=networks, extra_entrypoint_args=extra_entrypoint_args)
+            networks=networks, extra_container_args=extra_container_args,
+            extra_entrypoint_args=extra_entrypoint_args,
+            custom_configs=custom_configs)
 
         self.image = image
         self.entrypoint = entrypoint
@@ -1173,6 +1177,19 @@ class CustomContainerSpec(ServiceSpec):
                 config_json[prop] = value
         return config_json
 
+    def validate(self) -> None:
+        super(CustomContainerSpec, self).validate()
+
+        if self.args and self.extra_container_args:
+            raise SpecValidationError(
+                '"args" and "extra_container_args" are mutually exclusive '
+                '(and both serve the same purpose)')
+
+        if self.files and self.custom_configs:
+            raise SpecValidationError(
+                '"files" and "custom_configs" are mutually exclusive '
+                '(and both serve the same purpose)')
+
 
 yaml.add_representer(CustomContainerSpec, ServiceSpec.yaml_representer)