You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ch...@apache.org on 2023/05/14 18:38:21 UTC
[kyuubi] 01/01: [K8S][HELM] Use supervisor to run kyuubi process
This is an automated email from the ASF dual-hosted git repository.
chengpan pushed a commit to branch supervisor
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
commit cf3f113e11f6ddf70fb02cfae4633c9a52b245dd
Author: Cheng Pan <ch...@apache.org>
AuthorDate: Mon May 15 02:38:01 2023 +0800
[K8S][HELM] Use supervisor to run kyuubi process
---
charts/kyuubi/templates/kyuubi-deployment.yaml | 4 ++--
docker/Dockerfile | 26 +++++++++++++++++++++-----
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/charts/kyuubi/templates/kyuubi-deployment.yaml b/charts/kyuubi/templates/kyuubi-deployment.yaml
index 79d49a653..39c85bc5e 100644
--- a/charts/kyuubi/templates/kyuubi-deployment.yaml
+++ b/charts/kyuubi/templates/kyuubi-deployment.yaml
@@ -68,7 +68,7 @@ spec:
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
exec:
- command: ["/bin/bash", "-c", "bin/kyuubi status"]
+ command: ["/usr/bin/supervisorctl status kyuubi"]
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
@@ -78,7 +78,7 @@ spec:
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
exec:
- command: ["/bin/bash", "-c", "$KYUUBI_HOME/bin/kyuubi status"]
+ command: ["/usr/bin/supervisorctl status kyuubi"]
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 0440022de..5f9ca69f4 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -50,11 +50,29 @@ ENV KYUUBI_WORK_DIR_ROOT ${KYUUBI_HOME}/work
RUN set -ex && \
sed -i 's/http:\/\/deb.\(.*\)/https:\/\/deb.\1/g' /etc/apt/sources.list && \
apt-get update && \
- apt-get install -y bash tini libc6 libpam-modules krb5-user libnss3 procps && \
+ apt-get install -y bash tini libc6 libpam-modules krb5-user libnss3 procps supervisor && \
ln -snf /bin/bash /bin/sh && \
useradd -u ${kyuubi_uid} -g root kyuubi -d /home/kyuubi -m && \
mkdir -p ${KYUUBI_HOME} ${KYUUBI_LOG_DIR} ${KYUUBI_PID_DIR} ${KYUUBI_WORK_DIR_ROOT} && \
- rm -rf /var/cache/apt/*
+ rm -rf /var/cache/apt/* && rm -rf /var/lib/apt/lists/*
+
+COPY <<"EOF" /etc/supervisor/conf.d/supervisord.conf
+[supervisord]
+nodaemon = true
+logfile = /var/log/supervisor/supervisord.log
+pidfile = /var/run/supervisord.pid
+childlogdir = /var/log/supervisor
+EOF
+
+# stop the supervisord once kyuubi process is stopped, see details at
+# https://github.com/Supervisor/supervisor/issues/712
+COPY <<"EOF" /etc/supervisor/conf.d/kyuubi.conf
+[program:kyuubi]
+command = bash -c "${KYUUBI_HOME}/bin/kyuubi run && kill -s SIGINT `cat supervisord.pid`"
+stopasgroup = true
+user=${kyuubi_uid}
+directory=${KYUUBI_HOME}
+EOF
COPY LICENSE NOTICE RELEASE ${KYUUBI_HOME}/
COPY bin ${KYUUBI_HOME}/bin
@@ -68,6 +86,4 @@ RUN chown -R kyuubi:root ${KYUUBI_HOME} && \
chmod ug+rw -R ${KYUUBI_HOME} && \
chmod a+rwx -R ${KYUUBI_WORK_DIR_ROOT}
-CMD [ "./bin/kyuubi", "run" ]
-
-USER ${kyuubi_uid}
+CMD ["/usr/bin/supervisord"]