0e644a1fac
In 0.30.0 (busybox inside) the "find" tool doesn't support "writable" option, so use "perm" instead. Also get rid of several system calls by means of make all by one command. Change-Id: Ia4f7bc01fb61f4f32c21c50d8c4e870d0244c868
61 lines
1.8 KiB
Smarty
61 lines
1.8 KiB
Smarty
#!/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
|
|
COMMAND="${@:-start}"
|
|
|
|
function start () {
|
|
find /tmp -maxdepth 1 \! -path /tmp -perm /222 -exec rm -rfv {} \;
|
|
|
|
declare -A desired_opts
|
|
desired_opts["--stream-port"]="${PORT_STREAM}"
|
|
desired_opts["--profiler-port"]="${PORT_PROFILER}"
|
|
|
|
possible_opts=$(/nginx-ingress-controller --help 2>&1 | awk '/^ --/ { print $1 }')
|
|
|
|
extra_opts=()
|
|
for k in "${!desired_opts[@]}"; do
|
|
if echo "$possible_opts" | grep -q -- ^${k}$; then
|
|
extra_opts+=($k=${desired_opts[$k]})
|
|
fi
|
|
done
|
|
|
|
exec /usr/bin/dumb-init \
|
|
/nginx-ingress-controller \
|
|
{{- if eq .Values.deployment.mode "namespace" }}
|
|
--watch-namespace ${POD_NAMESPACE} \
|
|
{{- end }}
|
|
--http-port=${PORT_HTTP} \
|
|
--https-port=${PORT_HTTPS} \
|
|
--healthz-port=${PORT_HEALTHZ} \
|
|
--status-port=${PORT_STATUS} \
|
|
--default-server-port=${DEFAULT_SERVER_PORT} \
|
|
--election-id=${RELEASE_NAME} \
|
|
--ingress-class=${INGRESS_CLASS} \
|
|
--default-backend-service=${POD_NAMESPACE}/${ERROR_PAGE_SERVICE} \
|
|
--configmap=${POD_NAMESPACE}/ingress-conf \
|
|
--tcp-services-configmap=${POD_NAMESPACE}/ingress-services-tcp \
|
|
--udp-services-configmap=${POD_NAMESPACE}/ingress-services-udp \
|
|
"${extra_opts[@]}"
|
|
}
|
|
|
|
function stop () {
|
|
sleep 5
|
|
kill -TERM 1
|
|
}
|
|
|
|
$COMMAND
|