Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
[apm-server] Add envFrom parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
cartonalexandre committed Apr 8, 2020
1 parent f71a6b7 commit c6e7e63
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions apm-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ helm install --name apm-server elastic/apm-server --set imageTag=7.6.2
| `extraContainers` | Templatable string of additional containers to be passed to the `tpl` function | `""` |
| `extraInitContainers` | Templatable string of additional containers to be passed to the `tpl` function | `""` |
| `extraEnvs` | Extra [environment variables](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/#using-environment-variables-inside-of-your-config) which will be appended to the `env:` definition for the container | `[]` |
| `envFrom` | Templatable string of envFrom to be passed to the [environment from variables](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables) which will be appended to the `envFrom:` definition for the container | `[]` |
| `extraVolumeMounts` | List of additional volumeMounts | `[]` |
| `extraVolumes` | List of additional volumes | `[]` |
| `image` | The APM Server docker image | `docker.elastic.co/apm/apm-server` |
Expand Down
4 changes: 4 additions & 0 deletions apm-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ spec:
env:
{{ toYaml . | nindent 10 }}
{{- end }}
{{- if .Values.envFrom }}
envFrom:
{{ toYaml .Values.envFrom | indent 10 }}
{{- end }}
{{- if .Values.podSecurityContext }}
securityContext:
{{ toYaml .Values.podSecurityContext | indent 10 }}
Expand Down
9 changes: 9 additions & 0 deletions apm-server/tests/apmserver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ def test_adding_envs():
envs = r["deployment"][name]["spec"]["template"]["spec"]["containers"][0]["env"]
assert {"name": "LOG_LEVEL", "value": "DEBUG"} in envs

def test_adding_env_from():
config = """
envFrom:
- secretRef:
name: secret-name
"""
r = helm_template(config)
secretRef = r["deployment"][name]["spec"]["template"]["spec"]["containers"][0]["envFrom"][0]["secretRef"]
assert secretRef == {"name": "secret-name"}

def test_adding_image_pull_secrets():
config = """
Expand Down
7 changes: 7 additions & 0 deletions apm-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ extraEnvs: []
# name: elastic-credentials
# key: password

# Allows you to load environment variables from kubernetes secret or config map
envFrom: []
# - secretRef:
# name: env-secret
# - configMapRef:
# name: config-map

extraVolumeMounts: []
# - name: extras
# mountPath: /usr/share/extras
Expand Down

0 comments on commit c6e7e63

Please sign in to comment.