You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polaris.apache.org by ad...@apache.org on 2025/01/03 11:57:53 UTC

(polaris) branch main updated: Add `bootstrapExtraEnv` for bootstrapping job (#601)

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

adutra pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git


The following commit(s) were added to refs/heads/main by this push:
     new 50641074 Add `bootstrapExtraEnv` for bootstrapping job (#601)
50641074 is described below

commit 5064107464c595f16d18269fc5604ddbcd42b6ff
Author: Gerrit-K <Ge...@users.noreply.github.com>
AuthorDate: Fri Jan 3 12:57:48 2025 +0100

    Add `bootstrapExtraEnv` for bootstrapping job (#601)
---
 helm/polaris/README.md           |  1 +
 helm/polaris/templates/job.yaml  |  4 ++++
 helm/polaris/tests/job_test.yaml | 20 ++++++++++++++++++++
 helm/polaris/values.yaml         |  3 +++
 4 files changed, 28 insertions(+)

diff --git a/helm/polaris/README.md b/helm/polaris/README.md
index 858ffce4..3230cc17 100644
--- a/helm/polaris/README.md
+++ b/helm/polaris/README.md
@@ -74,6 +74,7 @@ $ helm uninstall --namespace polaris polaris
 | autoscaling.minReplicas | int | `1` | The minimum number of replicas to maintain. |
 | autoscaling.targetCPUUtilizationPercentage | int | `80` | Optional; set to zero or empty to disable. |
 | autoscaling.targetMemoryUtilizationPercentage | string | `nil` | Optional; set to zero or empty to disable. |
+| bootstrapExtraEnv | list | `[]` | Extra environment variables to add to the bootstrap metastore manager job (see `extraEnv` for an example) |
 | bootstrapMetastoreManager | bool | `false` | Configures whether to enable the bootstrap metastore manager job |
 | configMapLabels | object | `{}` | Additional Labels to apply to polaris configmap. |
 | extraEnv | list | `[]` | Advanced configuration via Environment Variables. Extra environment variables to add to the Polaris server container. You can pass here any valid EnvVar object: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#envvar-v1-core This can be useful to get configuration values from Kubernetes secrets or config maps. |
diff --git a/helm/polaris/templates/job.yaml b/helm/polaris/templates/job.yaml
index 456b28ab..fb84e57d 100644
--- a/helm/polaris/templates/job.yaml
+++ b/helm/polaris/templates/job.yaml
@@ -77,6 +77,10 @@ spec:
           imagePullPolicy: {{ tpl .Values.image.pullPolicy . }}
           command: ["/app/bin/polaris-service"]
           args: ["bootstrap", "/app/config/polaris-server.yml"]
+          {{- if .Values.bootstrapExtraEnv }}
+          env:
+            {{- tpl (toYaml .Values.bootstrapExtraEnv) . | nindent 12 }}
+          {{- end }}
           volumeMounts:
             - name: config-volume
               mountPath: /app/config/polaris-server.yml
diff --git a/helm/polaris/tests/job_test.yaml b/helm/polaris/tests/job_test.yaml
index 6c6e7a9f..7dc54870 100644
--- a/helm/polaris/tests/job_test.yaml
+++ b/helm/polaris/tests/job_test.yaml
@@ -415,6 +415,26 @@ tests:
               cpu: 200m
               memory: 256Mi
 
+  # spec.template.spec.containers[0].env (with bootstrapMetastoreManager enabled)
+  - it: should not set container env by default
+    set:
+      bootstrapMetastoreManager: true
+    asserts:
+      - notExists:
+          path: spec.template.spec.containers[0].env
+  - it: should set container env
+    set:
+      bootstrapMetastoreManager: true
+      bootstrapExtraEnv:
+        - name: foo
+          value: bar
+    asserts:
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: foo
+            value: bar
+
   # spec.template.spec.nodeSelector (with bootstrapMetastoreManager enabled)
   - it: should not set nodeSelector by default
     set:
diff --git a/helm/polaris/values.yaml b/helm/polaris/values.yaml
index 0dd9f969..72e84960 100644
--- a/helm/polaris/values.yaml
+++ b/helm/polaris/values.yaml
@@ -236,6 +236,9 @@ extraEnv:
 # -- Configures whether to enable the bootstrap metastore manager job
 bootstrapMetastoreManager: false
 
+# -- Extra environment variables to add to the bootstrap metastore manager job (see `extraEnv` for an example)
+bootstrapExtraEnv: []
+
 # -- The secret name to pull persistence.xml from (ensure the key name is 'persistence.xml')
 persistenceConfigSecret: ~