diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ae8e22..1e70eda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.2.7 +* Add image pull secret for image processor + ## 1.2.6 * Allow defining process properties from config for ImageProcessor diff --git a/pygeoapi_kubernetes_papermill/image.py b/pygeoapi_kubernetes_papermill/image.py index 2cf8d8e..92e78ae 100644 --- a/pygeoapi_kubernetes_papermill/image.py +++ b/pygeoapi_kubernetes_papermill/image.py @@ -99,7 +99,7 @@ def __init__(self, processor_def: dict) -> None: self.default_image: str = processor_def["default_image"] self.command: str = processor_def["command"] self.allowed_images_regex: str = processor_def["allowed_images_regex"] - # self.image_pull_secret: str = processor_def["image_pull_secret"] + self.image_pull_secret: str = processor_def["image_pull_secret"] self.s3: Optional[dict[str, str]] = processor_def.get("s3") self.extra_volumes: list = processor_def["extra_volumes"] self.extra_volume_mounts: list = processor_def["extra_volume_mounts"] @@ -128,6 +128,11 @@ def create_job_pod_spec( extra_config = self._extra_configs() extra_podspec = self._extra_podspec(requested) + if self.image_pull_secret: + extra_podspec["image_pull_secrets"] = [ + k8s_client.V1LocalObjectReference(name=self.image_pull_secret) + ] + image_container = k8s_client.V1Container( name="notebook", image=self.default_image, diff --git a/tests/test_image_processor.py b/tests/test_image_processor.py index 8699f2a..7e058db 100644 --- a/tests/test_image_processor.py +++ b/tests/test_image_processor.py @@ -52,6 +52,7 @@ def _create_processor(def_override=None): "extra_volume_mounts": [], "node_purpose_label_key": "", "default_node_purpose": "", + "image_pull_secret": "", "allowed_node_purposes_regex": "", "tolerations": [], "allow_fargate": False,