Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helm: Add customizable global and per-container env vars to helm chart #13796

Closed
wants to merge 7 commits into from
2 changes: 1 addition & 1 deletion helm/druid/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies:
version: 8.6.4
repository: https://charts.helm.sh/stable
condition: postgresql.enabled
version: 0.3.5
version: 0.3.6
home: https://druid.apache.org/
icon: https://druid.apache.org/img/favicon.png
sources:
Expand Down
58 changes: 33 additions & 25 deletions helm/druid/README.md

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion helm/druid/templates/broker/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,16 @@ spec:
valueFrom: {fieldRef: {fieldPath: metadata.name}}
- name: POD_NAMESPACE
valueFrom: {fieldRef: {fieldPath: metadata.namespace}}
{{- with .Values.env }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- range $key, $val := .Values.broker.config }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end}}
{{- end }}
{{- with .Values.broker.env }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there is no other thing referencing environment variables I didn't see a need to get more complicated than env but if its what is needed to get this merged then sure, I'm not married to the name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i just prefer it this way to make it clear we aren't overwriting the entire environment variables section with the extra env variable, just appending

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I can see what you're saying. I'll make the change

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwitko could you make a commit for this? I agree with @georgew5656.

{{- toYaml . | nindent 10 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ template "druid.name" . }}
Expand Down
8 changes: 7 additions & 1 deletion helm/druid/templates/coordinator/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,16 @@ spec:
valueFrom: {fieldRef: {fieldPath: metadata.name}}
- name: POD_NAMESPACE
valueFrom: {fieldRef: {fieldPath: metadata.namespace}}
{{- with .Values.env }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- range $key, $val := .Values.coordinator.config }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end}}
{{- end }}
{{- with .Values.coordinator.env }}
{{- toYaml . | nindent 10 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ template "druid.name" . }}
Expand Down
12 changes: 9 additions & 3 deletions helm/druid/templates/historical/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ spec:
- topologyKey: "kubernetes.io/hostname"
labelSelector:
matchLabels:
app: "{{ template "druid.name" . }}"
app: {{ template "druid.name" . | quote }}
release: "{{ .Release.Name }}"
component: "{{ .Values.historical.name }}"
{{- else if eq .Values.historical.antiAffinity "soft" }}
Expand All @@ -73,7 +73,7 @@ spec:
topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app: "{{ template "druid.name" . }}"
app: {{ template "druid.name" . | quote }}
release: "{{ .Release.Name }}"
component: "{{ .Values.historical.name }}"
{{- end }}
Expand Down Expand Up @@ -108,10 +108,16 @@ spec:
valueFrom: {fieldRef: {fieldPath: metadata.name}}
- name: POD_NAMESPACE
valueFrom: {fieldRef: {fieldPath: metadata.namespace}}
{{- with .Values.env }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- range $key, $val := .Values.historical.config }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end}}
{{- end }}
{{- with .Values.historical.env }}
{{- toYaml . | nindent 8 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ template "druid.name" . }}
Expand Down
10 changes: 8 additions & 2 deletions helm/druid/templates/middleManager/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ spec:
topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app: "{{ template "druid.name" . }}"
app: {{ template "druid.name" . | quote }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason this field has to use the quote function instead of just quoting the value? it seems like most of the other fields in this chart use quotes, e.g.
"{{ .Release.Name }}" instead of {{ .Release.Name | quote }}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quote can take a list and quote all the values but that almost certainly would never come into play here. I personally just think its cleaner.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense to me

release: "{{ .Release.Name }}"
component: "{{ .Values.middleManager.name }}"
{{- end }}
Expand Down Expand Up @@ -108,10 +108,16 @@ spec:
valueFrom: {fieldRef: {fieldPath: metadata.name}}
- name: POD_NAMESPACE
valueFrom: {fieldRef: {fieldPath: metadata.namespace}}
{{- with .Values.env }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- range $key, $val := .Values.middleManager.config }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end}}
{{- end }}
{{- with .Values.middleManager.env }}
{{- toYaml . | nindent 8 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ template "druid.name" . }}
Expand Down
8 changes: 7 additions & 1 deletion helm/druid/templates/overlord/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,16 @@ spec:
valueFrom: {fieldRef: {fieldPath: metadata.name}}
- name: POD_NAMESPACE
valueFrom: {fieldRef: {fieldPath: metadata.namespace}}
{{- with .Values.env }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- range $key, $val := .Values.overlord.config }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end}}
{{- end }}
{{- with .Values.overlord.env }}
{{- toYaml . | nindent 10 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ template "druid.name" . }}
Expand Down
8 changes: 7 additions & 1 deletion helm/druid/templates/router/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,16 @@ spec:
valueFrom: {fieldRef: {fieldPath: metadata.name}}
- name: POD_NAMESPACE
valueFrom: {fieldRef: {fieldPath: metadata.namespace}}
{{- with .Values.env }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- range $key, $val := .Values.router.config }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end}}
{{- end }}
{{- with .Values.router.env }}
{{- toYaml . | nindent 10 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ template "druid.name" . }}
Expand Down
58 changes: 58 additions & 0 deletions helm/druid/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ configVars:
druid_emitter_logging_logLevel: debug
druid_emitter_http_recipientBaseUrl: http://druid_exporter_url:druid_exporter_port/druid

# Array of container env objects to append to all containers
env: []
# - name: druid_metadata_storage_connector_password
# valueFrom:
# secretKeyRef:
# name: myDatabaseSecret
# key: myDatabasePasswordKey

gCloudStorage:
enabled: false
secretName: google-cloud-key
Expand All @@ -74,6 +82,14 @@ broker:
druid_processing_numThreads: 1
# druid_monitoring_monitors: '["org.apache.druid.client.cache.CacheMonitor", "org.apache.druid.server.metrics.QueryCountStatsMonitor"]'

# Array of container env objects to append to broker container
env: []
# - name: druid_metadata_storage_connector_password
# valueFrom:
# secretKeyRef:
# name: myDatabaseSecret
# key: myDatabasePasswordKey

ingress:
enabled: false
annotations: {}
Expand Down Expand Up @@ -129,6 +145,14 @@ coordinator:
DRUID_XMS: 256m
# druid_monitoring_monitors: '["org.apache.druid.server.metrics.TaskCountStatsMonitor"]'

# Array of container env objects to append to coordinator container
env: []
# - name: druid_metadata_storage_connector_password
# valueFrom:
# secretKeyRef:
# name: myDatabaseSecret
# key: myDatabasePasswordKey

ingress:
enabled: false
annotations: {}
Expand Down Expand Up @@ -179,6 +203,16 @@ overlord:
port: 8081
serviceType: ClusterIP

config: {}

# Array of container env objects to append to overlord container
env: []
# - name: druid_metadata_storage_connector_password
# valueFrom:
# secretKeyRef:
# name: myDatabaseSecret
# key: myDatabasePasswordKey

javaOpts: "-Xms1G -Xmx1G"

ingress:
Expand Down Expand Up @@ -235,6 +269,14 @@ historical:
# druid_monitoring_monitors: '["org.apache.druid.client.cache.CacheMonitor", "org.apache.druid.server.metrics.HistoricalMetricsMonitor", "org.apache.druid.server.metrics.QueryCountStatsMonitor"]'
# druid_segmentCache_locations: '[{"path":"/opt/druid/var/druid/segment-cache","maxSize":300000000000}]'

# Array of container env objects to append to historical container
env: []
# - name: druid_metadata_storage_connector_password
# valueFrom:
# secretKeyRef:
# name: myDatabaseSecret
# key: myDatabasePasswordKey

ingress:
enabled: false
annotations: {}
Expand Down Expand Up @@ -314,6 +356,14 @@ middleManager:
druid_indexer_runner_javaOptsArray: '["-server", "-Xms256m", "-Xmx256m", "-XX:MaxDirectMemorySize=300m", "-Duser.timezone=UTC", "-Dfile.encoding=UTF-8", "-XX:+ExitOnOutOfMemoryError", "-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager"]'
druid_indexer_fork_property_druid_processing_buffer_sizeBytes: '25000000'

# Array of container env objects to append to middleManager container
env: []
# - name: druid_metadata_storage_connector_password
# valueFrom:
# secretKeyRef:
# name: myDatabaseSecret
# key: myDatabasePasswordKey

autoscaling:
enabled: false
minReplicas: 2
Expand Down Expand Up @@ -407,6 +457,14 @@ router:
DRUID_XMS: 128m
DRUID_MAXDIRECTMEMORYSIZE: 128m

# Array of container env objects to append to router container
env: []
# - name: druid_metadata_storage_connector_password
# valueFrom:
# secretKeyRef:
# name: myDatabaseSecret
# key: myDatabasePasswordKey

ingress:
enabled: false
annotations: {}
Expand Down