Skip to content

Commit

Permalink
add terminationGracePeriodSeconds to Job template
Browse files Browse the repository at this point in the history
  • Loading branch information
andmat900 committed Feb 28, 2024
1 parent a464210 commit 3bd19d4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
38 changes: 18 additions & 20 deletions src/suite_starter/esr_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
" metadata:\n"
" name: {job_name}\n"
" spec:\n"
" terminationGracePeriodSeconds: {termination_grace_period}\n"
" volumes:\n"
" - name: kubexit\n"
" emptyDir: {{}}\n"
Expand Down Expand Up @@ -58,10 +59,8 @@
" - name: {job_name}\n"
" image: {docker_image}\n"
" imagePullPolicy: Always\n"
" command: ['sh', '-c']\n"
" args:\n"
" - |\n"
" /kubexit/kubexit python -u -m etos_suite_runner\n"
" command: ['/kubexit/kubexit']\n"
" args: ['python', '-u', '-m', 'etos_suite_runner']\n"
" envFrom:\n"
" - configMapRef:\n"
" name: {etos_configmap}\n"
Expand All @@ -82,10 +81,8 @@
" - name: etos-log-listener\n"
" image: {log_listener}\n"
" imagePullPolicy: Always\n"
" command: ['sh', '-c']\n"
" args:\n"
" - |\n"
" /kubexit/kubexit python -u -m log_listener\n"
" command: ['/kubexit/kubexit']\n"
" args: ['python', '-u', '-m', 'log_listener']\n"
" envFrom:\n"
" - configMapRef:\n"
" name: {etos_configmap}\n"
Expand All @@ -96,6 +93,8 @@
" value: '{EiffelTestExecutionRecipeCollectionCreatedEvent}'\n"
" - name: KUBEXIT_NAME\n"
" value: log_listener\n"
" - name: KUBEXIT_GRACE_PERIOD\n"
" value: '400' # needs to be greater than the graceful termination timeout of the container\n"
" - name: KUBEXIT_GRAVEYARD\n"
" value: /graveyard\n"
" - name: KUBEXIT_DEATH_DEPS\n"
Expand Down Expand Up @@ -124,6 +123,7 @@
" metadata:\n"
" name: {job_name}\n"
" spec:\n"
" terminationGracePeriodSeconds: {termination_grace_period}\n"
" volumes:\n"
" - name: shared-logs\n"
" emptyDir: {{}}\n"
Expand Down Expand Up @@ -158,10 +158,8 @@
" - name: {job_name}\n"
" image: {docker_image}\n"
" imagePullPolicy: Always\n"
" command: ['sh', '-c']\n"
" args:\n"
" - |\n"
" /kubexit/kubexit python -u -m etos_suite_runner\n"
" command: ['/kubexit/kubexit']\n"
" args: ['python', '-u', '-m', 'etos_suite_runner']\n"
" envFrom:\n"
" - configMapRef:\n"
" name: {etos_configmap}\n"
Expand All @@ -184,10 +182,8 @@
" - name: etos-log-listener\n"
" image: {log_listener}\n"
" imagePullPolicy: Always\n"
" command: ['sh', '-c']\n"
" args:\n"
" - |\n"
" /kubexit/kubexit python -u -m log_listener\n"
" command: ['/kubexit/kubexit']\n"
" args: ['python', '-u', '-m', 'log_listener']\n"
" envFrom:\n"
" - configMapRef:\n"
" name: {etos_configmap}\n"
Expand All @@ -198,6 +194,8 @@
" value: '{EiffelTestExecutionRecipeCollectionCreatedEvent}'\n"
" - name: KUBEXIT_NAME\n"
" value: log_listener\n"
" - name: KUBEXIT_GRACE_PERIOD\n"
" value: '400' # needs to be greater than the graceful termination timeout of the container\n"
" - name: KUBEXIT_GRAVEYARD\n"
" value: /graveyard\n"
" - name: KUBEXIT_DEATH_DEPS\n"
Expand All @@ -209,13 +207,13 @@
" mountPath: /kubexit\n"
" - name: sidecar\n"
" image: {sidecar_image}\n"
" command: ['sh', '-c']\n"
" args:\n"
" - |\n"
" /kubexit/kubexit /usr/local/bin/docker-entrypoint -environment container\n"
" command: ['/kubexit/kubexit']\n"
" args: ['/usr/local/bin/docker-entrypoint', '-environment', 'container']\n"
" env:\n"
" - name: KUBEXIT_NAME\n"
" value: sidecar\n"
" - name: KUBEXIT_GRACE_PERIOD\n"
" value: '400' # needs to be greater than the graceful termination timeout of the container\n"
" - name: KUBEXIT_GRAVEYARD\n"
" value: /graveyard\n"
" - name: KUBEXIT_DEATH_DEPS\n"
Expand Down
1 change: 1 addition & 0 deletions src/suite_starter/suite_starter.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def suite_runner_callback(self, event, _):
data["etos_configmap"] = os.getenv("ETOS_CONFIGMAP")
data["etos_rabbitmq_secret"] = os.getenv("ETOS_RABBITMQ_SECRET")
data["ttl"] = os.getenv("ETOS_ESR_TTL", "3600")
data["termination_grace_period"] = os.getenv("ETOS_TERMINATION_GRACE_PERIOD", "300")
data["docker_image"] = self.etos.config.get("suite_runner")
data["log_listener"] = self.etos.config.get("log_listener")
data["suite_id"] = suite_id
Expand Down

0 comments on commit 3bd19d4

Please sign in to comment.