From e10c2cfd398873351ec2eddf8291b08030a41671 Mon Sep 17 00:00:00 2001 From: Brendan Dalpe Date: Fri, 30 Sep 2022 23:12:35 -0500 Subject: [PATCH 1/2] Fix ingress prefix AWS does not support wildcards in the path --- helm-chart-sources/logstream-leader/templates/ingress.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart-sources/logstream-leader/templates/ingress.yaml b/helm-chart-sources/logstream-leader/templates/ingress.yaml index fe61836..8fe7240 100644 --- a/helm-chart-sources/logstream-leader/templates/ingress.yaml +++ b/helm-chart-sources/logstream-leader/templates/ingress.yaml @@ -17,7 +17,7 @@ spec: rules: - http: paths: - - path: /* + - path: / pathType: Prefix backend: service: From 9368af0216ab2434731bfe3d836e59d3fcae631c Mon Sep 17 00:00:00 2001 From: Brendan Dalpe Date: Wed, 11 Jan 2023 07:55:34 -0600 Subject: [PATCH 2/2] Allow for dynamic Ingress Prefix setting. Fixes #92 --- helm-chart-sources/logstream-leader/README.md | 1 + .../logstream-leader/templates/ingress.yaml | 2 +- .../logstream-leader/tests/ingress_test.yaml | 66 +++++++++++++++++++ .../logstream-leader/values.yaml | 1 + 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 helm-chart-sources/logstream-leader/tests/ingress_test.yaml diff --git a/helm-chart-sources/logstream-leader/README.md b/helm-chart-sources/logstream-leader/README.md index 96b6c95..be8e396 100644 --- a/helm-chart-sources/logstream-leader/README.md +++ b/helm-chart-sources/logstream-leader/README.md @@ -75,6 +75,7 @@ This section covers the most likely values to override. To see the full scope of |ingress.annotations|{}|If `ingress.enable` is set to `true`, this is where you'll want to put annotations to configure the specific ingress controller. _*NOTE: Ingress is supported only on Kubernetes 1.19 and later clusters*_. | |ingress.tls|{}|[Ingress TLS configuration](https://kubernetes.io/docs/concepts/services-networking/ingress/#tls)| |ingress.ingressClassName|none|Override the default ingress class ([added in Kubernetes 1.18](https://kubernetes.io/docs/concepts/services-networking/ingress/#deprecated-annotation))| +|ingress.path|`/*`|The Ingress path Prefix| # Basic Installation diff --git a/helm-chart-sources/logstream-leader/templates/ingress.yaml b/helm-chart-sources/logstream-leader/templates/ingress.yaml index 8fe7240..8ce1fa3 100644 --- a/helm-chart-sources/logstream-leader/templates/ingress.yaml +++ b/helm-chart-sources/logstream-leader/templates/ingress.yaml @@ -17,7 +17,7 @@ spec: rules: - http: paths: - - path: / + - path: {{ .Values.ingress.prefix }} pathType: Prefix backend: service: diff --git a/helm-chart-sources/logstream-leader/tests/ingress_test.yaml b/helm-chart-sources/logstream-leader/tests/ingress_test.yaml new file mode 100644 index 0000000..ab4d9ef --- /dev/null +++ b/helm-chart-sources/logstream-leader/tests/ingress_test.yaml @@ -0,0 +1,66 @@ +suite: Ingress +templates: + - ingress.yaml + - service.yaml +tests: + - it: Doesn't create an Ingress by default + template: ingress.yaml + asserts: + - hasDocuments: + count: 0 + + - it: Should leave the service type as the default + template: service.yaml + asserts: + - equal: + path: spec.type + value: "LoadBalancer" + + - it: Creates an Ingress resource + set: + ingress.enable: true + template: ingress.yaml + asserts: + - containsDocument: + kind: Ingress + apiVersion: networking.k8s.io/v1 + + - it: Should set the default prefix + set: + ingress.enable: true + template: ingress.yaml + asserts: + - equal: + path: spec.rules[0].http.paths[0].path + value: "/*" + + - it: Should update the ingress prefix + set: + ingress: + enable: true + prefix: "/foo" + template: ingress.yaml + asserts: + - equal: + path: spec.rules[0].http.paths[0].path + value: "/foo" + + - it: Should use NodePort for the service when ingress is enabled + set: + ingress.enable: true + template: service.yaml + asserts: + - equal: + path: spec.type + value: "NodePort" + + - it: Should set the ingressClassName + set: + ingress: + enable: true + ingressClassName: foo + template: ingress.yaml + asserts: + - equal: + path: spec.ingressClassName + value: "foo" diff --git a/helm-chart-sources/logstream-leader/values.yaml b/helm-chart-sources/logstream-leader/values.yaml index a80d8e3..b9da9ee 100644 --- a/helm-chart-sources/logstream-leader/values.yaml +++ b/helm-chart-sources/logstream-leader/values.yaml @@ -67,6 +67,7 @@ ingress: # - hosts: # - cribl.example.com # secretName: cribl-example-com-tls + prefix: /* ingressClassName: host: