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)