Skip to content

Commit 65377e0

Browse files
authored
feat: configurable ingress backend (#124)
1 parent 03fd935 commit 65377e0

File tree

6 files changed

+62
-37
lines changed

6 files changed

+62
-37
lines changed

charts/api7/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.14.5
18+
version: 0.15.0
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

charts/api7/README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# api7ee3
22

3-
![Version: 0.14.5](https://img.shields.io/badge/Version-0.14.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.0.0](https://img.shields.io/badge/AppVersion-3.0.0-informational?style=flat-square)
3+
![Version: 0.15.0](https://img.shields.io/badge/Version-0.15.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.0.0](https://img.shields.io/badge/AppVersion-3.0.0-informational?style=flat-square)
44

55
A Helm chart for Kubernetes
66

@@ -67,19 +67,18 @@ A Helm chart for Kubernetes
6767
| developer_portal.image.pullPolicy | string | `"IfNotPresent"` | |
6868
| developer_portal.image.repository | string | `"api7/api7-developer-portal"` | |
6969
| developer_portal.image.tag | string | `"v0.0.5"` | |
70-
| developer_portal.ingress.annotations | object | `{}` | |
71-
| developer_portal.ingress.className | string | `""` | |
72-
| developer_portal.ingress.enabled | bool | `false` | |
73-
| developer_portal.ingress.hosts[0].host | string | `"developer-portal.local"` | |
74-
| developer_portal.ingress.hosts[0].paths[0].path | string | `"/"` | |
75-
| developer_portal.ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | |
76-
| developer_portal.ingress.tls | list | `[]` | |
77-
| developer_portal.port | int | `4321` | |
7870
| developer_portal.replicaCount | int | `1` | |
7971
| developer_portal_configuration.enable | bool | `true` | |
8072
| developer_portal_configuration.server.listen.host | string | `"0.0.0.0"` | |
8173
| developer_portal_configuration.server.listen.port | int | `4321` | |
8274
| developer_portal_configuration.server.listen.tls.enabled | bool | `true` | |
75+
| developer_portal_service.ingress.annotations | object | `{}` | |
76+
| developer_portal_service.ingress.className | string | `""` | |
77+
| developer_portal_service.ingress.enabled | bool | `false` | |
78+
| developer_portal_service.ingress.hosts[0].host | string | `"developer-portal.local"` | |
79+
| developer_portal_service.ingress.hosts[0].paths[0].path | string | `"/"` | |
80+
| developer_portal_service.ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | |
81+
| developer_portal_service.ingress.tls | list | `[]` | |
8382
| developer_portal_service.port | int | `4321` | |
8483
| developer_portal_service.type | string | `"ClusterIP"` | |
8584
| dp_manager.extraEnvVars | list | `[]` | |

charts/api7/templates/dashboard-ingress.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ spec:
5252
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
5353
pathType: {{ .pathType }}
5454
{{- end }}
55+
{{- if .backend }}
56+
backend: {{ toYaml .backend | nindent 14 }}
57+
{{- else }}
5558
backend:
5659
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
5760
service:
@@ -62,6 +65,7 @@ spec:
6265
serviceName: {{ $fullName }}
6366
servicePort: {{ $svcPort }}
6467
{{- end }}
68+
{{- end}}
6569
{{- end }}
6670
{{- end }}
6771
{{- end }}

charts/api7/templates/developer-portal-ingress.yaml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
{{- if .Values.developer_portal.ingress.enabled }}
1+
{{- if .Values.developer_portal_service.ingress.enabled }}
22
{{- $fullName := printf "%s-developer-portal" (include "api7ee3.fullname" .) -}}
3-
{{- $svcPort := .Values.developer_portal.port -}}
4-
{{- if and .Values.developer_portal.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
5-
{{- if not (hasKey .Values.developer_portal.ingress.annotations "kubernetes.io/ingress.class") }}
6-
{{- $_ := set .Values.developer_portal.ingress.annotations "kubernetes.io/ingress.class" .Values.developer_portal.ingress.className}}
3+
{{- $svcPort := .Values.developer_portal_service.port -}}
4+
{{- if and .Values.developer_portal_service.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
5+
{{- if not (hasKey .Values.developer_portal_service.ingress.annotations "kubernetes.io/ingress.class") }}
6+
{{- $_ := set .Values.developer_portal_service.ingress.annotations "kubernetes.io/ingress.class" .Values.developer_portal_service.ingress.className}}
77
{{- end }}
88
{{- end }}
99
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
@@ -18,17 +18,17 @@ metadata:
1818
name: {{ $fullName }}
1919
labels:
2020
{{- include "api7ee3.labels" . | nindent 4 }}
21-
{{- with .Values.developer_portal.ingress.annotations }}
21+
{{- with .Values.developer_portal_service.ingress.annotations }}
2222
annotations:
2323
{{- toYaml . | nindent 4 }}
2424
{{- end }}
2525
spec:
26-
{{- if and .Values.developer_portal.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
27-
ingressClassName: {{ .Values.developer_portal.ingress.className }}
26+
{{- if and .Values.developer_portal_service.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
27+
ingressClassName: {{ .Values.developer_portal_service.ingress.className }}
2828
{{- end }}
29-
{{- if .Values.developer_portal.ingress.tls }}
29+
{{- if .Values.developer_portal_service.ingress.tls }}
3030
tls:
31-
{{- range .Values.developer_portal.ingress.tls }}
31+
{{- range .Values.developer_portal_service.ingress.tls }}
3232
- hosts:
3333
{{- range .hosts }}
3434
- {{ . | quote }}
@@ -37,7 +37,7 @@ spec:
3737
{{- end }}
3838
{{- end }}
3939
rules:
40-
{{- range .Values.developer_portal.ingress.hosts }}
40+
{{- range .Values.developer_portal_service.ingress.hosts }}
4141
- host: {{ .host | quote }}
4242
http:
4343
paths:
@@ -46,6 +46,9 @@ spec:
4646
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
4747
pathType: {{ .pathType }}
4848
{{- end }}
49+
{{- if .backend }}
50+
backend: {{ toYaml .backend | nindent 14 }}
51+
{{- else }}
4952
backend:
5053
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
5154
service:
@@ -56,6 +59,7 @@ spec:
5659
serviceName: {{ $fullName }}
5760
servicePort: {{ $svcPort }}
5861
{{- end }}
62+
{{- end}}
5963
{{- end }}
6064
{{- end }}
6165
{{- end }}

charts/api7/templates/dp-manager-ingress.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ spec:
4646
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
4747
pathType: {{ .pathType }}
4848
{{- end }}
49+
{{- if .backend }}
50+
backend: {{ toYaml .backend | nindent 14 }}
51+
{{- else }}
4952
backend:
5053
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
5154
service:
@@ -56,6 +59,7 @@ spec:
5659
serviceName: {{ $fullName }}
5760
servicePort: {{ $svcPort }}
5861
{{- end }}
62+
{{- end}}
5963
{{- end }}
6064
{{- end }}
6165
{{- end }}

charts/api7/values.yaml

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,6 @@ developer_portal:
3030
# Overrides the image tag whose default is the chart appVersion.
3131
tag: "v0.0.5"
3232
extraEnvVars: []
33-
port: 4321
34-
ingress:
35-
enabled: false
36-
className: ""
37-
annotations: {}
38-
# kubernetes.io/ingress.class: nginx
39-
# kubernetes.io/tls-acme: "true"
40-
hosts:
41-
- host: developer-portal.local
42-
paths:
43-
- path: /
44-
pathType: ImplementationSpecific
45-
tls: []
46-
# - secretName: developer-portal-tls
47-
# hosts:
48-
# - developer-portal.local
4933

5034

5135
imagePullSecret: ""
@@ -89,6 +73,11 @@ dashboard_service:
8973
paths:
9074
- path: /
9175
pathType: ImplementationSpecific
76+
# backend:
77+
# service:
78+
# name: api7ee3-dashboard
79+
# port:
80+
# number: 7943
9281
tls: []
9382
# - secretName: dashboard-tls
9483
# hosts:
@@ -109,6 +98,11 @@ dp_manager_service:
10998
paths:
11099
- path: /
111100
pathType: ImplementationSpecific
101+
# backend:
102+
# service:
103+
# name: api7ee3-dp-manager
104+
# port:
105+
# number: 7943
112106
tls: []
113107
# - secretName: dp-manager-tls
114108
# hosts:
@@ -117,6 +111,26 @@ dp_manager_service:
117111
developer_portal_service:
118112
type: ClusterIP
119113
port: 4321
114+
ingress:
115+
enabled: false
116+
className: ""
117+
annotations: {}
118+
# kubernetes.io/ingress.class: nginx
119+
# kubernetes.io/tls-acme: "true"
120+
hosts:
121+
- host: developer-portal.local
122+
paths:
123+
- path: /
124+
pathType: ImplementationSpecific
125+
# backend:
126+
# service:
127+
# name: api7ee3-developer-portal
128+
# port:
129+
# number: 7943
130+
tls: []
131+
# - secretName: developer-portal-tls
132+
# hosts:
133+
# - developer-portal.local
120134

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

0 commit comments

Comments
 (0)