Skip to content

Commit fc2a4d1

Browse files
committed
split ingress for proxy and web
Signed-off-by: Andreas Bräu <[email protected]>
1 parent f1ec1e7 commit fc2a4d1

File tree

4 files changed

+104
-26
lines changed

4 files changed

+104
-26
lines changed

charts/ohcloud/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ dependencies:
1212
repository: oci://registry-1.docker.io/bitnamicharts
1313
condition: mongodb.enabled
1414

15-
version: 1.0.12
15+
version: 1.0.13
1616
appVersion: "9a2324b"
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{{- if .Values.openhabcloudApp.ingress.proxy.enabled -}}
2+
{{- $fullName := include "ohcloud.fullname" . -}}
3+
{{- $svcPort := .Values.openhabcloudApp.service.port -}}
4+
{{- if and .Values.openhabcloudApp.ingress.proxy.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
5+
{{- if not (hasKey .Values.openhabcloudApp.ingress.proxy.annotations "kubernetes.io/ingress.class") }}
6+
{{- $_ := set .Values.openhabcloudApp.ingress.proxy.annotations "kubernetes.io/ingress.class" .Values.openhabcloudApp.ingress.proxy.className}}
7+
{{- end }}
8+
{{- end }}
9+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
10+
apiVersion: networking.k8s.io/v1
11+
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
12+
apiVersion: networking.k8s.io/v1beta1
13+
{{- else -}}
14+
apiVersion: extensions/v1beta1
15+
{{- end }}
16+
kind: Ingress
17+
metadata:
18+
name: {{ $fullName }}-proxy
19+
labels:
20+
{{- include "ohcloud.labels" . | nindent 4 }}
21+
{{- with .Values.openhabcloudApp.ingress.proxy.annotations }}
22+
annotations:
23+
{{- toYaml . | nindent 4 }}
24+
{{- end }}
25+
spec:
26+
{{- if and .Values.openhabcloudApp.ingress.proxy.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
27+
ingressClassName: {{ .Values.openhabcloudApp.ingress.proxy.className }}
28+
{{- end }}
29+
{{- if .Values.openhabcloudApp.ingress.proxy.tls }}
30+
tls:
31+
{{- range .Values.openhabcloudApp.ingress.proxy.tls }}
32+
- hosts:
33+
{{- range .hosts }}
34+
- {{ . | quote }}
35+
{{- end }}
36+
secretName: {{ .secretName }}
37+
{{- end }}
38+
{{- end }}
39+
rules:
40+
{{- range .Values.openhabcloudApp.ingress.proxy.hosts }}
41+
- host: {{ .host | quote }}
42+
http:
43+
paths:
44+
{{- range .paths }}
45+
- path: {{ .path }}
46+
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
47+
pathType: {{ .pathType }}
48+
{{- end }}
49+
backend:
50+
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
51+
service:
52+
name: {{ $fullName }}
53+
port:
54+
number: {{ $svcPort }}
55+
{{- else }}
56+
serviceName: {{ $fullName }}
57+
servicePort: {{ $svcPort }}
58+
{{- end }}
59+
{{- end }}
60+
{{- end }}
61+
{{- end }}

charts/ohcloud/templates/ohcloudapp-ingress.yaml renamed to charts/ohcloud/templates/ohcloudapp-ingress-web.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
{{- if .Values.openhabcloudApp.ingress.enabled -}}
1+
{{- if .Values.openhabcloudApp.ingress.web.enabled -}}
22
{{- $fullName := include "ohcloud.fullname" . -}}
33
{{- $svcPort := .Values.openhabcloudApp.service.port -}}
4-
{{- if and .Values.openhabcloudApp.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
5-
{{- if not (hasKey .Values.openhabcloudApp.ingress.annotations "kubernetes.io/ingress.class") }}
6-
{{- $_ := set .Values.openhabcloudApp.ingress.annotations "kubernetes.io/ingress.class" .Values.openhabcloudApp.ingress.className}}
4+
{{- if and .Values.openhabcloudApp.ingress.web.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
5+
{{- if not (hasKey .Values.openhabcloudApp.ingress.web.annotations "kubernetes.io/ingress.class") }}
6+
{{- $_ := set .Values.openhabcloudApp.ingress.web.annotations "kubernetes.io/ingress.class" .Values.openhabcloudApp.ingress.web.className}}
77
{{- end }}
88
{{- end }}
99
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
@@ -15,20 +15,20 @@ apiVersion: extensions/v1beta1
1515
{{- end }}
1616
kind: Ingress
1717
metadata:
18-
name: {{ $fullName }}
18+
name: {{ $fullName }}-web
1919
labels:
2020
{{- include "ohcloud.labels" . | nindent 4 }}
21-
{{- with .Values.openhabcloudApp.ingress.annotations }}
21+
{{- with .Values.openhabcloudApp.ingress.web.annotations }}
2222
annotations:
2323
{{- toYaml . | nindent 4 }}
2424
{{- end }}
2525
spec:
26-
{{- if and .Values.openhabcloudApp.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
27-
ingressClassName: {{ .Values.openhabcloudApp.ingress.className }}
26+
{{- if and .Values.openhabcloudApp.ingress.web.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
27+
ingressClassName: {{ .Values.openhabcloudApp.ingress.web.className }}
2828
{{- end }}
29-
{{- if .Values.openhabcloudApp.ingress.tls }}
29+
{{- if .Values.openhabcloudApp.ingress.web.tls }}
3030
tls:
31-
{{- range .Values.openhabcloudApp.ingress.tls }}
31+
{{- range .Values.openhabcloudApp.ingress.web.tls }}
3232
- hosts:
3333
{{- range .hosts }}
3434
- {{ . | quote }}
@@ -37,7 +37,7 @@ spec:
3737
{{- end }}
3838
{{- end }}
3939
rules:
40-
{{- range .Values.openhabcloudApp.ingress.hosts }}
40+
{{- range .Values.openhabcloudApp.ingress.web.hosts }}
4141
- host: {{ .host | quote }}
4242
http:
4343
paths:

charts/ohcloud/values.yaml

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,37 @@ openhabcloudApp:
6262
value: ""
6363

6464
ingress:
65-
enabled: false
66-
className: ""
67-
annotations: {}
68-
# kubernetes.io/ingress.class: nginx
69-
# kubernetes.io/tls-acme: "true"
70-
hosts:
71-
- host: chart-example.local
72-
paths:
73-
- path: /
74-
pathType: ImplementationSpecific
75-
tls: []
76-
# - secretName: chart-example-tls
77-
# hosts:
78-
# - chart-example.local
65+
web:
66+
enabled: false
67+
className: ""
68+
annotations: {}
69+
# kubernetes.io/ingress.class: nginx
70+
# kubernetes.io/tls-acme: "true"
71+
hosts:
72+
- host: chart-example.local
73+
paths:
74+
- path: /
75+
pathType: ImplementationSpecific
76+
tls: []
77+
# - secretName: chart-example-tls
78+
# hosts:
79+
# - chart-example.local
80+
81+
proxy:
82+
enabled: false
83+
className: ""
84+
annotations: {}
85+
# kubernetes.io/ingress.class: nginx
86+
# kubernetes.io/tls-acme: "true"
87+
hosts:
88+
- host: chart-example.local
89+
paths:
90+
- path: /
91+
pathType: ImplementationSpecific
92+
tls: []
93+
# - secretName: chart-example-tls
94+
# hosts:
95+
# - chart-example.local
7996

8097
resources: {}
8198
# We usually recommend not to specify default resources and to leave this as a conscious

0 commit comments

Comments
 (0)