From f3b1be7bde77135ea6191e329fd3cc3ecfd30438 Mon Sep 17 00:00:00 2001 From: Pavlo Shchelokovskyy Date: Wed, 13 Feb 2019 18:40:57 +0000 Subject: [PATCH] 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 --- ironic/templates/bin/_bootstrap.sh.tpl | 2 +- ironic/templates/bin/_ironic-api.sh.tpl | 9 ++- ironic/templates/bin/_ironic-conductor.sh.tpl | 10 ++- ironic/templates/configmap-bin.yaml | 2 +- ironic/templates/deployment-api.yaml | 4 + ironic/templates/job-bootstrap.yaml | 8 +- ironic/templates/statefulset-conductor.yaml | 4 + ironic/values.yaml | 73 +++++++++++-------- .../baremetal/ironic-standalone.yaml | 60 +++++++++++++++ 9 files changed, 133 insertions(+), 39 deletions(-) create mode 100644 tools/overrides/deployment/baremetal/ironic-standalone.yaml diff --git a/ironic/templates/bin/_bootstrap.sh.tpl b/ironic/templates/bin/_bootstrap.sh.tpl index 533c0a5a3f..403d25bd91 100644 --- a/ironic/templates/bin/_bootstrap.sh.tpl +++ b/ironic/templates/bin/_bootstrap.sh.tpl @@ -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'" }} diff --git a/ironic/templates/bin/_ironic-api.sh.tpl b/ironic/templates/bin/_ironic-api.sh.tpl index 6c6c8225ca..8825aecdae 100644 --- a/ironic/templates/bin/_ironic-api.sh.tpl +++ b/ironic/templates/bin/_ironic-api.sh.tpl @@ -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 () { diff --git a/ironic/templates/bin/_ironic-conductor.sh.tpl b/ironic/templates/bin/_ironic-conductor.sh.tpl index a59e68738c..8090118186 100644 --- a/ironic/templates/bin/_ironic-conductor.sh.tpl +++ b/ironic/templates/bin/_ironic-conductor.sh.tpl @@ -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} diff --git a/ironic/templates/configmap-bin.yaml b/ironic/templates/configmap-bin.yaml index 4b2d254b67..ab217ffd76 100644 --- a/ironic/templates/configmap-bin.yaml +++ b/ironic/templates/configmap-bin.yaml @@ -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 }} diff --git a/ironic/templates/deployment-api.yaml b/ironic/templates/deployment-api.yaml index 6882adba22..5ed71bbf4f 100644 --- a/ironic/templates/deployment-api.yaml +++ b/ironic/templates/deployment-api.yaml @@ -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 }} diff --git a/ironic/templates/job-bootstrap.yaml b/ironic/templates/job-bootstrap.yaml index fa1b10961f..b4b0b06d81 100644 --- a/ironic/templates/job-bootstrap.yaml +++ b/ironic/templates/job-bootstrap.yaml @@ -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 }} diff --git a/ironic/templates/statefulset-conductor.yaml b/ironic/templates/statefulset-conductor.yaml index fbbc17a53a..cf6414e6c7 100644 --- a/ironic/templates/statefulset-conductor.yaml +++ b/ironic/templates/statefulset-conductor.yaml @@ -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 }} diff --git a/ironic/values.yaml b/ironic/values.yaml index a3fc4b5c0b..b2e07d9504 100644 --- a/ironic/values.yaml +++ b/ironic/values.yaml @@ -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: diff --git a/tools/overrides/deployment/baremetal/ironic-standalone.yaml b/tools/overrides/deployment/baremetal/ironic-standalone.yaml new file mode 100644 index 0000000000..0cca81b0ee --- /dev/null +++ b/tools/overrides/deployment/baremetal/ironic-standalone.yaml @@ -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