From 0f444f35c2b1b795ba3764de2a82ba9ca7593fb6 Mon Sep 17 00:00:00 2001 From: kawat55 Date: Fri, 6 Mar 2020 11:00:13 +0900 Subject: [PATCH 1/4] [apm-server]Fix fullnameOverride setting --- apm-server/templates/_helpers.tpl | 4 ++++ apm-server/tests/apmserver_test.py | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/apm-server/templates/_helpers.tpl b/apm-server/templates/_helpers.tpl index dd746b018..abc1361ea 100755 --- a/apm-server/templates/_helpers.tpl +++ b/apm-server/templates/_helpers.tpl @@ -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. diff --git a/apm-server/tests/apmserver_test.py b/apm-server/tests/apmserver_test.py index 309922ba3..a48c6c2a5 100644 --- a/apm-server/tests/apmserver_test.py +++ b/apm-server/tests/apmserver_test.py @@ -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 + ) \ No newline at end of file From 65630163aea1d0c22f01e921d7e0798eaaa6b65d Mon Sep 17 00:00:00 2001 From: kawat55 Date: Fri, 6 Mar 2020 11:31:38 +0900 Subject: [PATCH 2/4] fixes #481 From d7cbf2092982032d2542fd31fc43e86464427ad4 Mon Sep 17 00:00:00 2001 From: kawat55 Date: Fri, 6 Mar 2020 16:17:08 +0900 Subject: [PATCH 3/4] Typo --- apm-server/tests/apmserver_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm-server/tests/apmserver_test.py b/apm-server/tests/apmserver_test.py index a48c6c2a5..62a64b0ec 100644 --- a/apm-server/tests/apmserver_test.py +++ b/apm-server/tests/apmserver_test.py @@ -304,7 +304,7 @@ def test_setting_fullnameOverride(): """ r = helm_template(config) - custom_name = 'apm-server-custom' + custom_name = "apm-server-custom" assert custom_name in r["deployment"] assert custom_name in r["service"] From 4342e1d17c16c38674ad961ee4148f976438b726 Mon Sep 17 00:00:00 2001 From: kawat55 Date: Fri, 6 Mar 2020 16:46:34 +0900 Subject: [PATCH 4/4] Add EOF --- apm-server/tests/apmserver_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm-server/tests/apmserver_test.py b/apm-server/tests/apmserver_test.py index 62a64b0ec..2ed716433 100644 --- a/apm-server/tests/apmserver_test.py +++ b/apm-server/tests/apmserver_test.py @@ -313,4 +313,4 @@ def test_setting_fullnameOverride(): "name" ] == project - ) \ No newline at end of file + )