diff options
author | M.Hosnidokht <mohammad.hosnidokht@yoppworks.com> | 2021-08-25 09:19:41 -0400 |
---|---|---|
committer | M.Hosnidokht <mohammad.hosnidokht@yoppworks.com> | 2021-09-03 19:28:04 -0400 |
commit | 6c806532ef21164ca85f972b196dfd3375409eac (patch) | |
tree | f7f350f62b4b36da2b6ad7f49b84bab46aa8cb57 /kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml | |
parent | 529604f9b5eccb8bb0953b8ee1c96634156a57d4 (diff) |
[AAI] Added Rolling Update Strategy to graphAdmin
Addded preStop hook to let long-running tasks be finished
before the SIGTERM is invoked
Issue-ID: AAI-3368
Signed-off-by: Mohammad Hosnidokht <mohammad.hosnidokht@yoppworks.com>
Change-Id: Ie5d0c5b454bd99022e5a2307e5813a92a8713ebd
Diffstat (limited to 'kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml')
-rw-r--r-- | kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml b/kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml index 791bf61004..45e4802ede 100644 --- a/kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml +++ b/kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml @@ -32,6 +32,12 @@ metadata: heritage: {{ .Release.Service }} spec: replicas: {{ .Values.replicaCount }} + minReadySeconds: {{ .Values.minReadySeconds }} + strategy: + type: {{ .Values.updateStrategy.type }} + rollingUpdate: + maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }} + maxSurge: {{ .Values.updateStrategy.maxSurge }} selector: matchLabels: app: {{ include "common.name" . }} @@ -45,6 +51,7 @@ spec: checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} spec: hostname: aai-graphadmin + terminationGracePeriodSeconds: {{ .Values.service.terminationGracePeriodSeconds }} {{ if .Values.global.initContainers.enabled }} initContainers: - command: @@ -89,6 +96,10 @@ spec: value: {{ .Values.global.config.userId | quote }} - name: LOCAL_GROUP_ID value: {{ .Values.global.config.groupId | quote }} + - name: INTERNAL_PORT_1 + value: {{ .Values.service.internalPort | quote }} + - name: INTERNAL_PORT_2 + value: {{ .Values.service.internalPort2 | quote }} volumeMounts: - mountPath: /etc/localtime name: localtime @@ -125,6 +136,18 @@ spec: ports: - containerPort: {{ .Values.service.internalPort }} - containerPort: {{ .Values.service.internalPort2 }} + lifecycle: + # wait for active requests (long-running tasks) to be finished + # Before the SIGTERM is invoked, Kubernetes exposes a preStop hook in the Pod. + preStop: + exec: + command: + - sh + - -c + - | + while (netstat -an | grep ESTABLISHED | grep -e $INTERNAL_PORT_1 -e $INTERNAL_PORT_2) + do sleep 10 + done # disable liveness probe when breakpoints set in debugger # so K8s doesn't restart unresponsive container {{ if .Values.liveness.enabled }} |