Skip to content

Commit

Permalink
Merge pull request #723 from robgordon89/fix/pod-name-env-ha-fix
Browse files Browse the repository at this point in the history
chore: fix for POD_NAME and POD_NAMESPACE envs when enableHA is true
  • Loading branch information
Bharath Nallapeta authored Aug 7, 2024
2 parents e6d833b + ef0ea91 commit 04a9874
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ spec:
{{- else }}
valueFrom:
resourceFieldRef:
resource: limits.memory
resource: limits.cpu
{{- end }}
- name: GOMEMLIMIT
{{- if .Values.reloader.deployment.gomemlimitOverride }}
value: {{ .Values.reloader.deployment.gomemlimitOverride | quote }}
{{- else }}
valueFrom:
resourceFieldRef:
resource: limits.cpu
resource: limits.memory
{{- end }}
{{- range $name, $value := .Values.reloader.deployment.env.open }}
{{- if not (empty $value) }}
Expand Down Expand Up @@ -127,6 +127,7 @@ spec:
fieldRef:
fieldPath: {{ $value | quote}}
{{- end }}
{{- end }}
{{- if eq .Values.reloader.watchGlobally false }}
- name: KUBERNETES_NAMESPACE
valueFrom:
Expand All @@ -146,7 +147,6 @@ spec:
{{- if .Values.reloader.enableMetricsByNamespace }}
- name: METRICS_COUNT_BY_NAMESPACE
value: enabled
{{- end }}
{{- end }}
ports:
- name: http
Expand Down
13 changes: 13 additions & 0 deletions deployments/kubernetes/chart/reloader/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,16 @@ tests:
asserts:
- isEmpty:
path: spec.template.spec.containers[0].securityContext

- it: template still sets POD_NAME and POD_NAMESPACE environment variables when enableHA is true
set:
reloader:
enableHA: true
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name

0 comments on commit 04a9874

Please sign in to comment.