Merge "Refactor start scripts, to support graceful termination"

This commit is contained in:
Jenkins 2017-06-06 16:26:26 +00:00 committed by Gerrit Code Review
commit fa0bfeb0b5
38 changed files with 361 additions and 193 deletions

View File

@ -15,11 +15,14 @@
# limitations under the License. # limitations under the License.
set -ex set -ex
COMMAND="${@:-start}"
if [ -f /etc/apache2/envvars ]; then function start () {
# Loading Apache2 ENV variables exec uwsgi --die-on-term --master --emperor /etc/barbican/vassals
source /etc/apache2/envvars }
fi
# Start Apache2 function stop () {
exec apache2 -DFOREGROUND kill -TERM 1
}
$COMMAND

View File

@ -19,8 +19,8 @@ data:
{{- include "helm-toolkit.scripts.db_init" . | indent 4 }} {{- include "helm-toolkit.scripts.db_init" . | indent 4 }}
db-sync.sh: | db-sync.sh: |
{{ tuple "bin/_db-sync.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} {{ tuple "bin/_db-sync.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
start.sh: | barbican.sh: |
{{ tuple "bin/_start.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} {{ tuple "bin/_barbican.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
ks-service.sh: | ks-service.sh: |
{{- include "helm-toolkit.scripts.keystone_service" . | indent 4 }} {{- include "helm-toolkit.scripts.keystone_service" . | indent 4 }}
ks-endpoints.sh: | ks-endpoints.sh: |

View File

@ -56,7 +56,15 @@ spec:
{{- end }} {{- end }}
command: command:
- bash - bash
- /tmp/start.sh - /tmp/barbican.sh
- start
lifecycle:
preStop:
exec:
command:
- bash
- /tmp/barbican.sh
- stop
ports: ports:
- containerPort: {{ .Values.conf.barbican.barbican_api.barbican.config.bind_port }} - containerPort: {{ .Values.conf.barbican.barbican_api.barbican.config.bind_port }}
readinessProbe: readinessProbe:
@ -86,8 +94,8 @@ spec:
subPath: policy.json subPath: policy.json
readOnly: true readOnly: true
- name: barbican-bin - name: barbican-bin
mountPath: /tmp/start.sh mountPath: /tmp/barbican.sh
subPath: start.sh subPath: barbican.sh
readOnly: true readOnly: true
{{ if $mounts_barbican_api.volumeMounts }}{{ toYaml $mounts_barbican_api.volumeMounts | indent 12 }}{{ end }} {{ if $mounts_barbican_api.volumeMounts }}{{ toYaml $mounts_barbican_api.volumeMounts | indent 12 }}{{ end }}
volumes: volumes:

View File

@ -14,6 +14,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -x set -ex
exec cinder-api \ COMMAND="${@:-start}"
--config-file /etc/cinder/cinder.conf
function start () {
exec cinder-api \
--config-file /etc/cinder/cinder.conf
}
function stop () {
kill -TERM 1
}
$COMMAND

View File

@ -14,6 +14,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -x set -ex
exec cinder-scheduler \ exec cinder-scheduler \
--config-file /etc/cinder/cinder.conf --config-file /etc/cinder/cinder.conf

View File

@ -14,6 +14,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -x set -ex
exec cinder-volume \ exec cinder-volume \
--config-file /etc/cinder/cinder.conf --config-file /etc/cinder/cinder.conf

View File

@ -16,4 +16,4 @@
set -ex set -ex
cinder-manage db sync exec cinder-manage db sync

View File

@ -60,16 +60,17 @@ spec:
command: command:
- bash - bash
- /tmp/cinder-api.sh - /tmp/cinder-api.sh
ports: - start
- name: c-api
containerPort: {{ .Values.conf.cinder.default.cinder.osapi_volume_listen_port }}
lifecycle: lifecycle:
preStop: preStop:
exec: exec:
command: command:
- kill - bash
- -TERM - /tmp/cinder-api.sh
- "1" - stop
ports:
- name: c-api
containerPort: {{ .Values.conf.cinder.default.cinder.osapi_volume_listen_port }}
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: {{ .Values.conf.cinder.default.cinder.osapi_volume_listen_port }} port: {{ .Values.conf.cinder.default.cinder.osapi_volume_listen_port }}

View File

@ -14,6 +14,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -x set -ex
exec glance-api \ COMMAND="${@:-start}"
--config-file /etc/glance/glance-api.conf
function start () {
exec glance-api \
--config-file /etc/glance/glance-api.conf
}
function stop () {
kill -TERM 1
}
$COMMAND

View File

@ -14,6 +14,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -x set -ex
exec glance-registry \ COMMAND="${@:-start}"
--config-file /etc/glance/glance-registry.conf
function start () {
exec glance-registry \
--config-file /etc/glance/glance-registry.conf
}
function stop () {
kill -TERM 1
}
$COMMAND

View File

@ -60,15 +60,16 @@ spec:
command: command:
- bash - bash
- /tmp/glance-api.sh - /tmp/glance-api.sh
ports: - start
- containerPort: {{ .Values.conf.glance.default.glance.api.bind_port }}
lifecycle: lifecycle:
preStop: preStop:
exec: exec:
command: command:
- kill - bash
- -TERM - /tmp/glance-api.sh
- "1" - stop
ports:
- containerPort: {{ .Values.conf.glance.default.glance.api.bind_port }}
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: {{ .Values.conf.glance.default.glance.api.bind_port }} port: {{ .Values.conf.glance.default.glance.api.bind_port }}

View File

@ -52,15 +52,16 @@ spec:
command: command:
- bash - bash
- /tmp/glance-registry.sh - /tmp/glance-registry.sh
ports: - start
- containerPort: {{ .Values.conf.glance_registry.default.glance.registry.bind_port }}
lifecycle: lifecycle:
preStop: preStop:
exec: exec:
command: command:
- kill - bash
- -TERM - /tmp/glance-registry.sh
- "1" - stop
ports:
- containerPort: {{ .Values.conf.glance_registry.default.glance.registry.bind_port }}
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: {{ .Values.conf.glance_registry.default.glance.registry.bind_port }} port: {{ .Values.conf.glance_registry.default.glance.registry.bind_port }}

View File

@ -14,6 +14,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -x set -ex
exec heat-api \ COMMAND="${@:-start}"
--config-file /etc/heat/heat.conf
function start () {
exec heat-api \
--config-file /etc/heat/heat.conf
}
function stop () {
kill -TERM 1
}
$COMMAND

View File

@ -14,6 +14,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -x set -ex
exec heat-api-cfn \ COMMAND="${@:-start}"
--config-file /etc/heat/heat.conf
function start () {
exec heat-api-cfn \
--config-file /etc/heat/heat.conf
}
function stop () {
kill -TERM 1
}
$COMMAND

View File

@ -14,6 +14,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -x set -ex
exec heat-api-cloudwatch \ COMMAND="${@:-start}"
--config-file /etc/heat/heat.conf
function start () {
exec heat-api-cloudwatch \
--config-file /etc/heat/heat.conf
}
function stop () {
kill -TERM 1
}
$COMMAND

View File

@ -60,15 +60,16 @@ spec:
command: command:
- bash - bash
- /tmp/heat-api.sh - /tmp/heat-api.sh
ports: - start
- containerPort: {{ .Values.conf.heat.heat_api.heat.common.wsgi.bind_port }}
lifecycle: lifecycle:
preStop: preStop:
exec: exec:
command: command:
- kill - bash
- -TERM - /tmp/heat-api.sh
- "1" - stop
ports:
- containerPort: {{ .Values.conf.heat.heat_api.heat.common.wsgi.bind_port }}
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: {{ .Values.conf.heat.heat_api.heat.common.wsgi.bind_port }} port: {{ .Values.conf.heat.heat_api.heat.common.wsgi.bind_port }}

View File

@ -60,15 +60,16 @@ spec:
command: command:
- bash - bash
- /tmp/heat-cfn.sh - /tmp/heat-cfn.sh
ports: - start
- containerPort: {{ .Values.conf.heat.heat_api_cfn.heat.common.wsgi.bind_port }}
lifecycle: lifecycle:
preStop: preStop:
exec: exec:
command: command:
- kill - bash
- -TERM - /tmp/heat-cfn.sh
- "1" - stop
ports:
- containerPort: {{ .Values.conf.heat.heat_api_cfn.heat.common.wsgi.bind_port }}
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: {{ .Values.conf.heat.heat_api_cfn.heat.common.wsgi.bind_port }} port: {{ .Values.conf.heat.heat_api_cfn.heat.common.wsgi.bind_port }}

View File

@ -60,15 +60,16 @@ spec:
command: command:
- bash - bash
- /tmp/heat-cloudwatch.sh - /tmp/heat-cloudwatch.sh
ports: - start
- containerPort: {{ .Values.conf.heat.heat_api_cloudwatch.heat.common.wsgi.bind_port }}
lifecycle: lifecycle:
preStop: preStop:
exec: exec:
command: command:
- kill - bash
- -TERM - /tmp/heat-cloudwatch.sh
- "1" - stop
ports:
- containerPort: {{ .Values.conf.heat.heat_api_cloudwatch.heat.common.wsgi.bind_port }}
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: {{ .Values.conf.heat.heat_api_cloudwatch.heat.common.wsgi.bind_port }} port: {{ .Values.conf.heat.heat_api_cloudwatch.heat.common.wsgi.bind_port }}

View File

@ -0,0 +1,43 @@
#!/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 -ex
COMMAND="${@:-start}"
function start () {
if [ -f /etc/apache2/envvars ]; then
# Loading Apache2 ENV variables
source /etc/apache2/envvars
fi
rm -rf /var/run/apache2/*
APACHE_DIR="apache2"
# Compress Horizon's assets.
/var/lib/kolla/venv/bin/manage.py collectstatic --noinput
/var/lib/kolla/venv/bin/manage.py compress --force
rm -rf /tmp/_tmp_.secret_key_store.lock /tmp/.secret_key_store
# wsgi/horizon-http needs open files here, including secret_key_store
chown -R horizon /var/lib/kolla/venv/lib/python2.7/site-packages/openstack_dashboard/local/
exec apache2 -DFOREGROUND
}
function stop () {
apachectl -k graceful-stop
}
$COMMAND

View File

@ -1,33 +0,0 @@
#!/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 -ex
# Loading Apache2 ENV variables
source /etc/apache2/envvars
rm -rf /var/run/apache2/*
APACHE_DIR="apache2"
# Compress Horizon's assets.
/var/lib/kolla/venv/bin/manage.py collectstatic --noinput
/var/lib/kolla/venv/bin/manage.py compress --force
rm -rf /tmp/_tmp_.secret_key_store.lock /tmp/.secret_key_store
# wsgi/horizon-http needs open files here, including secret_key_store
chown -R horizon /var/lib/kolla/venv/lib/python2.7/site-packages/openstack_dashboard/local/
apache2 -DFOREGROUND

View File

@ -17,5 +17,5 @@ kind: ConfigMap
metadata: metadata:
name: horizon-bin name: horizon-bin
data: data:
start.sh: | horizon.sh: |
{{ tuple "bin/_start.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} {{ tuple "bin/_horizon.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}

View File

@ -59,23 +59,24 @@ spec:
{{- end }} {{- end }}
command: command:
- bash - bash
- /tmp/start.sh - /tmp/horizon.sh
ports: - start
- containerPort: {{ .Values.network.port }}
lifecycle: lifecycle:
preStop: preStop:
exec: exec:
command: command:
- apachectl - bash
- -k - /tmp/horizon.sh
- graceful-stop - stop
ports:
- containerPort: {{ .Values.network.port }}
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: {{ .Values.network.port }} port: {{ .Values.network.port }}
volumeMounts: volumeMounts:
- name: startsh - name: startsh
mountPath: /tmp/start.sh mountPath: /tmp/horizon.sh
subPath: start.sh subPath: horizon.sh
readOnly: true readOnly: true
- name: horizon-etc - name: horizon-etc
mountPath: /etc/apache2/sites-enabled/000-default.conf mountPath: /etc/apache2/sites-enabled/000-default.conf

View File

@ -16,4 +16,20 @@
set -ex set -ex
exec uwsgi --master --emperor /etc/barbican/vassals COMMAND="${@:-start}"
function start () {
if [ -f /etc/apache2/envvars ]; then
# Loading Apache2 ENV variables
source /etc/apache2/envvars
fi
# Start Apache2
exec apache2 -DFOREGROUND
}
function stop () {
apachectl -k graceful-stop
}
$COMMAND

View File

@ -21,5 +21,5 @@ data:
{{- include "helm-toolkit.scripts.db_init" . | indent 4 }} {{- include "helm-toolkit.scripts.db_init" . | indent 4 }}
db-sync.sh: | db-sync.sh: |
{{ tuple "bin/_db-sync.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} {{ tuple "bin/_db-sync.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
start.sh: | keystone-api.sh: |
{{ tuple "bin/_start.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} {{ tuple "bin/_keystone-api.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}

View File

@ -59,19 +59,20 @@ spec:
{{- end }} {{- end }}
command: command:
- bash - bash
- /tmp/start.sh - /tmp/keystone-api.sh
- start
lifecycle:
preStop:
exec:
command:
- bash
- /tmp/keystone-api.sh
- stop
ports: ports:
- name: api-public - name: api-public
containerPort: {{ .Values.network.api.port }} containerPort: {{ .Values.network.api.port }}
- name: api-admin - name: api-admin
containerPort: {{ .Values.network.admin.port }} containerPort: {{ .Values.network.admin.port }}
lifecycle:
preStop:
exec:
command:
- apachectl
- -k
- graceful-stop
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: {{ .Values.network.api.port }} port: {{ .Values.network.api.port }}
@ -103,8 +104,8 @@ spec:
subPath: mpm_event.conf subPath: mpm_event.conf
readOnly: true readOnly: true
- name: keystone-bin - name: keystone-bin
mountPath: /tmp/start.sh mountPath: /tmp/keystone-api.sh
subPath: start.sh subPath: keystone-api.sh
readOnly: true readOnly: true
{{ if $mounts_keystone_api.volumeMounts }}{{ toYaml $mounts_keystone_api.volumeMounts | indent 10 }}{{ end }} {{ if $mounts_keystone_api.volumeMounts }}{{ toYaml $mounts_keystone_api.volumeMounts | indent 10 }}{{ end }}
volumes: volumes:

View File

@ -14,6 +14,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -x set -ex
exec magnum-api \ COMMAND="${@:-start}"
--config-file /etc/magnum/magnum.conf
function start () {
exec magnum-api \
--config-file /etc/magnum/magnum.conf
}
function stop () {
kill -TERM 1
}
$COMMAND

View File

@ -14,6 +14,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -x set -ex
exec magnum-conductor \ exec magnum-conductor \
--config-file /etc/magnum/magnum.conf --config-file /etc/magnum/magnum.conf

View File

@ -57,21 +57,22 @@ spec:
memory: {{ .Values.resources.magnum_api.limits.memory | quote }} memory: {{ .Values.resources.magnum_api.limits.memory | quote }}
cpu: {{ .Values.resources.magnum_api.limits.cpu | quote }} cpu: {{ .Values.resources.magnum_api.limits.cpu | quote }}
{{- end }} {{- end }}
ports: command:
- containerPort: {{ .Values.conf.magnum.api.magnum.port }} - bash
- /tmp/magnum-api.sh
- start
lifecycle: lifecycle:
preStop: preStop:
exec: exec:
command: command:
- kill - bash
- -TERM - /tmp/magnum-api.sh
- "1" - stop
ports:
- containerPort: {{ .Values.conf.magnum.api.magnum.port }}
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: {{ .Values.conf.magnum.api.magnum.port }} port: {{ .Values.conf.magnum.api.magnum.port }}
command:
- bash
- /tmp/magnum-api.sh
volumeMounts: volumeMounts:
- name: magnum-bin - name: magnum-bin
mountPath: /tmp/magnum-api.sh mountPath: /tmp/magnum-api.sh

View File

@ -14,7 +14,17 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -x set -ex
exec mistral-server \ COMMAND="${@:-start}"
--server api \
--config-file /etc/mistral/mistral.conf function start () {
exec mistral-server \
--server api \
--config-file /etc/mistral/mistral.conf
}
function stop () {
kill -TERM 1
}
$COMMAND

View File

@ -60,16 +60,17 @@ spec:
command: command:
- bash - bash
- /tmp/mistral-api.sh - /tmp/mistral-api.sh
ports: - start
- name: {{ .Values.network.api.name }}
containerPort: {{ .Values.conf.mistral.api.mistral.config.port }}
lifecycle: lifecycle:
preStop: preStop:
exec: exec:
command: command:
- kill - bash
- -TERM - /tmp/mistral-api.sh
- "1" - stop
ports:
- name: {{ .Values.network.api.name }}
containerPort: {{ .Values.conf.mistral.api.mistral.config.port }}
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: {{ .Values.conf.mistral.api.mistral.config.port }} port: {{ .Values.conf.mistral.api.mistral.config.port }}

View File

@ -14,7 +14,17 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -x set -ex
exec neutron-server \ COMMAND="${@:-start}"
--config-file /etc/neutron/neutron.conf \
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini function start () {
exec neutron-server \
--config-file /etc/neutron/neutron.conf \
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini
}
function stop () {
kill -TERM 1
}
$COMMAND

View File

@ -57,21 +57,22 @@ spec:
cpu: {{ .Values.resources.server.requests.cpu | quote }} cpu: {{ .Values.resources.server.requests.cpu | quote }}
memory: {{ .Values.resources.server.requests.memory | quote }} memory: {{ .Values.resources.server.requests.memory | quote }}
{{- end }} {{- end }}
ports: command:
- containerPort: {{ .Values.network.server.port }} - bash
- /tmp/neutron-server.sh
- start
lifecycle: lifecycle:
preStop: preStop:
exec: exec:
command: command:
- kill - bash
- -TERM - /tmp/neutron-server.sh
- "1" - stop
ports:
- containerPort: {{ .Values.network.server.port }}
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: {{ .Values.network.server.port }} port: {{ .Values.network.server.port }}
command:
- bash
- /tmp/neutron-server.sh
volumeMounts: volumeMounts:
- name: neutron-bin - name: neutron-bin
mountPath: /tmp/neutron-server.sh mountPath: /tmp/neutron-server.sh

View File

@ -14,6 +14,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -x set -ex
exec nova-api-metadata \ COMMAND="${@:-start}"
--config-file /etc/nova/nova.conf
function start () {
exec nova-api-metadata \
--config-file /etc/nova/nova.conf
}
function stop () {
kill -TERM 1
}
$COMMAND

View File

@ -14,6 +14,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -x set -ex
exec nova-api \ COMMAND="${@:-start}"
--config-file /etc/nova/nova.conf
function start () {
exec nova-api-os-compute \
--config-file /etc/nova/nova.conf
}
function stop () {
kill -TERM 1
}
$COMMAND

View File

@ -48,7 +48,6 @@ spec:
- name: nova-api - name: nova-api
image: {{ .Values.images.api }} image: {{ .Values.images.api }}
imagePullPolicy: {{ .Values.images.pull_policy }} imagePullPolicy: {{ .Values.images.pull_policy }}
# https://bugs.launchpad.net/kolla-mesos/+bug/1546007
{{- if .Values.resources.enabled }} {{- if .Values.resources.enabled }}
resources: resources:
requests: requests:
@ -58,25 +57,28 @@ spec:
memory: {{ .Values.resources.nova_api_metadata.limits.memory | quote }} memory: {{ .Values.resources.nova_api_metadata.limits.memory | quote }}
cpu: {{ .Values.resources.nova_api_metadata.limits.cpu | quote }} cpu: {{ .Values.resources.nova_api_metadata.limits.cpu | quote }}
{{- end }} {{- end }}
# NOTE(portdirect): NET_ADMIN is needed as the api-metadata service
# expects to run some iptables commands, even when neutron is used.
securityContext: securityContext:
capabilities: capabilities:
add: add:
- NET_ADMIN - NET_ADMIN
ports: command:
- containerPort: {{ .Values.network.metadata.port }} - bash
- /tmp/nova-api-metadata.sh
- start
lifecycle: lifecycle:
preStop: preStop:
exec: exec:
command: command:
- kill - bash
- -TERM - /tmp/nova-api-metadata.sh
- "1" - stop
ports:
- containerPort: {{ .Values.network.metadata.port }}
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: {{ .Values.network.metadata.port }} port: {{ .Values.network.metadata.port }}
command:
- bash
- /tmp/nova-api-metadata.sh
volumeMounts: volumeMounts:
- name: nova-bin - name: nova-bin
mountPath: /tmp/nova-api-metadata.sh mountPath: /tmp/nova-api-metadata.sh

View File

@ -48,10 +48,6 @@ spec:
- name: nova-osapi - name: nova-osapi
image: {{ .Values.images.api }} image: {{ .Values.images.api }}
imagePullPolicy: {{ .Values.images.pull_policy }} imagePullPolicy: {{ .Values.images.pull_policy }}
securityContext:
capabilities:
add:
- NET_ADMIN
{{- if .Values.resources.enabled }} {{- if .Values.resources.enabled }}
resources: resources:
requests: requests:
@ -61,21 +57,22 @@ spec:
memory: {{ .Values.resources.nova_osapi.limits.memory | quote }} memory: {{ .Values.resources.nova_osapi.limits.memory | quote }}
cpu: {{ .Values.resources.nova_osapi.limits.cpu | quote }} cpu: {{ .Values.resources.nova_osapi.limits.cpu | quote }}
{{- end }} {{- end }}
ports: command:
- containerPort: {{ .Values.network.osapi.port }} - bash
- /tmp/nova-api.sh
- start
lifecycle: lifecycle:
preStop: preStop:
exec: exec:
command: command:
- kill - bash
- -TERM - /tmp/nova-api.sh
- "1" - stop
ports:
- containerPort: {{ .Values.network.osapi.port }}
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: {{ .Values.network.osapi.port }} port: {{ .Values.network.osapi.port }}
command:
- bash
- /tmp/nova-api.sh
volumeMounts: volumeMounts:
- name: nova-bin - name: nova-bin
mountPath: /tmp/nova-api.sh mountPath: /tmp/nova-api.sh

View File

@ -14,6 +14,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -x set -ex
exec senlin-api \ COMMAND="${@:-start}"
--config-file /etc/senlin/senlin.conf
function start () {
exec senlin-api \
--config-file /etc/senlin/senlin.conf
}
function stop () {
kill -TERM 1
}
$COMMAND

View File

@ -57,21 +57,22 @@ spec:
memory: {{ .Values.resources.senlin_api.limits.memory | quote }} memory: {{ .Values.resources.senlin_api.limits.memory | quote }}
cpu: {{ .Values.resources.senlin_api.limits.cpu | quote }} cpu: {{ .Values.resources.senlin_api.limits.cpu | quote }}
{{- end }} {{- end }}
command:
- bash
- /tmp/senlin-api.sh
- start
lifecycle:
preStop:
exec:
command:
- bash
- /tmp/senlin-api.sh
- stop
ports: ports:
- containerPort: {{ .Values.conf.senlin.senlin_api.senlin.config.bind_port }} - containerPort: {{ .Values.conf.senlin.senlin_api.senlin.config.bind_port }}
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: {{ .Values.conf.senlin.senlin_api.senlin.config.bind_port }} port: {{ .Values.conf.senlin.senlin_api.senlin.config.bind_port }}
command:
- bash
- /tmp/senlin-api.sh
lifecycle:
preStop:
exec:
command:
- kill
- -TERM
- "1"
volumeMounts: volumeMounts:
- name: senlin-bin - name: senlin-bin
mountPath: /tmp/senlin-api.sh mountPath: /tmp/senlin-api.sh