Enable Cinder backends to use iSCSI for data traffic

In this patchset, the iSCSI protocol support is added
to enable Cinder to use iSCSI based storage backends.

Bootable volumes are not supported, only VM attached
volumes are supported for this initial patchset.

Change-Id: I1b35290b62d2cebae4bd8be62126a53f230ac6c0
This commit is contained in:
Huang, Sophie (sh879n) 2020-01-27 21:12:59 +00:00 committed by Sophie Huang
parent 3c093d2dea
commit 8a7b7ba086
8 changed files with 130 additions and 2 deletions

View File

@ -0,0 +1,20 @@
#!/bin/bash
{{/*
Copyright 2020 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.
*/}}
chroot /mnt/host-rootfs /usr/bin/env -i PATH="/sbin:/bin:/usr/bin" \
iscsiadm "${@:1}"

View File

@ -23,6 +23,10 @@ kind: ConfigMap
metadata: metadata:
name: cinder-bin name: cinder-bin
data: data:
{{- if .Values.conf.enable_iscsi }}
iscsiadm: |
{{ tuple "bin/_iscsiadm.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }}
{{- if .Values.images.local_registry.active }} {{- if .Values.images.local_registry.active }}
image-repo-sync.sh: | image-repo-sync.sh: |
{{- include "helm-toolkit.scripts.image_repo_sync" . | indent 4 }} {{- include "helm-toolkit.scripts.image_repo_sync" . | indent 4 }}

View File

@ -52,6 +52,9 @@ spec:
{{ tuple $envAll "cinder" "volume" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} {{ tuple $envAll "cinder" "volume" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
nodeSelector: nodeSelector:
{{ .Values.labels.volume.node_selector_key }}: {{ .Values.labels.volume.node_selector_value }} {{ .Values.labels.volume.node_selector_key }}: {{ .Values.labels.volume.node_selector_value }}
{{- if .Values.pod.useHostNetwork.volume }}
hostNetwork: true
{{- end }}
initContainers: initContainers:
{{ tuple $envAll "volume" $mounts_cinder_volume_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} {{ tuple $envAll "volume" $mounts_cinder_volume_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
{{- range $name := rest (splitList "," (include "cinder.utils.ceph_backend_list" $envAll)) }} {{- range $name := rest (splitList "," (include "cinder.utils.ceph_backend_list" $envAll)) }}
@ -195,6 +198,22 @@ spec:
readOnly: true readOnly: true
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.conf.enable_iscsi }}
- name: host-rootfs
mountPath: /mnt/host-rootfs
- name: runlock
mountPath: /run/lock
- name: etciscsi
mountPath: /etc/iscsi
{{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "10" ) }}
mountPropagation: Bidirectional
{{- end }}
- name: usrlocalsbin
mountPath: /usr/local/sbin
- name: cinder-bin
mountPath: /usr/local/sbin/iscsiadm
subPath: iscsiadm
{{- end }}
{{ if $mounts_cinder_volume.volumeMounts }}{{ toYaml $mounts_cinder_volume.volumeMounts | indent 12 }}{{ end }} {{ if $mounts_cinder_volume.volumeMounts }}{{ toYaml $mounts_cinder_volume.volumeMounts | indent 12 }}{{ end }}
volumes: volumes:
- name: pod-tmp - name: pod-tmp
@ -228,5 +247,18 @@ spec:
- name: cinder-coordination - name: cinder-coordination
emptyDir: {} emptyDir: {}
{{- end }} {{- end }}
{{- if .Values.conf.enable_iscsi }}
- name: host-rootfs
hostPath:
path: /
- name: runlock
hostPath:
path: /run/lock
- name: etciscsi
hostPath:
path: /etc/iscsi
- name: usrlocalsbin
emptyDir: {}
{{- end }}
{{ if $mounts_cinder_volume.volumes }}{{ toYaml $mounts_cinder_volume.volumes | indent 8 }}{{ end }} {{ if $mounts_cinder_volume.volumes }}{{ toYaml $mounts_cinder_volume.volumes | indent 8 }}{{ end }}
{{- end }} {{- end }}

View File

@ -143,7 +143,8 @@ pod:
default: kubernetes.io/hostname default: kubernetes.io/hostname
weight: weight:
default: 10 default: 10
useHostNetwork:
volume: false
mounts: mounts:
cinder_api: cinder_api:
init_container: null init_container: null
@ -1025,7 +1026,7 @@ conf:
- name - name
- volume_type - volume_type
volume_type: [] volume_type: []
enable_iscsi: false
backup: backup:
external_ceph_rbd: external_ceph_rbd:
enabled: false enabled: false

View File

@ -0,0 +1,20 @@
#!/bin/bash
{{/*
Copyright 2020 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.
*/}}
chroot /mnt/host-rootfs /usr/bin/env -i PATH="/sbin:/bin:/usr/bin" \
iscsiadm "${@:1}"

View File

@ -23,6 +23,10 @@ kind: ConfigMap
metadata: metadata:
name: nova-bin name: nova-bin
data: data:
{{- if .Values.conf.enable_iscsi }}
iscsiadm: |
{{ tuple "bin/_iscsiadm.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }}
{{- if .Values.images.local_registry.active }} {{- if .Values.images.local_registry.active }}
image-repo-sync.sh: | image-repo-sync.sh: |
{{- include "helm-toolkit.scripts.image_repo_sync" . | indent 4 }} {{- include "helm-toolkit.scripts.image_repo_sync" . | indent 4 }}

View File

@ -64,6 +64,7 @@ spec:
value: "{{ .Values.pod.user.nova.uid }}" value: "{{ .Values.pod.user.nova.uid }}"
command: command:
- /tmp/nova-compute-init.sh - /tmp/nova-compute-init.sh
terminationMessagePath: /var/log/termination-log
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
mountPath: /tmp mountPath: /tmp
@ -84,6 +85,7 @@ spec:
- -R - -R
- "nova:" - "nova:"
- /etc/ceph - /etc/ceph
terminationMessagePath: /var/log/termination-log
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
mountPath: /tmp mountPath: /tmp
@ -95,6 +97,7 @@ spec:
{{ dict "envAll" $envAll "application" "nova" "container" "ceph_admin_keyring_placement" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} {{ dict "envAll" $envAll "application" "nova" "container" "ceph_admin_keyring_placement" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
command: command:
- /tmp/ceph-admin-keyring.sh - /tmp/ceph-admin-keyring.sh
terminationMessagePath: /var/log/termination-log
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
mountPath: /tmp mountPath: /tmp
@ -125,6 +128,7 @@ spec:
value: "{{ .Values.conf.ceph.secret_uuid }}" value: "{{ .Values.conf.ceph.secret_uuid }}"
command: command:
- /tmp/ceph-keyring.sh - /tmp/ceph-keyring.sh
terminationMessagePath: /var/log/termination-log
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
mountPath: /tmp mountPath: /tmp
@ -145,6 +149,7 @@ spec:
{{ dict "envAll" $envAll "application" "nova" "container" "nova_compute_vnc_init" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} {{ dict "envAll" $envAll "application" "nova" "container" "nova_compute_vnc_init" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
command: command:
- /tmp/nova-console-compute-init.sh - /tmp/nova-console-compute-init.sh
terminationMessagePath: /var/log/termination-log
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
mountPath: /tmp mountPath: /tmp
@ -162,6 +167,7 @@ spec:
{{ dict "envAll" $envAll "application" "nova" "container" "nova_compute_spice_init" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} {{ dict "envAll" $envAll "application" "nova" "container" "nova_compute_spice_init" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
command: command:
- /tmp/nova-console-compute-init.sh - /tmp/nova-console-compute-init.sh
terminationMessagePath: /var/log/termination-log
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
mountPath: /tmp mountPath: /tmp
@ -223,6 +229,7 @@ spec:
timeoutSeconds: 580 timeoutSeconds: 580
command: command:
- /tmp/nova-compute.sh - /tmp/nova-compute.sh
terminationMessagePath: /var/log/termination-log
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
mountPath: /tmp mountPath: /tmp
@ -316,6 +323,25 @@ spec:
- name: machine-id - name: machine-id
mountPath: /etc/machine-id mountPath: /etc/machine-id
readOnly: true readOnly: true
{{- if .Values.conf.enable_iscsi }}
- name: host-rootfs
mountPath: /mnt/host-rootfs
- name: usrlocalsbin
mountPath: /usr/local/sbin
- name: etciscsi
mountPath: /etc/iscsi
{{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "10" ) }}
mountPropagation: Bidirectional
{{- end }}
- name: dev
mountPath: /dev
{{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "10" ) }}
mountPropagation: Bidirectional
{{- end }}
- name: nova-bin
mountPath: /usr/local/sbin/iscsiadm
subPath: iscsiadm
{{- end }}
{{ if $mounts_nova_compute.volumeMounts }}{{ toYaml $mounts_nova_compute.volumeMounts | indent 12 }}{{ end }} {{ if $mounts_nova_compute.volumeMounts }}{{ toYaml $mounts_nova_compute.volumeMounts | indent 12 }}{{ end }}
{{- if .Values.network.sshd.enabled }} {{- if .Values.network.sshd.enabled }}
- name: nova-compute-ssh - name: nova-compute-ssh
@ -333,6 +359,7 @@ spec:
- containerPort: {{ .Values.network.ssh.port }} - containerPort: {{ .Values.network.ssh.port }}
command: command:
- /tmp/ssh-start.sh - /tmp/ssh-start.sh
terminationMessagePath: /var/log/termination-log
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
mountPath: /tmp mountPath: /tmp
@ -400,6 +427,19 @@ spec:
- name: machine-id - name: machine-id
hostPath: hostPath:
path: /etc/machine-id path: /etc/machine-id
{{- if .Values.conf.enable_iscsi }}
- name: host-rootfs
hostPath:
path: /
- name: etciscsi
hostPath:
path: /etc/iscsi
- name: dev
hostPath:
path: /dev
- name: usrlocalsbin
emptyDir: {}
{{- end }}
{{ if $mounts_nova_compute.volumes }}{{ toYaml $mounts_nova_compute.volumes | indent 8 }}{{ end }} {{ if $mounts_nova_compute.volumes }}{{ toYaml $mounts_nova_compute.volumes | indent 8 }}{{ end }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -1759,6 +1759,7 @@ conf:
keys: keys:
- root - root
- nova - nova
- os.brick
handlers: handlers:
keys: keys:
- stdout - stdout
@ -1776,6 +1777,11 @@ conf:
handlers: handlers:
- stdout - stdout
qualname: nova qualname: nova
logger_os.brick:
level: INFO
handlers:
- stdout
qualname: os.brick
logger_amqp: logger_amqp:
level: WARNING level: WARNING
handlers: stderr handlers: stderr
@ -1828,6 +1834,7 @@ conf:
priority: 0 priority: 0
apply-to: all apply-to: all
pattern: '^(?!(amq\.|reply_)).*' pattern: '^(?!(amq\.|reply_)).*'
enable_iscsi: false
# Names of secrets used by bootstrap and environmental checks # Names of secrets used by bootstrap and environmental checks
secrets: secrets: