HostSpecific Over-rides: Add Ceph OSD to host targetable config

This PS adds Ceph OSD's to the host specific over-rides, it also
simplifies the host-specific daemonset logic.

Change-Id: Icd5daf46f29a328e96273ac64ad761e30d933e9c
This commit is contained in:
portdirect 2018-01-19 19:22:29 -05:00
parent e69957b2be
commit dbb778a784
4 changed files with 43 additions and 38 deletions

View File

@ -14,8 +14,11 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
{{- if .Values.manifests.configmap_etc }} {{- define "ceph.configmap.etc" }}
{{- $envAll := . }} {{- $configMapName := index . 0 }}
{{- $envAll := index . 1 }}
{{- with $envAll }}
{{- if or (.Values.deployment.ceph) (.Values.deployment.client_secrets) }} {{- if or (.Values.deployment.ceph) (.Values.deployment.client_secrets) }}
{{- if empty .Values.conf.ceph.config.global.mon_host -}} {{- if empty .Values.conf.ceph.config.global.mon_host -}}
@ -39,9 +42,13 @@ limitations under the License.
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: ceph-etc name: {{ $configMapName }}
data: data:
ceph.conf: |+ ceph.conf: |+
{{ include "helm-toolkit.utils.to_ini" .Values.conf.ceph.config | indent 4 }} {{ include "helm-toolkit.utils.to_ini" .Values.conf.ceph.config | indent 4 }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }}
{{- if .Values.manifests.configmap_etc }}
{{- list "ceph-etc" . | include "ceph.configmap.etc" }}
{{- end }}

View File

@ -14,13 +14,15 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
{{- if .Values.manifests.daemonset_osd }}
{{- $envAll := . }}
{{- if .Values.deployment.ceph }}
{{- $dependencies := .Values.dependencies.osd }}
{{- $serviceAccountName := "ceph-osd"}} {{- define "ceph.osd.daemonset" }}
{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} {{- $daemonset := index . 0 }}
{{- $configMapName := index . 1 }}
{{- $serviceAccountName := index . 2 }}
{{- $dependencies := index . 3 }}
{{- $envAll := index . 4 }}
{{- with $envAll }}
--- ---
kind: DaemonSet kind: DaemonSet
apiVersion: extensions/v1beta1 apiVersion: extensions/v1beta1
@ -159,7 +161,7 @@ spec:
defaultMode: 0555 defaultMode: 0555
- name: ceph-etc - name: ceph-etc
configMap: configMap:
name: ceph-etc name: {{ $configMapName }}
defaultMode: 0444 defaultMode: 0444
- name: ceph-client-admin-keyring - name: ceph-client-admin-keyring
secret: secret:
@ -181,3 +183,14 @@ spec:
path: {{ .Values.ceph.storage.osd_directory }} path: {{ .Values.ceph.storage.osd_directory }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if and .Values.manifests.daemonset_osd .Values.deployment.ceph }}
{{- $daemonset := "osd" }}
{{- $configMapName := "ceph-etc" }}
{{- $serviceAccountName := "ceph-osd"}}
{{- $dependencies := .Values.dependencies.osd }}
{{ tuple . $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
{{- $daemonset_yaml := list $daemonset $configMapName $serviceAccountName $dependencies . | include "ceph.osd.daemonset" | toString | fromYaml }}
{{- $configmap_yaml := "ceph.configmap.etc" }}
{{- list $daemonset $daemonset_yaml $configmap_yaml $configMapName . | include "helm-toolkit.utils.daemonset_overrides" }}
{{- end }}

View File

@ -231,7 +231,6 @@ limitations under the License.
{{- if hasKey $context.Values.__volume "configMap" }} {{- if hasKey $context.Values.__volume "configMap" }}
{{- if eq $context.Values.__volume.configMap.name $context.Values.__last_configmap_name }} {{- if eq $context.Values.__volume.configMap.name $context.Values.__last_configmap_name }}
{{- $_ := set $context.Values.__volume.configMap "name" $current_dict.dns_1123_name }} {{- $_ := set $context.Values.__volume.configMap "name" $current_dict.dns_1123_name }}
{{- $_ := set $context.Values.__volume "name" $current_dict.dns_1123_name }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- $updated_list := append $context.Values.__volume_list $context.Values.__volume }} {{- $updated_list := append $context.Values.__volume_list $context.Values.__volume }}
@ -239,19 +238,6 @@ limitations under the License.
{{- end }} {{- end }}
{{- $_ := set $context.Values.__daemonset_yaml.spec.template.spec "volumes" $context.Values.__volume_list }} {{- $_ := set $context.Values.__daemonset_yaml.spec.template.spec "volumes" $context.Values.__volume_list }}
{{/* set names for container volume mounts */}}
{{- $_ := set $context.Values "__volume_mount_list" list }}
{{- range $vol_mount := $container.volumeMounts }}
{{- $_ := set $context.Values "__volume_mount" $vol_mount }}
{{- if eq $vol_mount.name $context.Values.__last_configmap_name }}
{{- $_ := set $context.Values.__volume_mount "name" $current_dict.dns_1123_name }}
{{- end }}
{{- $updated_list := append $context.Values.__volume_mount_list $context.Values.__volume_mount }}
{{- $_ := set $context.Values "__volume_mount_list" $updated_list }}
{{- end }}
{{- $_ := set $container "volumeMounts" $context.Values.__volume_mount_list }}
{{- $container_list := list $container }}
{{- $_ := set $context.Values.__daemonset_yaml.spec.template.spec "containers" $container_list }}
{{/* populate scheduling restrictions */}} {{/* populate scheduling restrictions */}}
{{- if hasKey $current_dict "matchExpressions" }} {{- if hasKey $current_dict "matchExpressions" }}
@ -283,4 +269,3 @@ limitations under the License.
{{- $_ := set $context.Values "__last_configmap_name" $current_dict.dns_1123_name }} {{- $_ := set $context.Values "__last_configmap_name" $current_dict.dns_1123_name }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -152,42 +152,42 @@ spec:
mountPath: /tmp/nova-compute.sh mountPath: /tmp/nova-compute.sh
subPath: nova-compute.sh subPath: nova-compute.sh
readOnly: true readOnly: true
- name: {{ $configMapName }} - name: nova-etc
mountPath: /etc/nova/nova.conf mountPath: /etc/nova/nova.conf
subPath: nova.conf subPath: nova.conf
readOnly: true readOnly: true
- name: {{ $configMapName }} - name: nova-etc
mountPath: /etc/nova/api-paste.ini mountPath: /etc/nova/api-paste.ini
subPath: api-paste.ini subPath: api-paste.ini
readOnly: true readOnly: true
- name: {{ $configMapName }} - name: nova-etc
mountPath: /etc/nova/policy.yaml mountPath: /etc/nova/policy.yaml
subPath: policy.yaml subPath: policy.yaml
readOnly: true readOnly: true
- name: {{ $configMapName }} - name: nova-etc
# NOTE (Portdirect): We mount here to override Kollas # NOTE (Portdirect): We mount here to override Kollas
# custom sudoers file when using Kolla images, this # custom sudoers file when using Kolla images, this
# location will also work fine for other images. # location will also work fine for other images.
mountPath: /etc/sudoers.d/kolla_nova_sudoers mountPath: /etc/sudoers.d/kolla_nova_sudoers
subPath: nova_sudoers subPath: nova_sudoers
readOnly: true readOnly: true
- name: {{ $configMapName }} - name: nova-etc
mountPath: /etc/nova/rootwrap.conf mountPath: /etc/nova/rootwrap.conf
subPath: rootwrap.conf subPath: rootwrap.conf
readOnly: true readOnly: true
- name: {{ $configMapName }} - name: nova-etc
mountPath: /etc/nova/rootwrap.d/api-metadata.filters mountPath: /etc/nova/rootwrap.d/api-metadata.filters
subPath: api-metadata.filters subPath: api-metadata.filters
readOnly: true readOnly: true
- name: {{ $configMapName }} - name: nova-etc
mountPath: /etc/nova/rootwrap.d/compute.filters mountPath: /etc/nova/rootwrap.d/compute.filters
subPath: compute.filters subPath: compute.filters
readOnly: true readOnly: true
- name: {{ $configMapName }} - name: nova-etc
mountPath: /etc/nova/rootwrap.d/network.filters mountPath: /etc/nova/rootwrap.d/network.filters
subPath: network.filters subPath: network.filters
readOnly: true readOnly: true
- name: {{ $configMapName }} - name: nova-etc
mountPath: /root/.ssh/config mountPath: /root/.ssh/config
subPath: ssh-config subPath: ssh-config
readOnly: true readOnly: true
@ -240,13 +240,13 @@ spec:
mountPath: /var/lib/nova mountPath: /var/lib/nova
- name: varliblibvirt - name: varliblibvirt
mountPath: /var/lib/libvirt mountPath: /var/lib/libvirt
- name: {{ $configMapName }} - name: nova-etc
mountPath: /root/.ssh/id_rsa mountPath: /root/.ssh/id_rsa
subPath: ssh-key-private subPath: ssh-key-private
- name: {{ $configMapName }} - name: nova-etc
mountPath: /root/.ssh/id_rsa.pub mountPath: /root/.ssh/id_rsa.pub
subPath: ssh-key-public subPath: ssh-key-public
- name: {{ $configMapName }} - name: nova-etc
mountPath: /root/.ssh/authorized_keys mountPath: /root/.ssh/authorized_keys
subPath: ssh-key-public subPath: ssh-key-public
- name: nova-bin - name: nova-bin
@ -258,7 +258,7 @@ spec:
configMap: configMap:
name: nova-bin name: nova-bin
defaultMode: 0555 defaultMode: 0555
- name: {{ $configMapName }} - name: nova-etc
configMap: configMap:
name: {{ $configMapName }} name: {{ $configMapName }}
defaultMode: 0444 defaultMode: 0444