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 fe61836..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: