From df1042fb5ac2252e8dde4bc7c7e33750f174c0f0 Mon Sep 17 00:00:00 2001 From: Laszlo Fogas Date: Wed, 19 Jan 2022 09:03:10 +0100 Subject: [PATCH] Making ingress path configurable --- charts/onechart/templates/ingress.yaml | 2 +- charts/onechart/tests/ingress_path_test.yaml | 21 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 charts/onechart/tests/ingress_path_test.yaml diff --git a/charts/onechart/templates/ingress.yaml b/charts/onechart/templates/ingress.yaml index a9cb58b..d732c9c 100644 --- a/charts/onechart/templates/ingress.yaml +++ b/charts/onechart/templates/ingress.yaml @@ -39,7 +39,7 @@ spec: - host: {{ .ingress.host | quote }} http: paths: - - path: "/" + - path: {{ .ingress.path | default "/" | quote }} pathType: "Prefix" backend: service: diff --git a/charts/onechart/tests/ingress_path_test.yaml b/charts/onechart/tests/ingress_path_test.yaml new file mode 100644 index 0000000..e49df84 --- /dev/null +++ b/charts/onechart/tests/ingress_path_test.yaml @@ -0,0 +1,21 @@ +suite: test ingress +templates: + - ingress.yaml +tests: + - it: Should default + set: + ingress: + host: chart-example.local + asserts: + - equal: + path: spec.rules[0].http.paths[0].path + value: "/" + - it: Should use path + set: + ingress: + host: chart-example.local + path: "/mypath" + asserts: + - equal: + path: spec.rules[0].http.paths[0].path + value: "/mypath"