Merge "Libvirt: support per node overrides"

This commit is contained in:
Zuul 2019-04-04 08:11:31 +00:00 committed by Gerrit Code Review
commit aae64213c9
2 changed files with 45 additions and 19 deletions

View File

@ -14,15 +14,23 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
{{- if .Values.manifests.configmap_etc }} {{- define "libvirt.configmap.etc" }}
{{- $configMapName := index . 0 }}
{{- $envAll := index . 1 }}
{{- with $envAll }}
--- ---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: Secret
metadata: metadata:
name: libvirt-etc name: {{ $configMapName }}
type: Opaque
data: data:
libvirtd.conf: | libvirtd.conf: {{ include "libvirt.utils.to_libvirt_conf" .Values.conf.libvirt | b64enc }}
{{- include "libvirt.utils.to_libvirt_conf" .Values.conf.libvirt | indent 4 }} qemu.conf: {{ include "libvirt.utils.to_libvirt_conf" .Values.conf.qemu | b64enc }}
qemu.conf: | {{- end }}
{{- include "libvirt.utils.to_libvirt_conf" .Values.conf.qemu | indent 4 }} {{- end }}
{{- if .Values.manifests.configmap_etc }}
{{- list "libvirt-etc" . | include "libvirt.configmap.etc" }}
{{- end }} {{- end }}

View File

@ -14,16 +14,16 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
{{- if .Values.manifests.daemonset_libvirt }} {{- define "libvirt.daemonset" }}
{{- $envAll := . }} {{- $daemonset := index . 0 }}
{{- $dependencyOpts := dict "envAll" $envAll "dependencyMixinParam" $envAll.Values.network.backend "dependencyKey" "libvirt" -}} {{- $configMapName := index . 1 }}
{{- $_ := include "helm-toolkit.utils.dependency_resolver" $dependencyOpts | toString | fromYaml }} {{- $serviceAccountName := index . 2 }}
{{- $envAll := index . 3 }}
{{- with $envAll }}
{{- $mounts_libvirt := .Values.pod.mounts.libvirt.libvirt }} {{- $mounts_libvirt := .Values.pod.mounts.libvirt.libvirt }}
{{- $mounts_libvirt_init := .Values.pod.mounts.libvirt.init_container }} {{- $mounts_libvirt_init := .Values.pod.mounts.libvirt.init_container }}
{{- $serviceAccountName := "libvirt" }}
{{ tuple $envAll "pod_dependency" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: DaemonSet kind: DaemonSet
@ -32,16 +32,16 @@ metadata:
annotations: annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
labels: labels:
{{ tuple $envAll "libvirt" "libvirt" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ tuple $envAll .Chart.Name $daemonset | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
spec: spec:
selector: selector:
matchLabels: matchLabels:
{{ tuple $envAll "libvirt" "libvirt" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} {{ tuple $envAll .Chart.Name $daemonset | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
{{ tuple $envAll "libvirt" | include "helm-toolkit.snippets.kubernetes_upgrades_daemonset" | indent 2 }} {{ tuple $envAll $daemonset | include "helm-toolkit.snippets.kubernetes_upgrades_daemonset" | indent 2 }}
template: template:
metadata: metadata:
labels: labels:
{{ tuple $envAll "libvirt" "libvirt" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} {{ tuple $envAll .Chart.Name $daemonset | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
annotations: annotations:
{{- dict "envAll" $envAll "podName" "libvirt" "containerNames" (list "libvirt") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} {{- dict "envAll" $envAll "podName" "libvirt" "containerNames" (list "libvirt") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
@ -194,8 +194,8 @@ spec:
name: libvirt-bin name: libvirt-bin
defaultMode: 0555 defaultMode: 0555
- name: libvirt-etc - name: libvirt-etc
configMap: secret:
name: libvirt-etc secretName: {{ $configMapName }}
defaultMode: 0444 defaultMode: 0444
{{- if .Values.conf.ceph.enabled }} {{- if .Values.conf.ceph.enabled }}
- name: etcceph - name: etcceph
@ -241,3 +241,21 @@ spec:
{{ dict "envAll" $envAll "component" "libvirt" "requireSys" true | include "helm-toolkit.snippets.kubernetes_apparmor_volumes" | indent 8 }} {{ dict "envAll" $envAll "component" "libvirt" "requireSys" true | include "helm-toolkit.snippets.kubernetes_apparmor_volumes" | indent 8 }}
{{ if $mounts_libvirt.volumes }}{{ toYaml $mounts_libvirt.volumes | indent 8 }}{{ end }} {{ if $mounts_libvirt.volumes }}{{ toYaml $mounts_libvirt.volumes | indent 8 }}{{ end }}
{{- end }} {{- end }}
{{- end }}
{{- if .Values.manifests.daemonset_libvirt }}
{{- $envAll := . }}
{{- $daemonset := "libvirt" }}
{{- $configMapName := "libvirt-etc" }}
{{- $serviceAccountName := "libvirt" }}
{{- $dependencyOpts := dict "envAll" $envAll "dependencyMixinParam" $envAll.Values.network.backend "dependencyKey" "libvirt" -}}
{{- $_ := include "helm-toolkit.utils.dependency_resolver" $dependencyOpts | toString | fromYaml }}
{{ tuple $envAll "pod_dependency" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
{{- $daemonset_yaml := list $daemonset $configMapName $serviceAccountName . | include "libvirt.daemonset" | toString | fromYaml }}
{{- $configmap_yaml := "libvirt.configmap.etc" }}
{{- list $daemonset $daemonset_yaml $configmap_yaml $configMapName . | include "helm-toolkit.utils.daemonset_overrides" }}
{{- end }}