Skip to content

Commit 95e0d62

Browse files
authored
feat(helm): add envFrom (#4153)
* feat(helm): add envFrom + tests
1 parent eb9d51b commit 95e0d62

6 files changed

Lines changed: 54 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ request adding CHANGELOG notes for breaking (!) changes and possibly other secti
4747

4848
### New Features
4949

50+
- Added `envFrom` support in Helm chart.
5051
- Added `deploymentAnnotations` support in Helm chart.
5152
- Added KMS properties (optional) to catalog storage config to enable S3 data encryption.
5253
- Added `topologySpreadConstraints` support in Helm chart.

helm/polaris/templates/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ spec:
9494
{{- tpl (toYaml .Values.extraEnv) . | nindent 12 -}}
9595
{{- end -}}
9696
{{- end }}
97+
{{- if .Values.envFrom }}
98+
envFrom:
99+
{{- tpl (toYaml .Values.envFrom) . | nindent 12 }}
100+
{{- end }}
97101
volumeMounts:
98102
- name: config-volume
99103
mountPath: {{ trimSuffix "/" .Values.image.configDir }}

helm/polaris/tests/deployment_test.yaml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ tests:
188188
asserts:
189189
- exists:
190190
path: spec.template.metadata.annotations.checksum/config
191-
- matchRegex:
191+
- matchRegex:
192192
path: spec.template.metadata.annotations.checksum/config
193193
pattern: "^[a-f0-9]{64}$"
194194
- it: should set pod annotations
@@ -1124,12 +1124,38 @@ tests:
11241124
name: polaris-storage-secret
11251125
key: awsAccessKeyId
11261126

1127+
- it: should set envFrom
1128+
template: deployment.yaml
1129+
set:
1130+
envFrom:
1131+
- secretRef:
1132+
name: polaris-env-secret
1133+
- configMapRef:
1134+
name: polaris-env-configmap
1135+
asserts:
1136+
- contains:
1137+
path: spec.template.spec.containers[0].envFrom
1138+
content:
1139+
secretRef:
1140+
name: polaris-env-secret
1141+
- contains:
1142+
path: spec.template.spec.containers[0].envFrom
1143+
content:
1144+
configMapRef:
1145+
name: polaris-env-configmap
1146+
11271147
- it: should not set any environment variables by default
11281148
template: deployment.yaml
11291149
asserts:
11301150
- notExists:
11311151
path: spec.template.spec.containers[0].env
11321152

1153+
- it: should not set envFrom by default
1154+
template: deployment.yaml
1155+
asserts:
1156+
- notExists:
1157+
path: spec.template.spec.containers[0].envFrom
1158+
11331159
- it: should configure config volume
11341160
template: deployment.yaml
11351161
set:

helm/polaris/values.schema.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,13 @@
193193
"type": "string"
194194
}
195195
},
196+
"envFrom": {
197+
"description": "Bulk import environment variables from Secrets or ConfigMaps. Defines sources to populate environment variables using Kubernetes `envFrom`. Each referenced Secret or ConfigMap will expose all its key-value pairs as environment variables inside the Polaris container. [EnvFrom API](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#envfromsource-v1-core)",
198+
"type": "array",
199+
"items": {
200+
"type": "object"
201+
}
202+
},
196203
"extraEnv": {
197204
"description": "Advanced configuration via Environment Variables. Extra environment variables to add to the Polaris server container. You can pass here any valid EnvVar object: [EnvVar API](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.",
198205
"type": "array",

helm/polaris/values.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,8 +643,7 @@ advancedConfig:
643643
# [EnvVar API](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#envvar-v1-core)
644644
# This can be useful to get configuration values from Kubernetes secrets or config maps.
645645
# @section -- Advanced Configuration
646-
extraEnv:
647-
[]
646+
extraEnv: []
648647
# - name: AWS_STORAGE_BUCKET
649648
# value: s3://xxxxx/
650649
# - name: AWS_ACCESS_KEY_ID
@@ -658,6 +657,19 @@ extraEnv:
658657
# name: aws-secret
659658
# key: secret_access_key
660659

660+
# @schema item: object
661+
# -- Bulk import environment variables from Secrets or ConfigMaps.
662+
# Defines sources to populate environment variables using Kubernetes `envFrom`.
663+
# Each referenced Secret or ConfigMap will expose all its key-value pairs
664+
# as environment variables inside the Polaris container.
665+
# [EnvFrom API](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#envfromsource-v1-core)
666+
# @section -- Advanced Configuration
667+
envFrom: []
668+
# - secretRef:
669+
# name: polaris-env-secret
670+
# - configMapRef:
671+
# name: polaris-env-configmap
672+
661673
# @schema item: object
662674
# -- Extra volumes to add to the polaris pod. See [Volumes](https://kubernetes.io/docs/concepts/storage/volumes/).
663675
# @section -- Advanced Configuration

site/content/in-dev/unreleased/helm-chart/reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ weight: 900
197197
|-----|------|---------|-------------|
198198
| advancedConfig | object | `{"quarkus.http.access-log.enabled":true}` | Advanced configuration. You can pass here any valid Polaris or Quarkus configuration property. Any property that is defined here takes precedence over all the other configuration values generated by this chart. Properties can be passed "flattened" or as nested YAML objects (see examples below). Refer to Polaris [Configuration reference](https://polaris.apache.org/in-dev/unreleased/configuration/configuration-reference) for a complete list of Polaris configuration properties, and to the [Quarkus Configuration Reference](https://quarkus.io/guides/all-config) for a complete list of Quarkus configuration properties. |
199199
| 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: [EnvVar API](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. |
200+
| envFrom | list | `[]` | Bulk import environment variables from Secrets or ConfigMaps. Defines sources to populate environment variables using Kubernetes `envFrom`. Each referenced Secret or ConfigMap will expose all its key-value pairs as environment variables inside the Polaris container. [EnvFrom API](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#envfromsource-v1-core) |
200201
| extraVolumes | list | `[]` | Extra volumes to add to the polaris pod. See [Volumes](https://kubernetes.io/docs/concepts/storage/volumes/). |
201202
| extraVolumeMounts | list | `[]` | Extra volume mounts to add to the polaris container. See [Volumes](https://kubernetes.io/docs/concepts/storage/volumes/). |
202203
| extraInitContainers | list | `[]` | Add additional init containers to the polaris pod(s) See [Init Containers](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/). |

0 commit comments

Comments
 (0)