Allow manila properly config network host

This allow manila to respect fqdn host config for share network host

Depends-On: https://review.opendev.org/c/openstack/manila/+/897077

Change-Id: I8393f2b130c8c8914d946a1772fff08ff8b58652
This commit is contained in:
ricolin 2023-09-29 00:59:10 +08:00
parent 1a885ddd1f
commit 51235e8b03
7 changed files with 59 additions and 3 deletions

View File

@ -14,7 +14,7 @@ apiVersion: v1
appVersion: v1.0.0
description: OpenStack-Helm Manila
name: manila
version: 0.1.6
version: 0.1.7
home: https://docs.openstack.org/manila/latest/
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Manila/OpenStack_Project_Manila_vertical.png
sources:

View File

@ -0,0 +1,24 @@
#!/bin/bash
{{/*
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.
*/}}
set -ex
{{- if and ( empty .Values.conf.manila.generic.service_network_host ) ( .Values.pod.use_fqdn.share ) }}
tee > /tmp/pod-shared/manila-share-fqdn.conf << EOF
[generic]
service_network_host = $(hostname --fqdn)
EOF
{{- end }}

View File

@ -16,4 +16,7 @@ limitations under the License.
set -ex
exec manila-share \
--config-file /etc/manila/manila.conf
--config-file /etc/manila/manila.conf \
{{- if and ( empty .Values.conf.manila.generic.service_network_host ) ( .Values.pod.use_fqdn.share ) }}
--config-file /tmp/pod-shared/manila-share-fqdn.conf
{{- end }}

View File

@ -45,6 +45,8 @@ data:
{{- include "helm-toolkit.scripts.keystone_user" . | indent 4 }}
rabbit-init.sh: |
{{- include "helm-toolkit.scripts.rabbit_init" . | indent 4 }}
manila-share-init.sh: |
{{ tuple "bin/_manila-share-init.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
manila-api.sh: |
{{ tuple "bin/_manila-api.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
manila-data.sh: |

View File

@ -43,7 +43,7 @@ spec:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
{{ dict "envAll" $envAll "podName" "manila-share" "containerNames" (list "init" "manila-share") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
{{ dict "envAll" $envAll "podName" "manila-share" "containerNames" (list "init" "manila-share" "manila-share-init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
spec:
{{ dict "envAll" $envAll "application" "manila" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
serviceAccountName: {{ $serviceAccountName }}
@ -58,6 +58,22 @@ spec:
hostNetwork: true
initContainers:
{{ tuple $envAll "share" $mounts_manila_share_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
- name: manila-share-init
{{ tuple $envAll "manila_share" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ dict "envAll" $envAll "application" "manila" "container" "manila_share" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
env: []
command:
- /tmp/manila-share-init.sh
volumeMounts:
- name: pod-tmp
mountPath: /tmp
- name: manila-bin
mountPath: /tmp/manila-share-init.sh
subPath: manila-share-init.sh
readOnly: true
- name: pod-shared
mountPath: /tmp/pod-shared
{{ if $mounts_manila_share.volumeMounts }}{{ toYaml $mounts_manila_share.volumeMounts | indent 12 }}{{ end }}
containers:
- name: manila-share
{{ tuple $envAll "manila_share" | include "helm-toolkit.snippets.image" | indent 10 }}
@ -73,6 +89,8 @@ spec:
volumeMounts:
- name: pod-tmp
mountPath: /tmp
- name: pod-shared
mountPath: /tmp/pod-shared
- name: etcmanila
mountPath: /etc/manila
- name: state-tmp
@ -127,6 +145,8 @@ spec:
volumes:
- name: pod-tmp
emptyDir: {}
- name: pod-shared
emptyDir: {}
- name: state-tmp
emptyDir: {}
- name: etcmanila

View File

@ -90,6 +90,12 @@ pod:
manila_test:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
use_fqdn:
# NOTE: Setting the option here to true will cause use $(hostname --fqdn)
# as the host name by default. If the short name is desired
# $(hostname --short), set the option to false. Specifying a host in the
# manila.conf via the conf section will supersede the value of this option.
share: true
affinity:
anti:
type:

View File

@ -7,4 +7,5 @@ manila:
- 0.1.4 Add Ubuntu Jammy overrides
- 0.1.5 Update port name of service-api.yaml
- 0.1.6 Add 2023.2 Ubuntu Jammy overrides
- 0.1.7 Properly config network host for share service
...