Skip to content

Commit 9b0f4d6

Browse files
feat(ci): set up frontend as separate Deployment and integrate ingress
1 parent 77c94a3 commit 9b0f4d6

4 files changed

Lines changed: 89 additions & 19 deletions

File tree

helm-chart/templates/deployment.yaml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,6 @@ spec:
6767
port: http
6868
resources:
6969
{{- toYaml .Values.resources | nindent 12 }}
70-
- name: {{ .Chart.Name }}-frontend
71-
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag | default .Chart.AppVersion }}"
72-
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
73-
ports:
74-
- name: http
75-
containerPort: 80
76-
protocol: TCP
77-
livenessProbe:
78-
httpGet:
79-
path: /
80-
port: http
81-
readinessProbe:
82-
httpGet:
83-
path: /
84-
port: http
85-
resources:
86-
{{- toYaml .Values.resources | nindent 12 }}
8770
{{- with .Values.nodeSelector }}
8871
nodeSelector:
8972
{{- toYaml . | nindent 8 }}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "third-places.fullname" . }}-frontend
5+
labels:
6+
{{- include "third-places.labels" . | nindent 4 }}
7+
app.kubernetes.io/component: frontend
8+
spec:
9+
replicas: {{ .Values.replicaCount }}
10+
selector:
11+
matchLabels:
12+
{{- include "third-places.selectorLabels" . | nindent 6 }}
13+
app.kubernetes.io/component: frontend
14+
template:
15+
metadata:
16+
{{- with .Values.podAnnotations }}
17+
annotations:
18+
{{- toYaml . | nindent 8 }}
19+
{{- end }}
20+
labels:
21+
{{- include "third-places.selectorLabels" . | nindent 8 }}
22+
app.kubernetes.io/component: frontend
23+
spec:
24+
{{- with .Values.imagePullSecrets }}
25+
imagePullSecrets:
26+
{{- toYaml . | nindent 8 }}
27+
{{- end }}
28+
containers:
29+
- name: {{ .Chart.Name }}-frontend
30+
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag | default .Chart.AppVersion }}"
31+
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
32+
ports:
33+
- name: http
34+
containerPort: 80
35+
protocol: TCP
36+
livenessProbe:
37+
httpGet:
38+
path: /
39+
port: http
40+
readinessProbe:
41+
httpGet:
42+
path: /
43+
port: http
44+
resources:
45+
{{- toYaml .Values.resources | nindent 12 }}
46+
{{- with .Values.nodeSelector }}
47+
nodeSelector:
48+
{{- toYaml . | nindent 8 }}
49+
{{- end }}
50+
{{- with .Values.affinity }}
51+
affinity:
52+
{{- toYaml . | nindent 8 }}
53+
{{- end }}
54+
{{- with .Values.tolerations }}
55+
tolerations:
56+
{{- toYaml . | nindent 8 }}
57+
{{- end }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "third-places.fullname" . }}-frontend
5+
labels:
6+
{{- include "third-places.labels" . | nindent 4 }}
7+
app.kubernetes.io/component: frontend
8+
spec:
9+
type: ClusterIP
10+
ports:
11+
- port: 80
12+
targetPort: http
13+
protocol: TCP
14+
name: http
15+
selector:
16+
{{- include "third-places.selectorLabels" . | nindent 4 }}
17+
app.kubernetes.io/component: frontend

helm-chart/templates/ingress.yaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{{- if .Values.ingress.enabled -}}
22
{{- $fullName := include "third-places.fullname" . -}}
3-
{{- $svcPort := .Values.service.port -}}
43
apiVersion: networking.k8s.io/v1
54
kind: Ingress
65
metadata:
@@ -33,12 +32,26 @@ spec:
3332
paths:
3433
{{- range .paths }}
3534
- path: {{ . }}
35+
pathType: Prefix
36+
backend:
37+
service:
38+
name: {{ $fullName }}-frontend
39+
port:
40+
name: http
41+
- path: {{ . | trimSuffix "/" }}/api/
42+
pathType: Prefix
43+
backend:
44+
service:
45+
name: {{ $fullName }}
46+
port:
47+
name: http
48+
- path: {{ . | trimSuffix "/" }}/admin/
3649
pathType: Prefix
3750
backend:
3851
service:
3952
name: {{ $fullName }}
4053
port:
41-
number: {{ $svcPort }}
54+
name: http
4255
{{- end }}
4356
{{- end }}
4457
{{- end }}

0 commit comments

Comments
 (0)