Skip to content

Commit ba180a3

Browse files
dnskrgjenkins8
authored andcommitted
ref(create): don't render empty resource fields
Signed-off-by: Denis Krivenko <[email protected]> Signed-off-by: dnskr <[email protected]>
1 parent 0a588c2 commit ba180a3

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

pkg/chartutil/create.go

+15-5
Original file line numberDiff line numberDiff line change
@@ -327,24 +327,34 @@ spec:
327327
{{- toYaml . | nindent 8 }}
328328
{{- end }}
329329
serviceAccountName: {{ include "<CHARTNAME>.serviceAccountName" . }}
330+
{{- with .Values.podSecurityContext }}
330331
securityContext:
331-
{{- toYaml .Values.podSecurityContext | nindent 8 }}
332+
{{- toYaml . | nindent 8 }}
333+
{{- end }}
332334
containers:
333335
- name: {{ .Chart.Name }}
336+
{{- with .Values.securityContext }}
334337
securityContext:
335-
{{- toYaml .Values.securityContext | nindent 12 }}
338+
{{- toYaml . | nindent 12 }}
339+
{{- end }}
336340
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
337341
imagePullPolicy: {{ .Values.image.pullPolicy }}
338342
ports:
339343
- name: http
340344
containerPort: {{ .Values.service.port }}
341345
protocol: TCP
346+
{{- with .Values.livenessProbe }}
342347
livenessProbe:
343-
{{- toYaml .Values.livenessProbe | nindent 12 }}
348+
{{- toYaml . | nindent 12 }}
349+
{{- end }}
350+
{{- with .Values.readinessProbe }}
344351
readinessProbe:
345-
{{- toYaml .Values.readinessProbe | nindent 12 }}
352+
{{- toYaml . | nindent 12 }}
353+
{{- end }}
354+
{{- with .Values.resources }}
346355
resources:
347-
{{- toYaml .Values.resources | nindent 12 }}
356+
{{- toYaml . | nindent 12 }}
357+
{{- end }}
348358
{{- with .Values.volumeMounts }}
349359
volumeMounts:
350360
{{- toYaml . | nindent 12 }}

0 commit comments

Comments
 (0)