From cd2c45e4792123415a25732653d99e42138210b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilhem=20Barth=C3=A9s?= Date: Wed, 10 Apr 2024 19:00:21 +1000 Subject: [PATCH] fix: add ca-certificate creation on startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Guilhem Barthés --- backend/substrapp/apps.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/substrapp/apps.py b/backend/substrapp/apps.py index ae6807f94..59e17f274 100644 --- a/backend/substrapp/apps.py +++ b/backend/substrapp/apps.py @@ -1,6 +1,11 @@ +import kubernetes + from django.apps import AppConfig +from django.conf import settings from django.db.models.signals import post_delete +from substrapp.kubernetes_utils import create_replace_private_ca_secret + class SubstrappConfig(AppConfig): name = "substrapp" @@ -18,3 +23,8 @@ def ready(self): post_delete.connect(function_post_delete, sender=Function) post_delete.connect(datamanager_post_delete, sender=DataManager) post_delete.connect(model_post_delete, sender=Model) + + if settings.TASK["PRIVATE_CA_ENABLED"]: + kubernetes.config.load_incluster_config() + k8s_client = kubernetes.client.CoreV1Api() + create_replace_private_ca_secret(k8s_client)