ironic: make conductor statefulset more configurable
Made the conductor statefulset more configurable by allowing the user to enable/disable the http or pxe containers and to modify their init and/or runtime scripts. Allow another OS to potentially be used by letting the user supply the HOST_OS value and FILEPATH. Simplify the code by using the variables already defined. Include the snponly image as the counterpart to undionly. Change-Id: I181657bca6ace0f94f6e0ef0b6f8a5bc7a433ac3
This commit is contained in:
parent
27cfc11310
commit
510ee6c0df
@ -14,7 +14,7 @@ apiVersion: v1
|
||||
appVersion: v1.0.0
|
||||
description: OpenStack-Helm Ironic
|
||||
name: ironic
|
||||
version: 0.2.14
|
||||
version: 0.2.15
|
||||
home: https://docs.openstack.org/ironic/latest/
|
||||
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Ironic/OpenStack_Project_Ironic_vertical.png
|
||||
sources:
|
||||
|
@ -1,37 +0,0 @@
|
||||
#!/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 [ "x" == "x${PROVISIONER_INTERFACE}" ]; then
|
||||
echo "Provisioner interface is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function net_pxe_addr {
|
||||
ip addr | awk "/inet / && /${PROVISIONER_INTERFACE}/{print \$2; exit }"
|
||||
}
|
||||
function net_pxe_ip {
|
||||
echo $(net_pxe_addr) | awk -F '/' '{ print $1; exit }'
|
||||
}
|
||||
PXE_IP=$(net_pxe_ip)
|
||||
|
||||
if [ "x" == "x${PXE_IP}" ]; then
|
||||
echo "Could not find IP for pxe to bind to"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed "s|OSH_PXE_IP|${PXE_IP}|g" /etc/nginx/nginx.conf > /tmp/pod-shared/nginx.conf
|
@ -1,21 +0,0 @@
|
||||
#!/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
|
||||
|
||||
mkdir -p /var/lib/openstack-helm/httpboot
|
||||
cp -v /tmp/pod-shared/nginx.conf /etc/nginx/nginx.conf
|
||||
exec nginx -g 'daemon off;'
|
@ -1,60 +0,0 @@
|
||||
#!/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
|
||||
|
||||
. /etc/os-release
|
||||
HOST_OS=${HOST_OS:="${ID}"}
|
||||
FILEPATH=${FILEPATH:-/usr/lib/ipxe}
|
||||
|
||||
if [ "x$ID" == "xubuntu" ]; then
|
||||
#NOTE(portdirect): this works around a limitation in Kolla images
|
||||
if ! dpkg -l ipxe; then
|
||||
apt-get update
|
||||
apt-get install ipxe -y
|
||||
fi
|
||||
|
||||
FILEPATH=/usr/lib/ipxe
|
||||
|
||||
elif [ "x$ID" == "xcentos" ]; then
|
||||
|
||||
if ! yum list installed ipxe-bootimgs >/dev/null 2>&1; then
|
||||
yum update --nogpgcheck -y
|
||||
yum install ipxe-bootimgs syslinux-tftpboot --nogpgcheck -y
|
||||
fi
|
||||
|
||||
FILEPATH=/usr/share/ipxe
|
||||
|
||||
fi
|
||||
|
||||
mkdir -p /var/lib/openstack-helm/tftpboot
|
||||
mkdir -p /var/lib/openstack-helm/tftpboot/master_images
|
||||
|
||||
for FILE in undionly.kpxe ipxe.efi pxelinux.0; do
|
||||
if [ -f /usr/lib/ipxe/$FILE ]; then
|
||||
cp -v /usr/lib/ipxe/$FILE /var/lib/openstack-helm/tftpboot
|
||||
fi
|
||||
|
||||
# ipxe and pxe support for CentOS
|
||||
if [ "x$ID" == "xcentos" ]; then
|
||||
if [ -f /var/lib/tftpboot/$FILE ]; then
|
||||
cp -v /var/lib/tftpboot/$FILE /var/lib/openstack-helm/tftpboot
|
||||
fi
|
||||
if [ -f /usr/share/ipxe/$FILE ]; then
|
||||
cp -v /usr/share/ipxe/$FILE /var/lib/openstack-helm/tftpboot
|
||||
fi
|
||||
fi
|
||||
done
|
@ -1,37 +0,0 @@
|
||||
#!/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
|
||||
function net_pxe_addr {
|
||||
ip addr | awk "/inet / && /${PROVISIONER_INTERFACE}/{print \$2; exit }"
|
||||
}
|
||||
function net_pxe_ip {
|
||||
echo $(net_pxe_addr) | awk -F '/' '{ print $1; exit }'
|
||||
}
|
||||
PXE_IP=$(net_pxe_ip)
|
||||
|
||||
if [ "x" == "x${PXE_IP}" ]; then
|
||||
echo "Could not find IP for pxe to bind to"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ln -s /var/lib/openstack-helm/tftpboot /tftpboot
|
||||
exec /usr/sbin/in.tftpd \
|
||||
--verbose \
|
||||
--foreground \
|
||||
--user root \
|
||||
--address ${PXE_IP}:69 \
|
||||
--map-file /tftp-map-file /tftpboot
|
@ -52,14 +52,14 @@ data:
|
||||
{{ tuple "bin/_ironic-conductor.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
ironic-conductor-init.sh: |
|
||||
{{ tuple "bin/_ironic-conductor-init.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
ironic-conductor-pxe.sh: |
|
||||
{{ tuple "bin/_ironic-conductor-pxe.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
ironic-conductor-pxe-init.sh: |
|
||||
{{ tuple "bin/_ironic-conductor-pxe-init.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
ironic-conductor-http.sh: |
|
||||
{{ tuple "bin/_ironic-conductor-http.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
ironic-conductor-http-init.sh: |
|
||||
{{ tuple "bin/_ironic-conductor-http-init.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
{{- if .Values.conductor.pxe.enabled }}
|
||||
{{ include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conductor.pxe.script "key" "ironic-conductor-pxe.sh") | indent 2 }}
|
||||
{{ include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conductor.pxe.init_script "key" "ironic-conductor-pxe-init.sh") | indent 2 }}
|
||||
{{ end }}
|
||||
{{- if .Values.conductor.http.enabled }}
|
||||
{{ include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conductor.http.script "key" "ironic-conductor-http.sh") | indent 2 }}
|
||||
{{ include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conductor.http.init_script "key" "ironic-conductor-http-init.sh") | indent 2 }}
|
||||
{{ end }}
|
||||
rabbit-init.sh: |
|
||||
{{- include "helm-toolkit.scripts.rabbit_init" . | indent 4 }}
|
||||
{{- end }}
|
||||
|
@ -59,6 +59,7 @@ spec:
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
initContainers:
|
||||
{{ tuple $envAll "conductor" $mounts_ironic_conductor_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
|
||||
{{- if $envAll.Values.conductor.pxe.enabled }}
|
||||
- name: ironic-conductor-pxe-init
|
||||
{{ tuple $envAll "ironic_pxe_init" | include "helm-toolkit.snippets.image" | indent 10 }}
|
||||
{{ tuple $envAll $envAll.Values.pod.resources.conductor | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
||||
@ -73,6 +74,7 @@ spec:
|
||||
readOnly: true
|
||||
- name: pod-data
|
||||
mountPath: /var/lib/openstack-helm
|
||||
{{- end }}
|
||||
- name: ironic-conductor-init
|
||||
{{ tuple $envAll "ironic_conductor" | include "helm-toolkit.snippets.image" | indent 10 }}
|
||||
{{ tuple $envAll $envAll.Values.pod.resources.conductor | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
||||
@ -90,6 +92,7 @@ spec:
|
||||
readOnly: true
|
||||
- name: pod-shared
|
||||
mountPath: /tmp/pod-shared
|
||||
{{- if $envAll.Values.conductor.http.enabled }}
|
||||
- name: ironic-conductor-http-init
|
||||
{{ tuple $envAll "ironic_conductor" | include "helm-toolkit.snippets.image" | indent 10 }}
|
||||
{{ tuple $envAll $envAll.Values.pod.resources.conductor | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
||||
@ -111,6 +114,7 @@ spec:
|
||||
readOnly: true
|
||||
- name: pod-shared
|
||||
mountPath: /tmp/pod-shared
|
||||
{{- end }}
|
||||
{{- if and (.Values.bootstrap.object_store.enabled) (.Values.bootstrap.object_store.openstack.enabled) }}
|
||||
- name: ironic-retrive-swift-config
|
||||
{{ tuple $envAll "ironic_retrive_swift_config" | include "helm-toolkit.snippets.image" | indent 10 }}
|
||||
@ -198,6 +202,7 @@ spec:
|
||||
- name: pod-data
|
||||
mountPath: /var/lib/openstack-helm
|
||||
{{ if $mounts_ironic_conductor.volumeMounts }}{{ toYaml $mounts_ironic_conductor.volumeMounts | indent 12 }}{{ end }}
|
||||
{{- if $envAll.Values.conductor.pxe.enabled }}
|
||||
- name: ironic-conductor-pxe
|
||||
{{ tuple $envAll "ironic_pxe" | include "helm-toolkit.snippets.image" | indent 10 }}
|
||||
{{ tuple $envAll $envAll.Values.pod.resources.conductor | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
||||
@ -221,6 +226,8 @@ spec:
|
||||
readOnly: true
|
||||
- name: pod-data
|
||||
mountPath: /var/lib/openstack-helm
|
||||
{{- end }}
|
||||
{{- if $envAll.Values.conductor.http.enabled }}
|
||||
- name: ironic-conductor-http
|
||||
{{ tuple $envAll "ironic_pxe_http" | include "helm-toolkit.snippets.image" | indent 10 }}
|
||||
{{ tuple $envAll $envAll.Values.pod.resources.conductor | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
||||
@ -239,6 +246,7 @@ spec:
|
||||
- name: pod-data
|
||||
mountPath: /var/lib/openstack-helm
|
||||
{{ if $mounts_ironic_conductor.volumeMounts }}{{ toYaml $mounts_ironic_conductor.volumeMounts | indent 12 }}{{ end }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: pod-tmp
|
||||
emptyDir: {}
|
||||
|
@ -201,6 +201,79 @@ conf:
|
||||
format: "%(message)s"
|
||||
datefmt: "%Y-%m-%d %H:%M:%S"
|
||||
|
||||
conductor:
|
||||
http:
|
||||
enabled: true
|
||||
init_script: |
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
if [ "x" == "x${PROVISIONER_INTERFACE}" ]; then
|
||||
echo "Provisioner interface is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function net_pxe_addr {
|
||||
ip addr | awk "/inet / && /${PROVISIONER_INTERFACE}/{print \$2; exit }"
|
||||
}
|
||||
function net_pxe_ip {
|
||||
echo $(net_pxe_addr) | awk -F '/' '{ print $1; exit }'
|
||||
}
|
||||
PXE_IP=$(net_pxe_ip)
|
||||
|
||||
if [ "x" == "x${PXE_IP}" ]; then
|
||||
echo "Could not find IP for pxe to bind to"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed "s|OSH_PXE_IP|${PXE_IP}|g" /etc/nginx/nginx.conf > /tmp/pod-shared/nginx.conf
|
||||
script: |
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
mkdir -p /var/lib/openstack-helm/httpboot
|
||||
cp -v /tmp/pod-shared/nginx.conf /etc/nginx/nginx.conf
|
||||
exec nginx -g 'daemon off;'
|
||||
pxe:
|
||||
enabled: true
|
||||
init_script: |
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
# default to Ubuntu path
|
||||
FILEPATH=${FILEPATH:-/usr/lib/ipxe}
|
||||
|
||||
mkdir -p /var/lib/openstack-helm/tftpboot
|
||||
mkdir -p /var/lib/openstack-helm/tftpboot/master_images
|
||||
|
||||
for FILE in undionly.kpxe ipxe.efi pxelinux.0 snponly.efi; do
|
||||
# copy in default file
|
||||
if [ -f $FILEPATH/$FILE ]; then
|
||||
cp -v $FILEPATH/$FILE /var/lib/openstack-helm/tftpboot
|
||||
fi
|
||||
|
||||
done
|
||||
script: |
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
function net_pxe_addr {
|
||||
ip addr | awk "/inet / && /${PROVISIONER_INTERFACE}/{print \$2; exit }"
|
||||
}
|
||||
function net_pxe_ip {
|
||||
echo $(net_pxe_addr) | awk -F '/' '{ print $1; exit }'
|
||||
}
|
||||
PXE_IP=$(net_pxe_ip)
|
||||
|
||||
if [ "x" == "x${PXE_IP}" ]; then
|
||||
echo "Could not find IP for pxe to bind to"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ln -s /var/lib/openstack-helm/tftpboot /tftpboot
|
||||
exec /usr/sbin/in.tftpd \
|
||||
--verbose \
|
||||
--foreground \
|
||||
--user root \
|
||||
--address ${PXE_IP}:69 \
|
||||
--map-file /tftp-map-file /tftpboot
|
||||
|
||||
network:
|
||||
pxe:
|
||||
device: ironic-pxe
|
||||
|
@ -18,4 +18,5 @@ ironic:
|
||||
- 0.2.12 allow custom annotations on jobs
|
||||
- 0.2.13 Enable custom annotations for Openstack secrets
|
||||
- 0.2.14 Update images used by default
|
||||
- 0.2.15 Allow enabling/disabling of conductor http and pxe containers and overriding their init and runtime scripts
|
||||
...
|
||||
|
Loading…
Reference in New Issue
Block a user