diff --git a/libvirt/templates/etc/_libvirtd.conf.tpl b/helm-toolkit/templates/utils/_to_kv_list.tpl similarity index 71% rename from libvirt/templates/etc/_libvirtd.conf.tpl rename to helm-toolkit/templates/utils/_to_kv_list.tpl index 67536549d3..b15ef58633 100644 --- a/libvirt/templates/etc/_libvirtd.conf.tpl +++ b/helm-toolkit/templates/utils/_to_kv_list.tpl @@ -14,9 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */}} -listen_tcp = 1 -auth_tcp = "none" -ca_file = "" -log_level = {{ .Values.conf.libvirt.log_level }} -log_outputs = "{{ .Values.conf.libvirt.log_level }}:stderr" -listen_addr = "{{ .Values.conf.libvirt.listen_addr }}" +{{- define "helm-toolkit.utils.to_kv_list" -}} +{{- range $key, $value := . -}} +{{- if regexMatch "^[0-9]+$" $value }} +{{ $key }} = {{ $value }} +{{- else }} +{{ $key }} = {{ $value | quote }} +{{- end }} +{{- end -}} +{{- end -}} diff --git a/libvirt/templates/configmap-etc.yaml b/libvirt/templates/configmap-etc.yaml index b72184d167..f24f486c96 100644 --- a/libvirt/templates/configmap-etc.yaml +++ b/libvirt/templates/configmap-etc.yaml @@ -23,7 +23,7 @@ metadata: name: libvirt-etc data: libvirtd.conf: |+ -{{ tuple "etc/_libvirtd.conf.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} +{{- include "helm-toolkit.utils.to_kv_list" .Values.conf.libvirt | indent 4 }} qemu.conf: |+ -{{ tuple "etc/_qemu.conf.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} +{{- include "helm-toolkit.utils.to_kv_list" .Values.conf.qemu | indent 4 }} {{- end }} diff --git a/libvirt/templates/etc/_qemu.conf.tpl b/libvirt/templates/etc/_qemu.conf.tpl deleted file mode 100644 index 0b26d0f6d0..0000000000 --- a/libvirt/templates/etc/_qemu.conf.tpl +++ /dev/null @@ -1,32 +0,0 @@ -{{/* -Copyright 2017 The Openstack-Helm Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/}} - -# The backend to use for handling stdout/stderr output from -# QEMU processes. -# -# 'file': QEMU writes directly to a plain file. This is the -# historical default, but allows QEMU to inflict a -# denial of service attack on the host by exhausting -# filesystem space -# -# 'logd': QEMU writes to a pipe provided by virtlogd daemon. -# This is the current default, providing protection -# against denial of service by performing log file -# rollover when a size limit is hit. -# -stdio_handler = "file" -{{ if not .Values.conf.qemu.user }}#{{ end }}user = {{ .Values.conf.qemu.user | default "nova" | quote }} -{{ if not .Values.conf.qemu.group }}#{{ end }}group = {{ .Values.conf.qemu.group | default "kvm" | quote }} diff --git a/libvirt/values.yaml b/libvirt/values.yaml index 51b78e159c..07e032021f 100644 --- a/libvirt/values.yaml +++ b/libvirt/values.yaml @@ -40,9 +40,13 @@ ceph: conf: libvirt: + listen_tcp: "1" + auth_tcp: "none" + ca_file: "" listen_addr: 0.0.0.0 - log_level: 3 + log_level: "3" qemu: + stdio_handler: "file" user: "nova" group: "kvm"