diff --git a/README.md b/README.md index 1f60a16..6519227 100644 --- a/README.md +++ b/README.md @@ -62,12 +62,13 @@ helm upgrade gdscan gdscan/gdscan -f values.yaml # Options -| Name | Description | Value | -| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------ | -| `service.type` | service type | `ClusterIP` | -| `service.ports.api` | API service port | `8080` | -| `service.annotations` | service annotations | `{}` | -| `replicaCount` | number of pods | `1` | -| `autoscaling.enabled` | enable auto scaling | `false` | -| `autoscaling.maxReplicas` | maximum number of replicas | `20` | -| `autoscaling.metrics` | custom metrics for auto scaling | | +| Name | Description | Value | +| ------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------ | +| `service.type` | service type | `ClusterIP` | +| `service.ports.api` | API service port | `8080` | +| `service.annotations` | service annotations | `{}` | +| `replicaCount` | number of pods | `1` | +| `autoscaling.enabled` | enable auto scaling | `false` | +| `autoscaling.maxReplicas` | maximum number of replicas | `20` | +| `autoscaling.metrics` | custom metrics for auto scaling | | +| `terminationGracePeriodSeconds` | max time in seconds for scans to complete | `30` | diff --git a/charts/gdscan/Chart.yaml b/charts/gdscan/Chart.yaml index c2f22ff..6251ffc 100644 --- a/charts/gdscan/Chart.yaml +++ b/charts/gdscan/Chart.yaml @@ -5,4 +5,4 @@ maintainers: - name: G DATA CyberDefense AG email: oem@gdata.de type: application -version: 1.6.0 +version: 1.7.0 diff --git a/charts/gdscan/templates/_helpers.tpl b/charts/gdscan/templates/_helpers.tpl index cf0792f..4b0b57a 100644 --- a/charts/gdscan/templates/_helpers.tpl +++ b/charts/gdscan/templates/_helpers.tpl @@ -109,3 +109,12 @@ app.kubernetes.io/namespace: {{ .Release.Namespace }} {{- end -}} {{- end -}} + +{{- define "common.secondsToHHMMSS" -}} +{{- $totalSeconds := . -}} +{{- $hours := div $totalSeconds 3600 | printf "%02d" -}} +{{- $totalSeconds = mod $totalSeconds 3600 -}} +{{- $minutes := div $totalSeconds 60 | printf "%02d" -}} +{{- $seconds := mod $totalSeconds 60 | printf "%02d" -}} +{{- printf "%s:%s:%s" $hours $minutes $seconds -}} +{{- end -}} diff --git a/charts/gdscan/templates/deployment.yaml b/charts/gdscan/templates/deployment.yaml index 3b3ecd0..a224e6e 100644 --- a/charts/gdscan/templates/deployment.yaml +++ b/charts/gdscan/templates/deployment.yaml @@ -96,6 +96,9 @@ spec: port: api initialDelaySeconds: 15 periodSeconds: 5 + env: + - name: HostOptions__ShutdownTimeout + value: {{ include "common.secondsToHHMMSS" .Values.terminationGracePeriodSeconds | quote }} terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} {{- with .Values.nodeSelector }} nodeSelector: diff --git a/charts/gdscan/templates/stateful-set.yaml b/charts/gdscan/templates/stateful-set.yaml index acbbc04..5031179 100644 --- a/charts/gdscan/templates/stateful-set.yaml +++ b/charts/gdscan/templates/stateful-set.yaml @@ -93,6 +93,9 @@ spec: port: api initialDelaySeconds: 15 periodSeconds: 5 + env: + - name: HostOptions__ShutdownTimeout + value: {{ include "common.secondsToHHMMSS" .Values.terminationGracePeriodSeconds | quote }} terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} {{- with .Values.nodeSelector }} nodeSelector: