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

[apm-server]Fix fullnameOverride setting #508

Merged
merged 4 commits into from
Mar 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apm-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "apm.fullname" }}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-"}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for ingress.
Expand Down
18 changes: 18 additions & 0 deletions apm-server/tests/apmserver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,21 @@ def test_priority_class_name():
"priorityClassName"
]
assert priority_class_name == "highest"


def test_setting_fullnameOverride():
config = """
fullnameOverride: "apm-server-custom"
"""
r = helm_template(config)

custom_name = "apm-server-custom"
assert custom_name in r["deployment"]
assert custom_name in r["service"]

assert (
r["deployment"][custom_name]["spec"]["template"]["spec"]["containers"][0][
"name"
]
== project
)