From f0a0fba2b5c0225c365c14515fae63df9e07fca5 Mon Sep 17 00:00:00 2001
From: MoritzWeber0 <kontakt@moritz-weber.net>
Date: Thu, 11 Aug 2022 16:43:42 +0200
Subject: [PATCH 1/4] feat: add cdo port for importer scripts

---
 backend/t4cclient/extensions/backups/ease/routes.py | 1 +
 helm/config/backend.yaml                            | 1 +
 helm/values.yaml                                    | 1 +
 3 files changed, 3 insertions(+)

diff --git a/backend/t4cclient/extensions/backups/ease/routes.py b/backend/t4cclient/extensions/backups/ease/routes.py
index 5a6e361ae..e312a2dcf 100644
--- a/backend/t4cclient/extensions/backups/ease/routes.py
+++ b/backend/t4cclient/extensions/backups/ease/routes.py
@@ -73,6 +73,7 @@ def create_backup(
             "GIT_REPO_BRANCH": gitmodel.revision,
             "T4C_REPO_HOST": config["modelsources"]["t4c"]["host"],
             "T4C_REPO_PORT": config["modelsources"]["t4c"]["port"],
+            "T4C_CDO_PORT": config["modelsources"]["t4c"]["cdoPort"],
             "T4C_REPO_NAME": project,
             "T4C_PROJECT_NAME": t4cmodel.name,
             "T4C_USERNAME": username,
diff --git a/helm/config/backend.yaml b/helm/config/backend.yaml
index a1cdc9e1b..dcb6ba91c 100644
--- a/helm/config/backend.yaml
+++ b/helm/config/backend.yaml
@@ -76,6 +76,7 @@ modelsources:
 
     host: "{{ .Values.t4cServer.host }}"
     port: "{{ .Values.t4cServer.port }}"
+    cdoPort: "{{ .Values.t4cServer.cdoPort }}"
     licence: "{{ .Values.t4cServer.licenseKey }}"
 
 backups:
diff --git a/helm/values.yaml b/helm/values.yaml
index a0f357436..9051bc7e0 100644
--- a/helm/values.yaml
+++ b/helm/values.yaml
@@ -177,6 +177,7 @@ t4cServer:
   # IPv4 Address of the T4C Server
   host: localhost
   port: 2036
+  cdoPort: 12036
   licenseKey: tbd
 
 jenkins:

From 1f54b822a36b012c71f9f4135537c5cf10c133db Mon Sep 17 00:00:00 2001
From: MoritzWeber0 <kontakt@moritz-weber.net>
Date: Thu, 11 Aug 2022 17:03:19 +0200
Subject: [PATCH 2/4] build: add importer to Makefile

---
 Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 0580d0994..3816fc6b3 100644
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,10 @@ capella: capella-download
 	docker build -t base capella-dockerimages/base
 	docker build -t capella/base capella-dockerimages/capella
 
+importer:
+	docker build -t t4c/client/importer -t $(LOCAL_REGISTRY_NAME):$(REGISTRY_PORT)/t4c/client/importer capella-dockerimages/importer
+	docker push $(LOCAL_REGISTRY_NAME):$(REGISTRY_PORT)/t4c/client/importer
+
 capella/remote: capella
 	docker build -t capella/remote -t $(LOCAL_REGISTRY_NAME):$(REGISTRY_PORT)/t4c/client/remote capella-dockerimages/remote
 	docker push $(LOCAL_REGISTRY_NAME):$(REGISTRY_PORT)/t4c/client/remote
@@ -72,7 +76,7 @@ capella-dockerimages: capella t4c-client readonly ease
 deploy: backend frontend capella/remote docs mock helm-deploy open rollout
 
 # Deploy with full T4C support:
-deploy-t4c: backend frontend capella t4c-client readonly ease docs mock helm-deploy open rollout
+deploy-t4c: backend frontend capella t4c-client importer readonly ease docs mock helm-deploy open rollout
 
 helm-deploy:
 	k3d cluster list $(CLUSTER_NAME) 2>&- || $(MAKE) create-cluster

From 69997889be6ecf20d519f57a93a231928b2d85f7 Mon Sep 17 00:00:00 2001
From: MoritzWeber0 <kontakt@moritz-weber.net>
Date: Thu, 11 Aug 2022 17:40:57 +0200
Subject: [PATCH 3/4] fix: make timeout configurable and increase default
 timeout

---
 backend/t4cclient/sessions/operators/k8s.py | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/backend/t4cclient/sessions/operators/k8s.py b/backend/t4cclient/sessions/operators/k8s.py
index 27473151d..e6fb6ea9d 100644
--- a/backend/t4cclient/sessions/operators/k8s.py
+++ b/backend/t4cclient/sessions/operators/k8s.py
@@ -247,7 +247,11 @@ def get_job_logs(self, id: str) -> str:
         )
 
     def create_cronjob(
-        self, image: str, environment: t.Dict[str, str], schedule="* * * * *"
+        self,
+        image: str,
+        environment: t.Dict[str, str],
+        schedule="* * * * *",
+        timeout=18000,
     ) -> str:
         id = self._generate_id()
         self._create_cronjob(
@@ -255,6 +259,7 @@ def create_cronjob(
             image=image,
             environment=environment,
             schedule=schedule,
+            timeout=timeout,
         )
         return id
 
@@ -392,7 +397,12 @@ def _create_deployment(
         return self.v1_apps.create_namespaced_deployment(cfg["namespace"], body)
 
     def _create_cronjob(
-        self, name: str, image: str, environment: t.Dict[str, str], schedule="* * * * *"
+        self,
+        name: str,
+        image: str,
+        environment: t.Dict[str, str],
+        schedule="* * * * *",
+        timeout=18000,
     ) -> kubernetes.client.V1CronJob:
         body = {
             "kind": "CronJob",
@@ -429,7 +439,7 @@ def _create_cronjob(
                             }
                         },
                         "backoffLimit": 1,
-                        "activeDeadlineSeconds": 600,
+                        "activeDeadlineSeconds": timeout,
                     }
                 },
             },

From 722c717daeb898dbe1ff3e82b19607e2f079ded8 Mon Sep 17 00:00:00 2001
From: MoritzWeber0 <kontakt@moritz-weber.net>
Date: Fri, 12 Aug 2022 10:37:19 +0200
Subject: [PATCH 4/4] build: bump capella dockerimages to feat/importer

---
 capella-dockerimages | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/capella-dockerimages b/capella-dockerimages
index 67faa777c..be0daeeb8 160000
--- a/capella-dockerimages
+++ b/capella-dockerimages
@@ -1 +1 @@
-Subproject commit 67faa777c772c6a4706eecec1808f318455fe2f7
+Subproject commit be0daeeb86cbfe6fc08a3f987bccd1f3492d0fb4