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.
*/}}
{{- if .Values.manifests.configmap_etc }}
{{- $envAll := . }}
{{- define "ceph.configmap.etc" }}
{{- $configMapName := index . 0 }}
{{- $envAll := index . 1 }}
{{- with $envAll }}
{{- if or (.Values.deployment.ceph) (.Values.deployment.client_secrets) }}
{{- if empty .Values.conf.ceph.config.global.mon_host -}}
@ -39,9 +42,13 @@ limitations under the License.
apiVersion: v1
kind: ConfigMap
metadata:
name: ceph-etc
name: {{ $configMapName }}
data:
ceph.conf: |+
{{ include "helm-toolkit.utils.to_ini" .Values.conf.ceph.config | indent 4 }}
{{- 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.
*/}}
{{- if .Values.manifests.daemonset_osd }}
{{- $envAll := . }}
{{- if .Values.deployment.ceph }}
{{- $dependencies := .Values.dependencies.osd }}
{{- $serviceAccountName := "ceph-osd"}}
{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
{{- define "ceph.osd.daemonset" }}
{{- $daemonset := index . 0 }}
{{- $configMapName := index . 1 }}
{{- $serviceAccountName := index . 2 }}
{{- $dependencies := index . 3 }}
{{- $envAll := index . 4 }}
{{- with $envAll }}
---
kind: DaemonSet
apiVersion: extensions/v1beta1
@ -159,7 +161,7 @@ spec:
defaultMode: 0555
- name: ceph-etc
configMap:
name: ceph-etc
name: {{ $configMapName }}
defaultMode: 0444
- name: ceph-client-admin-keyring
secret:
@ -181,3 +183,14 @@ spec:
path: {{ .Values.ceph.storage.osd_directory }}
{{- 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 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 "name" $current_dict.dns_1123_name }}
{{- end }}
{{- end }}
{{- $updated_list := append $context.Values.__volume_list $context.Values.__volume }}
@ -239,19 +238,6 @@ limitations under the License.
{{- end }}
{{- $_ := 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 */}}
{{- if hasKey $current_dict "matchExpressions" }}
@ -283,4 +269,3 @@ limitations under the License.
{{- $_ := set $context.Values "__last_configmap_name" $current_dict.dns_1123_name }}
{{- end }}
{{- end }}

View File

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