From e7d7e5d668a70d404d6d8947a29d26a5215ae2a6 Mon Sep 17 00:00:00 2001 From: Fabrice Brito Date: Thu, 22 Jan 2026 15:04:27 +0100 Subject: [PATCH 1/7] bumps to 1.5.1 --- release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.yaml b/release.yaml index c957577..b88c61f 100644 --- a/release.yaml +++ b/release.yaml @@ -1,4 +1,4 @@ image_name: application-hub image_prefix: eoepca -image_version: 1.5.0 +image_version: 1.5.1 image_registry: ghcr.io \ No newline at end of file From 152ba12e122ecc5721ee9b5ccb8ccf5d116cf626 Mon Sep 17 00:00:00 2001 From: Fabrice Brito Date: Mon, 26 Jan 2026 11:51:36 +0100 Subject: [PATCH 2/7] fixes config parser --- application_hub_context/parser.py | 55 +++++++++++++++++++++---------- setup.cfg | 2 +- 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/application_hub_context/parser.py b/application_hub_context/parser.py index 64e37c9..0f63dac 100644 --- a/application_hub_context/parser.py +++ b/application_hub_context/parser.py @@ -11,26 +11,47 @@ def __init__(self, config_data, user_groups): self.config = Config(**config_data) self.user_groups = user_groups + @classmethod + def _render_templates(cls, obj, context): + """Recursively render Jinja templates in strings only.""" + if isinstance(obj, str): + if "{{" in obj: + return Template(obj).render(**context) + return obj + + if isinstance(obj, list): + return [cls._render_templates(i, context) for i in obj] + + if isinstance(obj, dict): + return { + k: cls._render_templates(v, context) + for k, v in obj.items() + } + + return obj + @classmethod def read_file(cls, config_path, user_groups, spawner, namespace): - """reads a config file encoded in YAML""" with open(config_path, "r") as stream: - try: - # Read the file as a raw string - raw_content = stream.read() - - # Render the content as a Jinja2 template - template = Template(raw_content) - rendered_content = template.render(spawner=spawner, - namespace=namespace) - - # Parse the rendered content as YAML - config_data = yaml.safe_load(rendered_content) - - except yaml.YAMLError as exc: - print(f"YAML Error: {exc}") - except Exception as e: - print(f"Error: {e}") + raw_content = stream.read() + + try: + # Parse YAML first (SAFE) + config_data = yaml.safe_load(raw_content) + + # Render templates selectively + context = { + "spawner": spawner, + "namespace": namespace, + } + config_data = cls._render_templates(config_data, context) + + except yaml.YAMLError as exc: + raise RuntimeError(f"Invalid YAML in {config_path}: {exc}") from exc + except Exception as exc: + raise RuntimeError( + f"Error processing config file {config_path}: {exc}" + ) from exc return cls(config_data=config_data, user_groups=user_groups) diff --git a/setup.cfg b/setup.cfg index 135c20e..bdd13ef 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,4 +1,4 @@ [metadata] name = application-context-hub -version = 1.3.3 +version = 1.5.2 From 3720b18b0b11bdbe16f15277c235c1948497808a Mon Sep 17 00:00:00 2001 From: Fabrice Brito Date: Mon, 26 Jan 2026 15:17:22 +0100 Subject: [PATCH 3/7] bumps to 1.5.2 --- release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.yaml b/release.yaml index b88c61f..2b900aa 100644 --- a/release.yaml +++ b/release.yaml @@ -1,4 +1,4 @@ image_name: application-hub image_prefix: eoepca -image_version: 1.5.1 +image_version: 1.5.2 image_registry: ghcr.io \ No newline at end of file From e75bb23ccde1db08657cb7aa8e520d71a88376c3 Mon Sep 17 00:00:00 2001 From: Fabrice Brito Date: Tue, 27 Jan 2026 11:00:43 +0100 Subject: [PATCH 4/7] fixes rolebinding issue --- application_hub_context/app_hub_context.py | 7 +++---- release.yaml | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/application_hub_context/app_hub_context.py b/application_hub_context/app_hub_context.py index e60c92e..7c88fd6 100644 --- a/application_hub_context/app_hub_context.py +++ b/application_hub_context/app_hub_context.py @@ -377,7 +377,7 @@ def delete_role_binding(self, role_binding: RoleBinding): f"Exception deleting role {role_binding.role.name}: {e}\n" ) - def create_role_binding(self, name: str, subjects: [Subject], role: Role): + def create_role_binding(self, name: str, subjects: list[Subject], role: Role): if self.is_role_binding_created(name=name): return self.rbac_authorization_v1_api.read_namespaced_role_binding( name=name, namespace=self.namespace @@ -385,12 +385,11 @@ def create_role_binding(self, name: str, subjects: [Subject], role: Role): metadata = client.V1ObjectMeta(name=name, namespace=self.namespace) - role_ref = client.V1RoleRef(api_group="", kind="Role", name=role.name) + role_ref = client.V1RoleRef(api_group="rbac.authorization.k8s.io", kind="Role", name=role.name) subject_list = [] for subject in subjects: - subject = client.models.V1Subject( - api_group="", + subject = client.models.V1RoleBindingSubject( kind=subject.kind.value, name=subject.name, namespace=self.namespace, diff --git a/release.yaml b/release.yaml index 2b900aa..05c148a 100644 --- a/release.yaml +++ b/release.yaml @@ -1,4 +1,4 @@ image_name: application-hub image_prefix: eoepca -image_version: 1.5.2 +image_version: 1.5.3 image_registry: ghcr.io \ No newline at end of file From 15421e78ff68a7259607e12885f5ecb76f037a0f Mon Sep 17 00:00:00 2001 From: Fabrice Brito Date: Tue, 27 Jan 2026 11:45:05 +0100 Subject: [PATCH 5/7] fixes rolebinding --- application_hub_context/app_hub_context.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/application_hub_context/app_hub_context.py b/application_hub_context/app_hub_context.py index 7c88fd6..3c8e0f0 100644 --- a/application_hub_context/app_hub_context.py +++ b/application_hub_context/app_hub_context.py @@ -389,11 +389,11 @@ def create_role_binding(self, name: str, subjects: list[Subject], role: Role): subject_list = [] for subject in subjects: - subject = client.models.V1RoleBindingSubject( - kind=subject.kind.value, - name=subject.name, - namespace=self.namespace, - ) + subject = { + "kind": subject.kind.value, + "name": subject.name, + "namespace": self.namespace, + } subject_list.append(subject) body = client.V1RoleBinding( From 9f5f24a9d67f1033f9f4e442a4447e646701fbb8 Mon Sep 17 00:00:00 2001 From: Fabrice Brito Date: Tue, 27 Jan 2026 15:55:16 +0100 Subject: [PATCH 6/7] fixes issue in env_from key --- application_hub_context/app_hub_context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application_hub_context/app_hub_context.py b/application_hub_context/app_hub_context.py index 3c8e0f0..025d3ee 100644 --- a/application_hub_context/app_hub_context.py +++ b/application_hub_context/app_hub_context.py @@ -1023,7 +1023,7 @@ def initialise(self): ) self.spawner.log.info(f"env_from_secrets {env_from_secrets}") if env_from_secrets: - if self.spawner.extra_container_config["env_from"] is None: + if self.spawner.extra_container_config.get("env_from") is None: self.spawner.extra_container_config["env_from"] = [] for env_from_secret in env_from_secrets: From 62e41cc67ea6e321b42ee59be48130f46a29819b Mon Sep 17 00:00:00 2001 From: Fabrice Brito Date: Tue, 27 Jan 2026 16:57:51 +0100 Subject: [PATCH 7/7] sets release to 1.5.2 --- release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.yaml b/release.yaml index 05c148a..2b900aa 100644 --- a/release.yaml +++ b/release.yaml @@ -1,4 +1,4 @@ image_name: application-hub image_prefix: eoepca -image_version: 1.5.3 +image_version: 1.5.2 image_registry: ghcr.io \ No newline at end of file