[COMMON][READINESS] Fix user and group 13/118513/4
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>
Thu, 25 Feb 2021 13:17:55 +0000 (14:17 +0100)
committerKrzysztof Opasiak <k.opasiak@samsung.com>
Wed, 3 Mar 2021 19:52:17 +0000 (19:52 +0000)
readiness check can be launched in a lot of various situation.
Especially, it can be runned on deployments / statefulsets where the
user and group are fixed.
But python code underneath can work only when user is set to "onap" as
requirements are installed only for this specific user.
This patch forces the user and group to the desired one.

Issue-ID: OOM-2694
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
Change-Id: Ie70f8e851c30f530fd7a0d6e34ee5bda9274e874

kubernetes/common/readinessCheck/templates/_readinessCheck.tpl
kubernetes/common/readinessCheck/values.yaml

index 95de6ec..71201a1 100644 (file)
@@ -67,6 +67,9 @@
 - name: {{ include "common.name" $dot }}{{ ternary "" (printf "-%s" $namePart) (empty $namePart) }}-readiness
   image: {{ include "repositoryGenerator.image.readiness" $subchartDot }}
   imagePullPolicy: {{ $subchartDot.Values.global.pullPolicy | default $subchartDot.Values.pullPolicy }}
+  securityContext:
+    runAsUser: {{ $subchartDot.Values.user }}
+    runAsGroup: {{ $subchartDot.Values.group }}
   command:
   - /app/ready.py
   args:
index b15b1c2..128c505 100644 (file)
@@ -15,6 +15,9 @@
 global:
   pullPolicy: Always
 
+user: 100
+group: 65533
+
 limits:
   cpu: 100m
   memory: 100Mi