diff options
author | Sylvain Desbureaux <sylvain.desbureaux@orange.com> | 2020-12-02 07:21:33 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-12-02 07:21:33 +0000 |
commit | f4a8459abc0b5bd142ea3cc883eb4880a63e1140 (patch) | |
tree | 62c9f463c4e02bc175df61fa62d3450435857903 /kubernetes/consul/templates/deployment.yaml | |
parent | fcbecbd79e4b3b66ae23923ca5ae322c8d9a0e51 (diff) | |
parent | 775b166148ff8f4abb2e667a9824a66f5bd674c0 (diff) |
Merge "[CONSUL] Make consul run as non-root" into guilin
Diffstat (limited to 'kubernetes/consul/templates/deployment.yaml')
-rw-r--r-- | kubernetes/consul/templates/deployment.yaml | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/kubernetes/consul/templates/deployment.yaml b/kubernetes/consul/templates/deployment.yaml index 51c6eb72d5..eece2b704f 100644 --- a/kubernetes/consul/templates/deployment.yaml +++ b/kubernetes/consul/templates/deployment.yaml @@ -39,15 +39,36 @@ spec: spec: imagePullSecrets: - name: "{{ include "common.namespace" . }}-docker-registry-key" - containers: - - image: "{{ include "common.repository" . }}/{{ .Values.image }}" + initContainers: + - name: {{ include "common.name" . }}-chown + image: "{{ include "common.repository" . }}/{{ .Values.image }}" command: - - /bin/sh - - "-c" + - sh + args: + - -c - | - apk update && apk add jq - cp /tmp/consul/config/* /consul/config - /usr/local/bin/docker-entrypoint.sh agent -client 0.0.0.0 -enable-script-checks -retry-join {{ .Values.consulServer.nameOverride }} + cp -r -L /tmp/consul/config/* /consul/config/ + chown -R {{ .Values.consulUID }}:{{ .Values.consulGID }} /consul/config + ls -la /consul/config + volumeMounts: + - mountPath: /tmp/consul/config + name: consul-agent-config + - mountPath: /consul/config + name: consul-agent-config-dir + containers: + - image: {{ include "common.repository" . }}/{{ .Values.image }} + securityContext: + runAsUser: {{ .Values.securityContext.runAsUser }} + runAsGroup: {{ .Values.securityContext.runAsGroup }} + command: + - docker-entrypoint.sh + args: + - agent + - -client + - 0.0.0.0 + - -enable-script-checks + - -retry-join + - {{ .Values.consulServer.nameOverride }} name: {{ include "common.name" . }} env: - name: SDNC_ODL_COUNT @@ -55,14 +76,16 @@ spec: - name: SDNC_IS_PRIMARY_CLUSTER value: "{{ .Values.sdnc.config.isPrimaryCluster }}" volumeMounts: - - mountPath: /tmp/consul/config - name: consul-agent-config + - mountPath: /consul/config + name: consul-agent-config-dir - mountPath: /consul/scripts name: consul-agent-scripts-config - mountPath: /consul/certs name: consul-agent-certs-config resources: {{ include "common.resources" . | nindent 10 }} volumes: + - name: consul-agent-config-dir + emptyDir: {} - configMap: name: {{ include "common.fullname" . }}-configmap name: consul-agent-config |