Skip to content

Commit

Permalink
Remove the possibility to use the deprecated envVars notation for env…
Browse files Browse the repository at this point in the history
…ironment variables and add POD_NAME and POD_NAMESPACE env variables by default
  • Loading branch information
tcassaert committed Mar 14, 2023
1 parent ab5466f commit 65a6773
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion kubernetes/charts/sparkapplication/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: sparkapplication
description: A Helm chart for deploying Spark applications on Kubernetes, using the Spark Operator.
type: application
version: 0.8.3
version: 0.9.0
appVersion: 3.1.1
4 changes: 2 additions & 2 deletions kubernetes/charts/sparkapplication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ There are 4 required parameters to be set:

| Parameter | Description | Default |
|------------------------|-----------------------------------------------------|------------------|
| `driver.envVars` | Environment variables for the driver | |
| `driver.env` | Environment variables for the driver | |
| `driver.cores` | How many cores the driver can use | `2` |
| `driver.memory` | Memory limimt for the driver | `"4096m"` |
| `driver.userId` | User to run the container as | |
| `executor.cores` | How many cores the driver can use | `2` |
| `executor.envVars` | Environment variables for the driver | |
| `executor.env` | Environment variables for the driver | |
| `executor.instances` | Number of executors | `1` |
| `executor.memory` | Memory limit for the driver | `"4096m"` |
| `fileDependencies` | File dependencies for the application | |
Expand Down
35 changes: 24 additions & 11 deletions kubernetes/charts/sparkapplication/templates/sparkapplication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,19 @@ spec:
{{- end }}
{{- end }}
driver:
envVars:
IMAGE_NAME: {{ .Values.image }}:{{ .Values.imageVersion }}
{{- if .Values.driver.envVars }}
{{- range $name, $value := .Values.driver.envVars }}
{{ $name }}: {{ $value | quote }}
{{- end }}
env:
- name: IMAGE_NAME
value: {{ .Values.image }}:{{ .Values.imageVersion }}
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if .Values.driver.env }}
{{ toYaml .Values.driver.env | indent 8 }}
{{- end }}
{{- if .Values.driver.javaOptions }}
javaOptions: {{ .Values.driver.javaOptions }}
Expand Down Expand Up @@ -86,11 +93,17 @@ spec:
{{ toYaml .Values.initContainers | indent 6 }}
{{- end }}
executor:
{{- if .Values.executor.envVars }}
envVars:
{{- range $name, $value := .Values.executor.envVars }}
{{ $name | quote }}: {{ $value | quote }}
{{- end }}
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if .Values.executor.env }}
{{ toYaml .Values.executor.env | indent 8 }}
{{- end }}
{{- if .Values.executor.javaOptions }}
javaOptions: {{ .Values.executor.javaOptions }}
Expand Down

0 comments on commit 65a6773

Please sign in to comment.