Add preliminary support for standalone ironic

currently ironic chart is quite entangled with the presense of
other openstack services (Glance, Neutron, Swift).

Ironic is capable of running completely standalone, and while
the keystone and some neutron-related pieces are implemented as jobs
and can be turned off in manifests and dependencies sections of values,
others are scripts running as initContainers and are not the easy to
switch off.

This patch adds more key/values to the bootstrap key,
which allows to turn off Neutron-, Swift- and Glance-related pieces
while keeping possibility that some other networking, image or
object_store actions appropriate for standalone case may be needed.

Change-Id: Icccbdbce81ca350042f33f5e86bb942064839267
This commit is contained in:
Pavlo Shchelokovskyy 2019-02-13 18:40:57 +00:00 committed by Oleh Hryhorov
parent 46ff6c3037
commit f3b1be7bde
9 changed files with 133 additions and 39 deletions

View File

@ -17,4 +17,4 @@ limitations under the License.
*/}}
set -ex
{{ .Values.bootstrap.script | default "echo 'Not Enabled'" }}
{{ .Values.bootstrap.image.script | default "echo 'Not Enabled'" }}

View File

@ -18,12 +18,17 @@ limitations under the License.
set -ex
COMMAND="${@:-start}"
{{- if and (.Values.bootstrap.object_store.enabled) (.Values.bootstrap.object_store.openstack.enabled) }}
OPTIONS=" --config-file /tmp/pod-shared/swift.conf"
{{- end }}
{{- if and (.Values.bootstrap.network.enabled) (.Values.bootstrap.network.openstack.enabled) }}
OPTIONS="${OPTIONS} --config-file /tmp/pod-shared/cleaning-network.conf"
{{- end }}
function start () {
exec ironic-api \
--config-file /etc/ironic/ironic.conf \
--config-file /tmp/pod-shared/swift.conf \
--config-file /tmp/pod-shared/cleaning-network.conf
${OPTIONS}
}
function stop () {

View File

@ -21,8 +21,14 @@ set -ex
mkdir -p /var/lib/openstack-helm/ironic/images
mkdir -p /var/lib/openstack-helm/ironic/master_images
{{- if and (.Values.bootstrap.object_store.enabled) (.Values.bootstrap.object_store.openstack.enabled) }}
OPTIONS=" --config-file /tmp/pod-shared/swift.conf"
{{- end }}
{{- if and (.Values.bootstrap.network.enabled) (.Values.bootstrap.network.openstack.enabled) }}
OPTIONS="${OPTIONS} --config-file /tmp/pod-shared/cleaning-network.conf"
{{- end }}
exec ironic-conductor \
--config-file /etc/ironic/ironic.conf \
--config-file /tmp/pod-shared/conductor-local-ip.conf \
--config-file /tmp/pod-shared/swift.conf \
--config-file /tmp/pod-shared/cleaning-network.conf
${OPTIONS}

View File

@ -26,7 +26,7 @@ data:
image-repo-sync.sh: |
{{- include "helm-toolkit.scripts.image_repo_sync" . | indent 4 }}
{{- end }}
{{- if .Values.bootstrap.enabled }}
{{- if .Values.bootstrap.image.enabled }}
bootstrap.sh: |
{{ tuple "bin/_bootstrap.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }}

View File

@ -54,6 +54,7 @@ spec:
terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.api.timeout | default "30" }}
initContainers:
{{ tuple $envAll "api" $mounts_ironic_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
{{- 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 }}
{{ tuple $envAll $envAll.Values.pod.resources.conductor | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
@ -72,6 +73,8 @@ spec:
readOnly: true
- name: pod-shared
mountPath: /tmp/pod-shared
{{- end }}
{{- if and (.Values.bootstrap.network.enabled) (.Values.bootstrap.network.openstack.enabled) }}
- name: ironic-retrive-cleaning-net
{{ tuple $envAll "ironic_retrive_cleaning_network" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.conductor | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
@ -89,6 +92,7 @@ spec:
readOnly: true
- name: pod-shared
mountPath: /tmp/pod-shared
{{- end }}
containers:
- name: ironic-api
{{ tuple $envAll "ironic_api" | include "helm-toolkit.snippets.image" | indent 10 }}

View File

@ -14,7 +14,11 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if and .Values.manifests.job_bootstrap .Values.bootstrap.enabled }}
{{- $bootstrapJob := dict "envAll" . "serviceName" "ironic" "keystoneUser" .Values.bootstrap.ks_user "logConfigFile" .Values.conf.ironic.DEFAULT.log_config_append -}}
{{- if and .Values.manifests.job_bootstrap .Values.bootstrap.image.enabled }}
{{- if .Values.bootstrap.image.openstack.enabled }}
{{- $bootstrapJob := dict "envAll" . "serviceName" "ironic" "keystoneUser" .Values.bootstrap.image.openstack.ks_user "logConfigFile" .Values.conf.ironic.DEFAULT.log_config_append -}}
{{ $bootstrapJob | include "helm-toolkit.manifests.job_bootstrap" }}
{{- else }}
{{ include "helm-toolkit.manifests.job_bootstrap" }}
{{- end }}
{{- end }}

View File

@ -102,6 +102,7 @@ spec:
readOnly: true
- name: pod-shared
mountPath: /tmp/pod-shared
{{- 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 }}
{{ tuple $envAll $envAll.Values.pod.resources.conductor | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
@ -120,6 +121,8 @@ spec:
readOnly: true
- name: pod-shared
mountPath: /tmp/pod-shared
{{- end }}
{{- if and (.Values.bootstrap.network.enabled) (.Values.bootstrap.network.openstack.enabled) }}
- name: ironic-retrive-cleaning-net
{{ tuple $envAll "ironic_retrive_cleaning_network" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.conductor | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
@ -137,6 +140,7 @@ spec:
readOnly: true
- name: pod-shared
mountPath: /tmp/pod-shared
{{- end }}
containers:
- name: ironic-conductor
{{ tuple $envAll "ironic_conductor" | include "helm-toolkit.snippets.image" | indent 10 }}

View File

@ -223,37 +223,48 @@ network:
port: 30511
bootstrap:
enabled: true
ks_user: ironic
script: |
RELEASE="ocata"
IMAGE_URL_BASE="http://tarballs.openstack.org/ironic-python-agent/tinyipa/files"
IMAGE_INITRAMFS="ironic-agent.initramfs"
IMAGE_INITRAMFS_URL="${IMAGE_URL_BASE}/tinyipa-stable-${RELEASE}.gz"
IMAGE_KERNEL="ironic-agent.kernel"
IMAGE_KERNEL_URL="${IMAGE_URL_BASE}/tinyipa-stable-${RELEASE}.vmlinuz"
openstack image show ${IMAGE_INITRAMFS} || (
IMAGE_LOC=$(mktemp)
curl -L ${IMAGE_INITRAMFS_URL} -o ${IMAGE_LOC}
openstack image create \
--file ${IMAGE_LOC} \
--disk-format ari \
--container-format ari \
--public \
${IMAGE_INITRAMFS}
rm -f ${IMAGE_LOC}
)
openstack image show ${IMAGE_KERNEL} || (
IMAGE_LOC=$(mktemp)
curl -L ${IMAGE_KERNEL_URL} -o ${IMAGE_LOC}
openstack image create \
--file ${IMAGE_LOC} \
--disk-format aki \
--container-format aki \
--public \
${IMAGE_KERNEL}
rm -f ${IMAGE_LOC}
)
image:
enabled: true
openstack:
enabled: true
ks_user: ironic
script: |
RELEASE="ocata"
IMAGE_URL_BASE="http://tarballs.openstack.org/ironic-python-agent/tinyipa/files"
IMAGE_INITRAMFS="ironic-agent.initramfs"
IMAGE_INITRAMFS_URL="${IMAGE_URL_BASE}/tinyipa-stable-${RELEASE}.gz"
IMAGE_KERNEL="ironic-agent.kernel"
IMAGE_KERNEL_URL="${IMAGE_URL_BASE}/tinyipa-stable-${RELEASE}.vmlinuz"
openstack image show ${IMAGE_INITRAMFS} || (
IMAGE_LOC=$(mktemp)
curl -L ${IMAGE_INITRAMFS_URL} -o ${IMAGE_LOC}
openstack image create \
--file ${IMAGE_LOC} \
--disk-format ari \
--container-format ari \
--public \
${IMAGE_INITRAMFS}
rm -f ${IMAGE_LOC}
)
openstack image show ${IMAGE_KERNEL} || (
IMAGE_LOC=$(mktemp)
curl -L ${IMAGE_KERNEL_URL} -o ${IMAGE_LOC}
openstack image create \
--file ${IMAGE_LOC} \
--disk-format aki \
--container-format aki \
--public \
${IMAGE_KERNEL}
rm -f ${IMAGE_LOC}
)
network:
enabled: true
openstack:
enabled: true
object_store:
enabled: true
openstack:
enabled: true
dependencies:
dynamic:

View File

@ -0,0 +1,60 @@
conf:
ironic:
DEFAULT:
auth_strategy: noauth
conductor:
automated_clean: false
dhcp:
dhcp_provider: none
network:
pxe:
device: br-simulator
bootstrap:
image:
enabled: false
openstack:
enabled: false
network:
enabled: false
openstack:
enabled: false
object_store:
enabled: false
openstack:
enabled: false
dependencies:
static:
api:
jobs:
- ironic-rabbit-init
services:
- endpoint: internal
service: oslo_db
- endpoint: internal
service: oslo_messaging
bootstrap:
jobs: null
services: null
conductor:
jobs:
- ironic-rabbit-init
services:
- endpoint: internal
service: oslo_db
- endpoint: internal
service: oslo_messaging
secrets:
identity:
admin: ironic-keystone-admin
ironic: ironic-keystone-user
manifests:
job_ks_endpoints: false
job_ks_service: false
job_ks_user: false
job_manage_cleaning_network: false
secret_keystone: false