Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#13868] fix(docker): Exec the JVM so container stop reaches the REST servers (#13872)

YangJie307fd96ebd2f
diff --git a/bin/gravitino-iceberg-rest-server.sh.template b/bin/gravitino-iceberg-rest-server.sh.template
index f486378528..8c388f1710 100755
--- a/bin/gravitino-iceberg-rest-server.sh.template
+++ b/bin/gravitino-iceberg-rest-server.sh.template
@@ -128,7 +128,7 @@ function start() {
}
function run() {
- ${JAVA_RUNNER} ${JAVA_OPTS} ${GRAVITINO_DEBUG_OPTS} -cp ${GRAVITINO_CLASSPATH} ${GRAVITINO_SERVER_NAME}
+ exec ${JAVA_RUNNER} ${JAVA_OPTS} ${GRAVITINO_DEBUG_OPTS} -cp ${GRAVITINO_CLASSPATH} ${GRAVITINO_SERVER_NAME}
}
function stop() {
diff --git a/bin/gravitino-lance-rest-server.sh.template b/bin/gravitino-lance-rest-server.sh.template
index b8537873cf..81b6c81717 100644
--- a/bin/gravitino-lance-rest-server.sh.template
+++ b/bin/gravitino-lance-rest-server.sh.template
@@ -128,7 +128,7 @@ function start() {
}
function run() {
- ${JAVA_RUNNER} ${JAVA_OPTS} ${GRAVITINO_DEBUG_OPTS} -cp ${GRAVITINO_CLASSPATH} ${GRAVITINO_SERVER_NAME}
+ exec ${JAVA_RUNNER} ${JAVA_OPTS} ${GRAVITINO_DEBUG_OPTS} -cp ${GRAVITINO_CLASSPATH} ${GRAVITINO_SERVER_NAME}
}
function stop() {
diff --git a/dev/charts/gravitino-iceberg-rest-server/tests/configmap_test.yaml b/dev/charts/gravitino-iceberg-rest-server/tests/configmap_test.yaml
index 29d819898c..0e419d51e5 100644
--- a/dev/charts/gravitino-iceberg-rest-server/tests/configmap_test.yaml
+++ b/dev/charts/gravitino-iceberg-rest-server/tests/configmap_test.yaml
@@ -46,7 +46,7 @@ tests:
path: data["hdfs-site.xml"]
- matchRegex:
path: data["init.sh"]
- pattern: "start-iceberg-rest-server\\.sh"
+ pattern: "exec /bin/bash .*/start-iceberg-rest-server\\.sh"
- matchRegex:
path: data["gravitino-iceberg-rest-server.conf"]
pattern: "gravitino\\.iceberg-rest\\.httpPort = 9001"
diff --git a/dev/charts/gravitino-iceberg-rest-server/values.yaml b/dev/charts/gravitino-iceberg-rest-server/values.yaml
index 6e71127a93..abf73375f1 100644
--- a/dev/charts/gravitino-iceberg-rest-server/values.yaml
+++ b/dev/charts/gravitino-iceberg-rest-server/values.yaml
@@ -283,11 +283,12 @@ service:
portName: http
nodePort: ""
+## Keep "exec" on the start command so the JVM runs as PID 1 and receives SIGTERM on pod termination.
initScript: |
echo "Override config."
cp /tmp/conf/* ${GRAVITINO_HOME}/conf
echo "Start the Gravitino Iceberg Rest Catalog Server"
- /bin/bash ${GRAVITINO_HOME}/bin/start-iceberg-rest-server.sh
+ exec /bin/bash ${GRAVITINO_HOME}/bin/start-iceberg-rest-server.sh
## Readiness probe for the Gravitino deployment
##
diff --git a/dev/charts/gravitino-lance-rest-server/tests/configmap_test.yaml b/dev/charts/gravitino-lance-rest-server/tests/configmap_test.yaml
index 031ecdb9d6..4e750e03df 100644
--- a/dev/charts/gravitino-lance-rest-server/tests/configmap_test.yaml
+++ b/dev/charts/gravitino-lance-rest-server/tests/configmap_test.yaml
@@ -50,7 +50,7 @@ tests:
path: data["gravitino-lance-rest-log4j2.properties"]
- matchRegex:
path: data["init.sh"]
- pattern: "start-lance-rest-server\\.sh"
+ pattern: "exec /bin/bash .*/start-lance-rest-server\\.sh"
- matchRegex:
path: data["gravitino-lance-rest-server.conf"]
pattern: "gravitino\\.lance-rest\\.httpPort = 9101"
diff --git a/dev/charts/gravitino-lance-rest-server/values.yaml b/dev/charts/gravitino-lance-rest-server/values.yaml
index 4efdcd16d1..6aad3e8d04 100644
--- a/dev/charts/gravitino-lance-rest-server/values.yaml
+++ b/dev/charts/gravitino-lance-rest-server/values.yaml
@@ -72,11 +72,12 @@ additionalLog4j2Properties:
appender.console.layout.pattern: "%d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n"
rootLogger.appenderRef.console.ref: consoleLogger
+## Keep "exec" on the start command so the JVM runs as PID 1 and receives SIGTERM on pod termination.
initScript: |
echo "Override config."
cp /tmp/conf/* ${GRAVITINO_HOME}/conf
echo "Start the Gravitino Lance Rest Server"
- /bin/bash ${GRAVITINO_HOME}/bin/start-lance-rest-server.sh
+ exec /bin/bash ${GRAVITINO_HOME}/bin/start-lance-rest-server.sh
## Optional volumes for logs
volumes:
diff --git a/dev/charts/gravitino/resources/scenarios/pg-values.yaml b/dev/charts/gravitino/resources/scenarios/pg-values.yaml
index e188082abf..c243f3564c 100644
--- a/dev/charts/gravitino/resources/scenarios/pg-values.yaml
+++ b/dev/charts/gravitino/resources/scenarios/pg-values.yaml
@@ -22,4 +22,4 @@ postgresql:
initScript: |
cp /tmp/conf/* ${GRAVITINO_HOME}/conf
echo "Start the Gravitino Server"
- /bin/bash ${GRAVITINO_HOME}/docker/docker-entrypoint.sh
+ exec /bin/bash ${GRAVITINO_HOME}/docker/docker-entrypoint.sh
diff --git a/dev/charts/gravitino/tests/configmap_test.yaml b/dev/charts/gravitino/tests/configmap_test.yaml
index ef05708b05..5f12fa3083 100644
--- a/dev/charts/gravitino/tests/configmap_test.yaml
+++ b/dev/charts/gravitino/tests/configmap_test.yaml
@@ -39,7 +39,7 @@ tests:
path: data["log4j2.properties"]
- matchRegex:
path: data["init.sh"]
- pattern: "docker-entrypoint\\.sh"
+ pattern: "exec /bin/bash .*/docker-entrypoint\\.sh"
- matchRegex:
path: data["gravitino.conf"]
pattern: "gravitino\\.server\\.webserver\\.httpPort = 8090"
diff --git a/dev/charts/gravitino/values.yaml b/dev/charts/gravitino/values.yaml
index 022b61e97a..4d2dada9f7 100644
--- a/dev/charts/gravitino/values.yaml
+++ b/dev/charts/gravitino/values.yaml
@@ -501,10 +501,11 @@ additionalLog4j2Properties:
appender.console.layout.pattern: "%d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n"
rootLogger.appenderRef.console.ref: consoleLogger
+## Keep "exec" on the start command so the JVM runs as PID 1 and receives SIGTERM on pod termination.
initScript: |
cp /tmp/conf/* ${GRAVITINO_HOME}/conf
echo "Start the Gravitino Server"
- /bin/bash ${GRAVITINO_HOME}/docker/docker-entrypoint.sh
+ exec /bin/bash ${GRAVITINO_HOME}/docker/docker-entrypoint.sh
## Expose the gravitino service to be accessed from outside the cluster (LoadBalancer service).
## or access it from within the cluster (ClusterIP service). Set the service type and the port to serve it.