Libvirt: Fix security context

This PS fixes the use of the security context macros for the
libvirt chart.

Change-Id: I3340742a0eaf9cffa9263642fd2b987363128ed5
This commit is contained in:
RAHUL KHIYANI 2019-04-21 21:43:16 -05:00 committed by Rahul Khiyani
parent 274697f9cf
commit 77f20875b5
2 changed files with 16 additions and 7 deletions

View File

@ -48,6 +48,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
spec: spec:
{{ dict "envAll" $envAll "application" "libvirt" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
serviceAccountName: {{ $serviceAccountName }} serviceAccountName: {{ $serviceAccountName }}
nodeSelector: nodeSelector:
{{ .Values.labels.agent.libvirt.node_selector_key }}: {{ .Values.labels.agent.libvirt.node_selector_value }} {{ .Values.labels.agent.libvirt.node_selector_key }}: {{ .Values.labels.agent.libvirt.node_selector_value }}
@ -62,8 +63,7 @@ spec:
{{- if empty .Values.conf.ceph.cinder.keyring }} {{- if empty .Values.conf.ceph.cinder.keyring }}
- name: ceph-admin-keyring-placement - name: ceph-admin-keyring-placement
{{ tuple $envAll "libvirt" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll "libvirt" | include "helm-toolkit.snippets.image" | indent 10 }}
securityContext: {{ dict "envAll" $envAll "application" "libvirt" "container" "ceph_admin_keyring_placement" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
runAsUser: 0
command: command:
- /tmp/ceph-admin-keyring.sh - /tmp/ceph-admin-keyring.sh
volumeMounts: volumeMounts:
@ -84,8 +84,7 @@ spec:
{{ end }} {{ end }}
- name: ceph-keyring-placement - name: ceph-keyring-placement
{{ tuple $envAll "libvirt" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll "libvirt" | include "helm-toolkit.snippets.image" | indent 10 }}
securityContext: {{ dict "envAll" $envAll "application" "libvirt" "container" "ceph_keyring_placement" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
runAsUser: 0
env: env:
- name: CEPH_CINDER_USER - name: CEPH_CINDER_USER
value: "{{ .Values.conf.ceph.cinder.user }}" value: "{{ .Values.conf.ceph.cinder.user }}"
@ -115,9 +114,7 @@ spec:
- name: libvirt - name: libvirt
{{ tuple $envAll "libvirt" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll "libvirt" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.libvirt | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.libvirt | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
securityContext: {{ dict "envAll" $envAll "application" "libvirt" "container" "libvirt" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
privileged: true
runAsUser: 0
{{- if .Values.conf.ceph.enabled }} {{- if .Values.conf.ceph.enabled }}
env: env:
- name: CEPH_CINDER_USER - name: CEPH_CINDER_USER

View File

@ -91,6 +91,18 @@ conf:
cgroup: "kubepods" cgroup: "kubepods"
pod: pod:
security_context:
libvirt:
pod:
runAsUser: 0
container:
ceph_admin_keyring_placement:
readOnlyRootFilesystem: false
ceph_keyring_placement:
readOnlyRootFilesystem: false
libvirt:
privileged: true
readOnlyRootFilesystem: false
affinity: affinity:
anti: anti:
type: type: