Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.
Closed
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
26 changes: 23 additions & 3 deletions elasticsearch/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@ spec:
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
{{- if $ingressPath }}
{{- if .Values.ingress.hosts }}
{{- range .Values.ingress.hosts }}
{{- if $ingressPath }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $fullName }}
servicePort: {{ $httpPort }}
{{- else }}
{{- else }}
- host: {{ .host }}
http:
paths:
Expand All @@ -49,6 +50,25 @@ spec:
serviceName: {{ $fullName }}
servicePort: {{ .servicePort | default $httpPort }}
{{- end }}
{{- end }}
{{- end }}
{{- else }}
{{- if $ingressPath }}
- http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $fullName }}
servicePort: {{ $httpPort }}
{{- else }}
- http:
paths:
{{- range .paths }}
- path: {{ .path }}
backend:
serviceName: {{ $fullName }}
servicePort: {{ .servicePort | default $httpPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
16 changes: 16 additions & 0 deletions elasticsearch/tests/elasticsearch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,22 @@ def test_adding_an_ingress_rule():
assert i["rules"][2]["http"]["paths"][0]["backend"]["servicePort"] == 9999


def test_adding_ingress_without_hosts():
config = """
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: nginx
path: /
hosts:
"""

r = helm_template(config)
assert uname in r["ingress"]
i = r["ingress"][uname]["spec"]
assert i["rules"][0]["http"]["paths"][0]["path"] == "/"


def test_adding_a_deprecated_ingress_rule():
config = """
ingress:
Expand Down