From 4e8af1ec82828a5aae79f0fbcea7098be38af323 Mon Sep 17 00:00:00 2001 From: Naseem Date: Wed, 4 Dec 2019 02:15:33 -0500 Subject: [PATCH] feat: add pod and service annotations + fix: use with for consistency Signed-off-by: Naseem --- pkg/chartutil/create.go | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index c67cde04f..fc7a5c360 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -119,6 +119,9 @@ securityContext: {} # runAsUser: 1000 service: + annotations: {} + # prometheus.io/scrape: "true" + # prometheus.io/port: "9090" type: ClusterIP port: 80 @@ -147,6 +150,8 @@ resources: {} # cpu: 100m # memory: 128Mi +podAnnotations: {} + nodeSelector: {} tolerations: [] @@ -191,10 +196,10 @@ metadata: name: {{ $fullName }} labels: {{- include ".labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} +{{- with .Values.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} - {{- end }} +{{- end }} spec: {{- if .Values.ingress.tls }} tls: @@ -236,18 +241,26 @@ spec: metadata: labels: {{- include ".selectorLabels" . | nindent 8 }} + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include ".serviceAccountName" . }} + {{- with .Values.podSecurityContext }} securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- toYaml . | nindent 8 }} + {{- end }} containers: - name: {{ .Chart.Name }} + {{- with .Values.securityContext }} securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} + {{- toYaml . | nindent 12 }} + {{- end }} image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: @@ -262,12 +275,14 @@ spec: httpGet: path: / port: http + {{- with .Values.resources }} resources: - {{- toYaml .Values.resources | nindent 12 }} - {{- with .Values.nodeSelector }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} - {{- end }} + {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }}