Skip to content

Commit 3508dc1

Browse files
authored
feat: add ingress for developer portal (#118)
1 parent 658cd20 commit 3508dc1

File tree

4 files changed

+85
-1
lines changed

4 files changed

+85
-1
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.1
18+
version: 0.14.2
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/templates/developer-portal-deploy.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ spec:
6060
- name: API_URL
6161
value: 'https://{{ include "api7ee3.fullname" . }}-dashboard:{{ .Values.dashboard_service.tlsPort }}'
6262
{{- end }}
63+
{{- if not .Values.developer_portal_configuration.server.listen.tls.enabled }}
64+
- name: DISABLE_HTTPS
65+
value: "1"
66+
{{- end}}
6367
{{- if .Values.developer_portal.extraEnvVars }}
6468
{{- include "api7ee3.tplvalues.render" (dict "value" .Values.developer_portal.extraEnvVars "context" $) | nindent 12 }}
6569
{{- end }}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{{- if .Values.developer_portal.ingress.enabled }}
2+
{{- $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}}
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 }}
19+
labels:
20+
{{- include "api7ee3.labels" . | nindent 4 }}
21+
{{- with .Values.developer_portal.ingress.annotations }}
22+
annotations:
23+
{{- toYaml . | nindent 4 }}
24+
{{- end }}
25+
spec:
26+
{{- if and .Values.developer_portal.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
27+
ingressClassName: {{ .Values.developer_portal.ingress.className }}
28+
{{- end }}
29+
{{- if .Values.developer_portal.ingress.tls }}
30+
tls:
31+
{{- range .Values.developer_portal.ingress.tls }}
32+
- hosts:
33+
{{- range .hosts }}
34+
- {{ . | quote }}
35+
{{- end }}
36+
secretName: {{ .secretName }}
37+
{{- end }}
38+
{{- end }}
39+
rules:
40+
{{- range .Values.developer_portal.ingress.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/api7/values.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,23 @@ developer_portal:
3030
# Overrides the image tag whose default is the chart appVersion.
3131
tag: "v0.0.3"
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
49+
3350

3451
imagePullSecret: ""
3552
nameOverride: ""
@@ -252,3 +269,5 @@ developer_portal_configuration:
252269
listen:
253270
host: "0.0.0.0"
254271
port: 4321
272+
tls:
273+
enabled: true

0 commit comments

Comments
 (0)