This is an automated email from the ASF dual-hosted git repository.

jshao pushed a commit to branch branch-1.0
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/branch-1.0 by this push:
     new a22078b361 [#8550]The init.sh is configurable in values.yaml and 
monitor configmap.yaml changes (#8671)
a22078b361 is described below

commit a22078b361ff2168f7d281aa0b3fc825a61bf8c9
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Sep 25 14:06:41 2025 +0800

    [#8550]The init.sh is configurable in values.yaml and monitor 
configmap.yaml changes (#8671)
    
    ### What changes were proposed in this pull request?
    
    1. The init.sh is configurable in values.yaml
    2. Monitor configmap.yaml changes , so that when run helm upgrade, all
    changes in init.sh, gravitio.conf, log4j2.properties can be applied to
    pod automatically.
    
    ### Why are the changes needed?
    
    Fix: #8550
    
    ### Does this PR introduce _any_ user-facing change?
    
    N/A
    
    ### How was this patch tested?
    
    CI
    
    Co-authored-by: Danhua Wang <[email protected]>
    Co-authored-by: Jerry Shao <[email protected]>
---
 .../resources/init.sh                              | 25 ---------------------
 .../templates/configmap.yaml                       |  2 ++
 .../templates/deployment.yaml                      |  4 +++-
 .../gravitino-iceberg-rest-server/values.yaml      |  6 +++++
 dev/charts/gravitino/resources/config/init.sh      | 26 ----------------------
 dev/charts/gravitino/templates/configmap.yaml      |  2 +-
 dev/charts/gravitino/templates/deployment.yaml     |  1 +
 dev/charts/gravitino/values.yaml                   |  5 +++++
 8 files changed, 18 insertions(+), 53 deletions(-)

diff --git a/dev/charts/gravitino-iceberg-rest-server/resources/init.sh 
b/dev/charts/gravitino-iceberg-rest-server/resources/init.sh
deleted file mode 100644
index a1d009f338..0000000000
--- a/dev/charts/gravitino-iceberg-rest-server/resources/init.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you 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.
-#
-echo "Override config."
-cp /tmp/conf/* ${GRAVITINO_HOME}/conf
-cp /tmp/conf/log4j2.properties ${GRAVITINO_HOME}/conf
-
-echo "Start the Gravitino Iceberg Rest Catalog Server"
-/bin/bash ${GRAVITINO_HOME}/bin/gravitino-iceberg-rest-server.sh run
diff --git a/dev/charts/gravitino-iceberg-rest-server/templates/configmap.yaml 
b/dev/charts/gravitino-iceberg-rest-server/templates/configmap.yaml
index 77231b2244..004030a520 100644
--- a/dev/charts/gravitino-iceberg-rest-server/templates/configmap.yaml
+++ b/dev/charts/gravitino-iceberg-rest-server/templates/configmap.yaml
@@ -25,6 +25,8 @@ metadata:
   labels:
     {{- include "gravitino-iceberg-rest-server.labels" . | nindent 4 }}
 data:
+  init.sh: |-
+    {{- tpl .Values.initScript . | nindent 4 }}
 {{ $root := . }}
 {{ range $path, $bytes := .Files.Glob "resources/*" }}
 {{ base $path | indent 2 }}: |-
diff --git a/dev/charts/gravitino-iceberg-rest-server/templates/deployment.yaml 
b/dev/charts/gravitino-iceberg-rest-server/templates/deployment.yaml
index 2bb2c14a1d..d838c331d8 100644
--- a/dev/charts/gravitino-iceberg-rest-server/templates/deployment.yaml
+++ b/dev/charts/gravitino-iceberg-rest-server/templates/deployment.yaml
@@ -39,9 +39,11 @@ spec:
 
   template:
     metadata:
+
+      annotations:
+        checksum/config: {{ include (print $.Template.BasePath 
"/configmap.yaml") . | sha256sum }}
       # Pod annotations (if configured)
       {{- with .Values.podAnnotations }}
-      annotations:
         {{- toYaml . | nindent 8 }}
       {{- end }}
 
diff --git a/dev/charts/gravitino-iceberg-rest-server/values.yaml 
b/dev/charts/gravitino-iceberg-rest-server/values.yaml
index 134f71cc13..90bb5fcc08 100644
--- a/dev/charts/gravitino-iceberg-rest-server/values.yaml
+++ b/dev/charts/gravitino-iceberg-rest-server/values.yaml
@@ -274,6 +274,12 @@ service:
   portName: http
   nodePort: ""
 
+initScript: |
+  echo "Override config."
+  cp /tmp/conf/* ${GRAVITINO_HOME}/conf
+  echo "Start the Gravitino Iceberg Rest Catalog Server"
+  /bin/bash ${GRAVITINO_HOME}/bin/gravitino-iceberg-rest-server.sh run
+
 ## Readiness probe for the Gravitino deployment
 ##
 readinessProbe:
diff --git a/dev/charts/gravitino/resources/config/init.sh 
b/dev/charts/gravitino/resources/config/init.sh
deleted file mode 100644
index a91f20cacb..0000000000
--- a/dev/charts/gravitino/resources/config/init.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you 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.
-#
-
-
-cp /tmp/conf/* ${GRAVITINO_HOME}/conf
-cp /tmp/conf/log4j2.properties ${GRAVITINO_HOME}/conf
-
-echo "Start the Gravitino Server"
-/bin/bash ${GRAVITINO_HOME}/bin/gravitino.sh run
diff --git a/dev/charts/gravitino/templates/configmap.yaml 
b/dev/charts/gravitino/templates/configmap.yaml
index a76f65fb35..c497b8e07b 100644
--- a/dev/charts/gravitino/templates/configmap.yaml
+++ b/dev/charts/gravitino/templates/configmap.yaml
@@ -26,7 +26,7 @@ metadata:
     {{- include "gravitino.labels" . | nindent 4 }}
 data:
   init.sh: |-
-    {{- tpl (.Files.Get "resources/config/init.sh") . | nindent 4 }}
+    {{- tpl .Values.initScript . | nindent 4 }}
   gravitino.conf: |
     {{- tpl (.Files.Get "resources/config/gravitino.conf") . | nindent 4 }}
   log4j2.properties: |-
diff --git a/dev/charts/gravitino/templates/deployment.yaml 
b/dev/charts/gravitino/templates/deployment.yaml
index 59c25f5c88..700df9463b 100644
--- a/dev/charts/gravitino/templates/deployment.yaml
+++ b/dev/charts/gravitino/templates/deployment.yaml
@@ -42,6 +42,7 @@ spec:
         {{- toYaml . | nindent 8 }}
         {{- end }}
       annotations:
+        checksum/config: {{ include (print $.Template.BasePath 
"/configmap.yaml") . | sha256sum }}
         {{- with .Values.podAnnotations }}
           {{- toYaml . | nindent 8 }}
           {{- end }}
diff --git a/dev/charts/gravitino/values.yaml b/dev/charts/gravitino/values.yaml
index acb4f22d1e..f7a80a4ef0 100644
--- a/dev/charts/gravitino/values.yaml
+++ b/dev/charts/gravitino/values.yaml
@@ -383,6 +383,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
 
+initScript: |
+  cp /tmp/conf/* ${GRAVITINO_HOME}/conf
+  echo "Start the Gravitino Server"
+  /bin/bash ${GRAVITINO_HOME}/bin/gravitino.sh run
+
 ## 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.
 ## ref: http://kubernetes.io/docs/user-guide/services/

Reply via email to