From 60d01e54cc98c59f917bdf744c8c13cd11ad95cc Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Mon, 1 May 2017 11:49:31 -0500 Subject: [PATCH] Nova: move to startup scripts. This PS moves the container start commands to scripts, which makes debugging and overriding of container launch params easier. Change-Id: Ibf5cda2218111360183b8a5eb993c717be84076c --- nova/templates/bin/_nova-api-metadata.sh.tpl | 19 +++++++++++++++++++ nova/templates/bin/_nova-api-osapi.sh.tpl | 19 +++++++++++++++++++ nova/templates/bin/_nova-compute.sh.tpl | 19 +++++++++++++++++++ nova/templates/bin/_nova-conductor.sh.tpl | 19 +++++++++++++++++++ nova/templates/bin/_nova-consoleauth.sh.tpl | 19 +++++++++++++++++++ nova/templates/bin/_nova-scheduler.sh.tpl | 19 +++++++++++++++++++ nova/templates/configmap-bin.yaml | 12 ++++++++++++ nova/templates/daemonset-compute.yaml | 12 +++++++++--- nova/templates/daemonset-libvirt.yaml | 14 +++++++------- nova/templates/deployment-api-metadata.yaml | 13 ++++++++++--- nova/templates/deployment-api-osapi.yaml | 13 ++++++++++--- nova/templates/deployment-conductor.yaml | 12 +++++++++--- nova/templates/deployment-consoleauth.yaml | 12 +++++++++--- nova/templates/deployment-scheduler.yaml | 12 +++++++++--- 14 files changed, 189 insertions(+), 25 deletions(-) create mode 100644 nova/templates/bin/_nova-api-metadata.sh.tpl create mode 100644 nova/templates/bin/_nova-api-osapi.sh.tpl create mode 100644 nova/templates/bin/_nova-compute.sh.tpl create mode 100644 nova/templates/bin/_nova-conductor.sh.tpl create mode 100644 nova/templates/bin/_nova-consoleauth.sh.tpl create mode 100644 nova/templates/bin/_nova-scheduler.sh.tpl diff --git a/nova/templates/bin/_nova-api-metadata.sh.tpl b/nova/templates/bin/_nova-api-metadata.sh.tpl new file mode 100644 index 0000000000..0a2ce4cce5 --- /dev/null +++ b/nova/templates/bin/_nova-api-metadata.sh.tpl @@ -0,0 +1,19 @@ +#!/bin/bash + +# Copyright 2017 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. + +set -x +exec nova-api-metadata \ + --config-file /etc/nova/nova.conf diff --git a/nova/templates/bin/_nova-api-osapi.sh.tpl b/nova/templates/bin/_nova-api-osapi.sh.tpl new file mode 100644 index 0000000000..2170d1e426 --- /dev/null +++ b/nova/templates/bin/_nova-api-osapi.sh.tpl @@ -0,0 +1,19 @@ +#!/bin/bash + +# Copyright 2017 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. + +set -x +exec nova-api \ + --config-file /etc/nova/nova.conf diff --git a/nova/templates/bin/_nova-compute.sh.tpl b/nova/templates/bin/_nova-compute.sh.tpl new file mode 100644 index 0000000000..7e98c10db3 --- /dev/null +++ b/nova/templates/bin/_nova-compute.sh.tpl @@ -0,0 +1,19 @@ +#!/bin/bash + +# Copyright 2017 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. + +set -x +exec nova-compute \ + --config-file /etc/nova/nova.conf diff --git a/nova/templates/bin/_nova-conductor.sh.tpl b/nova/templates/bin/_nova-conductor.sh.tpl new file mode 100644 index 0000000000..39022af188 --- /dev/null +++ b/nova/templates/bin/_nova-conductor.sh.tpl @@ -0,0 +1,19 @@ +#!/bin/bash + +# Copyright 2017 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. + +set -x +exec nova-conductor \ + --config-file /etc/nova/nova.conf diff --git a/nova/templates/bin/_nova-consoleauth.sh.tpl b/nova/templates/bin/_nova-consoleauth.sh.tpl new file mode 100644 index 0000000000..67919d7ac8 --- /dev/null +++ b/nova/templates/bin/_nova-consoleauth.sh.tpl @@ -0,0 +1,19 @@ +#!/bin/bash + +# Copyright 2017 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. + +set -x +exec nova-consoleauth \ + --config-file /etc/nova/nova.conf diff --git a/nova/templates/bin/_nova-scheduler.sh.tpl b/nova/templates/bin/_nova-scheduler.sh.tpl new file mode 100644 index 0000000000..d861cdaae4 --- /dev/null +++ b/nova/templates/bin/_nova-scheduler.sh.tpl @@ -0,0 +1,19 @@ +#!/bin/bash + +# Copyright 2017 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. + +set -x +exec nova-scheduler \ + --config-file /etc/nova/nova.conf diff --git a/nova/templates/configmap-bin.yaml b/nova/templates/configmap-bin.yaml index e7cfd2673d..265348f654 100644 --- a/nova/templates/configmap-bin.yaml +++ b/nova/templates/configmap-bin.yaml @@ -31,3 +31,15 @@ data: {{ tuple "bin/_libvirt.sh.tpl" . | include "helm-toolkit.template" | indent 4 }} bootstrap.sh: | {{ tuple "bin/_bootstrap.sh.tpl" . | include "helm-toolkit.template" | indent 4 }} + nova-api-metadata.sh: | +{{ tuple "bin/_nova-api-metadata.sh.tpl" . | include "helm-toolkit.template" | indent 4 }} + nova-api-osapi.sh: | +{{ tuple "bin/_nova-api-osapi.sh.tpl" . | include "helm-toolkit.template" | indent 4 }} + nova-compute.sh: | +{{ tuple "bin/_nova-compute.sh.tpl" . | include "helm-toolkit.template" | indent 4 }} + nova-conductor.sh: | +{{ tuple "bin/_nova-conductor.sh.tpl" . | include "helm-toolkit.template" | indent 4 }} + nova-consoleauth.sh: | +{{ tuple "bin/_nova-consoleauth.sh.tpl" . | include "helm-toolkit.template" | indent 4 }} + nova-scheduler.sh: | +{{ tuple "bin/_nova-scheduler.sh.tpl" . | include "helm-toolkit.template" | indent 4 }} diff --git a/nova/templates/daemonset-compute.yaml b/nova/templates/daemonset-compute.yaml index cc21122928..07b768744f 100644 --- a/nova/templates/daemonset-compute.yaml +++ b/nova/templates/daemonset-compute.yaml @@ -56,10 +56,13 @@ spec: securityContext: privileged: true command: - - nova-compute - - --config-file - - /etc/nova/nova.conf + - bash + - /tmp/nova-compute.sh volumeMounts: + - name: nova-bin + mountPath: /tmp/nova-compute.sh + subPath: nova-compute.sh + readOnly: true - name: nova-etc mountPath: /etc/nova/nova.conf subPath: nova.conf @@ -93,6 +96,9 @@ spec: mountPath: /sys/fs/cgroup {{ if $mounts_nova_compute.volumeMounts }}{{ toYaml $mounts_nova_compute.volumeMounts | indent 12 }}{{ end }} volumes: + - name: nova-bin + configMap: + name: nova-bin - name: nova-etc configMap: name: nova-etc diff --git a/nova/templates/daemonset-libvirt.yaml b/nova/templates/daemonset-libvirt.yaml index e112c1b08d..50141b9a80 100644 --- a/nova/templates/daemonset-libvirt.yaml +++ b/nova/templates/daemonset-libvirt.yaml @@ -57,14 +57,14 @@ spec: - bash - /tmp/libvirt.sh volumeMounts: - - name: nova-etc - mountPath: /etc/libvirt/libvirtd.conf - subPath: libvirtd.conf - readOnly: true - name: nova-bin mountPath: /tmp/libvirt.sh subPath: libvirt.sh readOnly: true + - name: nova-etc + mountPath: /etc/libvirt/libvirtd.conf + subPath: libvirtd.conf + readOnly: true - name: nova-etc mountPath: /etc/nova/nova.conf subPath: nova.conf @@ -100,12 +100,12 @@ spec: {{- end }} {{ if $mounts_nova_libvirt.volumeMounts }}{{ toYaml $mounts_nova_libvirt.volumeMounts | indent 12 }}{{ end }} volumes: - - name: nova-etc - configMap: - name: nova-etc - name: nova-bin configMap: name: nova-bin + - name: nova-etc + configMap: + name: nova-etc - name: libmodules hostPath: path: /lib/modules diff --git a/nova/templates/deployment-api-metadata.yaml b/nova/templates/deployment-api-metadata.yaml index c0eb414de5..5897129b34 100644 --- a/nova/templates/deployment-api-metadata.yaml +++ b/nova/templates/deployment-api-metadata.yaml @@ -61,15 +61,19 @@ spec: capabilities: add: - NET_ADMIN - command: - - nova-api-metadata - - --config-file=/etc/nova/nova.conf ports: - containerPort: {{ .Values.network.metadata.port }} readinessProbe: tcpSocket: port: {{ .Values.network.metadata.port }} + command: + - bash + - /tmp/nova-api-metadata.sh volumeMounts: + - name: nova-bin + mountPath: /tmp/nova-api-metadata.sh + subPath: nova-api-metadata.sh + readOnly: true - name: nova-etc mountPath: /etc/nova/nova.conf subPath: nova.conf @@ -80,6 +84,9 @@ spec: readOnly: true {{ if $mounts_nova_api_metadata.volumeMounts }}{{ toYaml $mounts_nova_api_metadata.volumeMounts | indent 12 }}{{ end }} volumes: + - name: nova-bin + configMap: + name: nova-bin - name: nova-etc configMap: name: nova-etc diff --git a/nova/templates/deployment-api-osapi.yaml b/nova/templates/deployment-api-osapi.yaml index 2dde6a95dc..811af55984 100644 --- a/nova/templates/deployment-api-osapi.yaml +++ b/nova/templates/deployment-api-osapi.yaml @@ -60,15 +60,19 @@ spec: memory: {{ .Values.resources.nova_osapi.limits.memory | quote }} cpu: {{ .Values.resources.nova_osapi.limits.cpu | quote }} {{- end }} - command: - - nova-api - - --config-file=/etc/nova/nova.conf ports: - containerPort: {{ .Values.network.osapi.port }} readinessProbe: tcpSocket: port: {{ .Values.network.osapi.port }} + command: + - bash + - /tmp/nova-api.sh volumeMounts: + - name: nova-bin + mountPath: /tmp/nova-api.sh + subPath: nova-api.sh + readOnly: true - name: nova-etc mountPath: /etc/nova/nova.conf subPath: nova.conf @@ -79,6 +83,9 @@ spec: readOnly: true {{ if $mounts_nova_api_osapi.volumeMounts }}{{ toYaml $mounts_nova_api_osapi.volumeMounts | indent 12 }}{{ end }} volumes: + - name: nova-bin + configMap: + name: nova-bin - name: nova-etc configMap: name: nova-etc diff --git a/nova/templates/deployment-conductor.yaml b/nova/templates/deployment-conductor.yaml index ae14c9c87a..20375fcb1b 100644 --- a/nova/templates/deployment-conductor.yaml +++ b/nova/templates/deployment-conductor.yaml @@ -57,16 +57,22 @@ spec: cpu: {{ .Values.resources.nova_conductor.limits.cpu | quote }} {{- end }} command: - - nova-conductor - - --config-file - - /etc/nova/nova.conf + - bash + - /tmp/nova-conductor.sh volumeMounts: + - name: nova-bin + mountPath: /tmp/nova-conductor.sh + subPath: nova-conductor.sh + readOnly: true - name: nova-etc mountPath: /etc/nova/nova.conf subPath: nova.conf readOnly: true {{ if $mounts_nova_conductor.volumeMounts }}{{ toYaml $mounts_nova_conductor.volumeMounts | indent 12 }}{{ end }} volumes: + - name: nova-bin + configMap: + name: nova-bin - name: nova-etc configMap: name: nova-etc diff --git a/nova/templates/deployment-consoleauth.yaml b/nova/templates/deployment-consoleauth.yaml index ea48466de5..90801708f4 100644 --- a/nova/templates/deployment-consoleauth.yaml +++ b/nova/templates/deployment-consoleauth.yaml @@ -58,16 +58,22 @@ spec: cpu: {{ .Values.resources.nova_consoleauth.limits.cpu | quote }} {{- end }} command: - - nova-consoleauth - - --config-file - - /etc/nova/nova.conf + - bash + - /tmp/nova-consoleauth.sh volumeMounts: + - name: nova-bin + mountPath: /tmp/nova-consoleauth.sh + subPath: nova-consoleauth.sh + readOnly: true - name: nova-etc mountPath: /etc/nova/nova.conf subPath: nova.conf readOnly: true {{ if $mounts_nova_consoleauth.volumeMounts }}{{ toYaml $mounts_nova_consoleauth.volumeMounts | indent 12 }}{{ end }} volumes: + - name: nova-bin + configMap: + name: nova-bin - name: nova-etc configMap: name: nova-etc diff --git a/nova/templates/deployment-scheduler.yaml b/nova/templates/deployment-scheduler.yaml index 4dc1cdccf2..8a86a088c1 100644 --- a/nova/templates/deployment-scheduler.yaml +++ b/nova/templates/deployment-scheduler.yaml @@ -58,16 +58,22 @@ spec: cpu: {{ .Values.resources.nova_scheduler.limits.cpu | quote }} {{- end }} command: - - nova-scheduler - - --config-file - - /etc/nova/nova.conf + - bash + - /tmp/nova-scheduler.sh volumeMounts: + - name: nova-bin + mountPath: /tmp/nova-scheduler.sh + subPath: nova-scheduler.sh + readOnly: true - name: nova-etc mountPath: /etc/nova/nova.conf subPath: nova.conf readOnly: true {{ if $mounts_nova_scheduler.volumeMounts }}{{ toYaml $mounts_nova_scheduler.volumeMounts | indent 12 }}{{ end }} volumes: + - name: nova-bin + configMap: + name: nova-bin - name: nova-etc configMap: name: nova-etc