diff options
author | Sylvain Desbureaux <sylvain.desbureaux@orange.com> | 2021-09-06 07:51:09 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-09-06 07:51:09 +0000 |
commit | 6d0c0014f558fdf4f01803a582ff49b8445cfdaf (patch) | |
tree | afff2e1c8eeeaad939f5b2314ea98abdc1800228 /kubernetes/aai/components | |
parent | 6c8bdb10b085afa5a4680b0254163d00c8e8eb0a (diff) | |
parent | 09523beb2c26903466e887be7d697983c8ec0eeb (diff) |
Merge "[AAI] Added Rolling Update Strategy"
Diffstat (limited to 'kubernetes/aai/components')
-rw-r--r-- | kubernetes/aai/components/aai-resources/templates/deployment.yaml | 23 | ||||
-rw-r--r-- | kubernetes/aai/components/aai-resources/values.yaml | 9 |
2 files changed, 32 insertions, 0 deletions
diff --git a/kubernetes/aai/components/aai-resources/templates/deployment.yaml b/kubernetes/aai/components/aai-resources/templates/deployment.yaml index 501a706f47..fd4b1c3dc1 100644 --- a/kubernetes/aai/components/aai-resources/templates/deployment.yaml +++ b/kubernetes/aai/components/aai-resources/templates/deployment.yaml @@ -29,6 +29,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" . }} @@ -72,6 +78,7 @@ spec: {{- end }} spec: hostname: aai-resources + terminationGracePeriodSeconds: {{ .Values.service.terminationGracePeriodSeconds }} initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }} - name: {{ include "common.name" . }}-readiness command: @@ -125,6 +132,10 @@ spec: value: '-Djavax.net.ssl.trustStore={{ .Values.certInitializer.credsPath }}/truststoreONAPall.jks -Djavax.net.ssl.trustStorePassword={{ .Values.certInitializer.truststorePassword }}' - name: TRUSTORE_ALL_PASSWORD value: {{ .Values.certInitializer.truststorePassword }} + - name: INTERNAL_PORT_1 + value: {{ .Values.service.internalPort | quote }} + - name: INTERNAL_PORT_2 + value: {{ .Values.service.internalPort2 | quote }} volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }} - mountPath: /etc/localtime name: localtime @@ -173,6 +184,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 }} diff --git a/kubernetes/aai/components/aai-resources/values.yaml b/kubernetes/aai/components/aai-resources/values.yaml index c2658a5503..2ec78c57c4 100644 --- a/kubernetes/aai/components/aai-resources/values.yaml +++ b/kubernetes/aai/components/aai-resources/values.yaml @@ -161,6 +161,14 @@ flavor: small flavorOverride: small # default number of instances replicaCount: 1 +# the minimum number of seconds that a newly created Pod should be ready +minReadySeconds: 30 +updateStrategy: + type: RollingUpdate + # The number of pods that can be unavailable during the update process + maxUnavailable: 0 + # The number of pods that can be created above the desired amount of pods during an update + maxSurge: 1 # Configuration for the resources deployment config: @@ -220,6 +228,7 @@ service: internalPort: 8447 portName2: aai-resources-5005 internalPort2: 5005 + terminationGracePeriodSeconds: 120 ingress: enabled: false |