obelix74 commented on code in PR #3385:
URL: https://github.com/apache/polaris/pull/3385#discussion_r2819190167


##########
helm/polaris/ci/fixtures/bootstrap.yaml:
##########
@@ -0,0 +1,78 @@
+#
+# 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.
+#
+
+# This Job bootstraps the Polaris database with metrics tables enabled.
+# It runs the polaris-admin-tool bootstrap command with --include-metrics
+# to create the required schema (v4+) for JDBC metrics persistence.
+#
+# This Job must complete before the Polaris server starts to ensure
+# the production readiness check for metrics persistence passes.
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: polaris-bootstrap
+spec:
+  backoffLimit: 3
+  ttlSecondsAfterFinished: 300
+  template:
+    spec:
+      restartPolicy: OnFailure
+      initContainers:
+        # Wait for PostgreSQL to be ready before running bootstrap
+        - name: wait-for-postgres
+          image: busybox:1.37
+          command:
+            - sh
+            - -c
+            - |
+              echo "Waiting for PostgreSQL to be ready..."
+              until nc -z -v -w30 postgres 5432; do
+                echo "Waiting for PostgreSQL connection..."
+                sleep 2
+              done
+              echo "PostgreSQL is ready!"
+      containers:
+        - name: bootstrap
+          image: apache/polaris-admin-tool:latest
+          imagePullPolicy: Never
+          env:
+            - name: POLARIS_PERSISTENCE_TYPE
+              value: relational-jdbc
+            - name: QUARKUS_DATASOURCE_JDBC_URL
+              valueFrom:
+                secretKeyRef:
+                  name: polaris-persistence
+                  key: jdbcUrl
+            - name: QUARKUS_DATASOURCE_USERNAME
+              valueFrom:
+                secretKeyRef:
+                  name: polaris-persistence
+                  key: username
+            - name: QUARKUS_DATASOURCE_PASSWORD
+              valueFrom:
+                secretKeyRef:
+                  name: polaris-persistence
+                  key: password
+          args:
+            - bootstrap
+            - --realm=POLARIS
+            - --credential=POLARIS,root,s3cr3t
+            - --print-credentials
+            - --include-metrics

Review Comment:
   Creates a Kubernetes Job that runs polaris-admin bootstrap --include-metrics 
with proper init container to wait for PostgreSQL.
   
   If there is a better way to do this without changing helm chart, but to 
update the main bootstrap code to pass this, please let me know.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to