Skip to content

Commit 82eebdd

Browse files
committed
Refactor Helm templates for deployment and service; update values.yaml to ensure correct naming and target ports
1 parent 38a0825 commit 82eebdd

File tree

3 files changed

+11
-71
lines changed

3 files changed

+11
-71
lines changed

helm/templates/deployment.yaml

Lines changed: 6 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,20 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4-
name: {{ include "helm.fullname" . }}
5-
labels:
6-
{{- include "helm.labels" . | nindent 4 }}
4+
name: {{ .Release.Name }}
75
spec:
8-
{{- if not .Values.autoscaling.enabled }}
96
replicas: {{ .Values.replicaCount }}
10-
{{- end }}
117
selector:
128
matchLabels:
13-
{{- include "helm.selectorLabels" . | nindent 6 }}
9+
app: {{ .Release.Name }}
1410
template:
1511
metadata:
16-
{{- with .Values.podAnnotations }}
17-
annotations:
18-
{{- toYaml . | nindent 8 }}
19-
{{- end }}
2012
labels:
21-
{{- include "helm.labels" . | nindent 8 }}
22-
{{- with .Values.podLabels }}
23-
{{- toYaml . | nindent 8 }}
24-
{{- end }}
13+
app: {{ .Release.Name }}
2514
spec:
26-
{{- with .Values.imagePullSecrets }}
27-
imagePullSecrets:
28-
{{- toYaml . | nindent 8 }}
29-
{{- end }}
30-
serviceAccountName: {{ include "helm.serviceAccountName" . }}
31-
{{- with .Values.podSecurityContext }}
32-
securityContext:
33-
{{- toYaml . | nindent 8 }}
34-
{{- end }}
3515
containers:
36-
- name: {{ .Chart.Name }}
37-
{{- with .Values.securityContext }}
38-
securityContext:
39-
{{- toYaml . | nindent 12 }}
40-
{{- end }}
41-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
16+
- name: {{ .Release.Name }}
17+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
4218
imagePullPolicy: {{ .Values.image.pullPolicy }}
4319
ports:
44-
- name: http
45-
containerPort: {{ .Values.service.port }}
46-
protocol: TCP
47-
{{- with .Values.livenessProbe }}
48-
livenessProbe:
49-
{{- toYaml . | nindent 12 }}
50-
{{- end }}
51-
{{- with .Values.readinessProbe }}
52-
readinessProbe:
53-
{{- toYaml . | nindent 12 }}
54-
{{- end }}
55-
{{- with .Values.resources }}
56-
resources:
57-
{{- toYaml . | nindent 12 }}
58-
{{- end }}
59-
{{- with .Values.volumeMounts }}
60-
volumeMounts:
61-
{{- toYaml . | nindent 12 }}
62-
{{- end }}
63-
{{- with .Values.volumes }}
64-
volumes:
65-
{{- toYaml . | nindent 8 }}
66-
{{- end }}
67-
{{- with .Values.nodeSelector }}
68-
nodeSelector:
69-
{{- toYaml . | nindent 8 }}
70-
{{- end }}
71-
{{- with .Values.affinity }}
72-
affinity:
73-
{{- toYaml . | nindent 8 }}
74-
{{- end }}
75-
{{- with .Values.tolerations }}
76-
tolerations:
77-
{{- toYaml . | nindent 8 }}
78-
{{- end }}
20+
- containerPort: {{ .Values.service.targetPort }}

helm/templates/service.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
apiVersion: v1
22
kind: Service
33
metadata:
4-
name: {{ include "helm.fullname" . }}
5-
labels:
6-
{{- include "helm.labels" . | nindent 4 }}
4+
name: {{ .Release.Name }}-svc
75
spec:
86
type: {{ .Values.service.type }}
97
ports:
108
- port: {{ .Values.service.port }}
11-
targetPort: http
9+
targetPort: {{ .Values.service.targetPort }}
1210
protocol: TCP
13-
name: http
1411
selector:
15-
{{- include "helm.selectorLabels" . | nindent 4 }}
12+
app: {{ .Release.Name }}

helm/values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ image:
77

88
service:
99
type: LoadBalancer
10-
port: 443
10+
port: 443
11+
targetPort: 3000

0 commit comments

Comments
 (0)