Prefer include over template

Signed-off-by: Naseem Ullah <naseemkullah@gmail.com>
pull/5110/head
Naseem Ullah 7 years ago
parent 4fdfcb80bd
commit 85f6cf9641

@ -61,7 +61,6 @@ const defaultValues = `# Default values for %s.
nameOverride: "" nameOverride: ""
fullnameOverride: "" fullnameOverride: ""
deployment:
image: image:
repository: nginx repository: nginx
tag: stable tag: stable
@ -222,7 +221,7 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
spec: spec:
replicas: {{ .Values.deployment.replicaCount }} replicas: {{ .Values.replicaCount }}
selector: selector:
matchLabels: matchLabels:
app.kubernetes.io/name: {{ include "<CHARTNAME>.name" . }} app.kubernetes.io/name: {{ include "<CHARTNAME>.name" . }}
@ -233,48 +232,46 @@ spec:
app.kubernetes.io/name: {{ include "<CHARTNAME>.name" . }} app.kubernetes.io/name: {{ include "<CHARTNAME>.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
spec: spec:
{{- with .Values.deployment.podSecurityContext }} {{- with .Values.podSecurityContext }}
securityContext: securityContext:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.deployment.volumes }} {{- with .Values.volumes }}
volumes: volumes:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
{{- with .Values.deployment }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
image: "{{ .image.repository }}:{{ .image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }}
imagePullPolicy: {{ .image.pullPolicy }}
ports: ports:
- name: http - name: http
containerPort: 80 containerPort: 80
protocol: TCP protocol: TCP
livenessProbe: livenessProbe:
httpGet: httpGet:
path: {{ .livenessProbe.httpGet.path }} path: {{ .Values.livenessProbe.httpGet.path }}
port: {{ .livenessProbe.httpGet.port }} port: {{ .Values.livenessProbe.httpGet.port }}
readinessProbe: readinessProbe:
httpGet: httpGet:
path: {{ .readinessProbe.httpGet.path }} path: {{ .Values.readinessProbe.httpGet.path }}
port: {{ .readinessProbe.httpGet.port }} port: {{ .Values.readinessProbe.httpGet.port }}
resources: resources:
{{- toYaml .resources | nindent 12 }} {{- toYaml .Values.resources | nindent 12 }}
env: env:
{{- toYaml .env | nindent 12 }} {{- toYaml .Values.env | nindent 12 }}
volumeMounts: volumeMounts:
{{- toYaml .volumeMounts | nindent 12 }} {{- toYaml .Values.volumeMounts | nindent 12 }}
securityContext: securityContext:
{{- toYaml .securityContext | nindent 12 }} {{- toYaml .Values.securityContext | nindent 12 }}
nodeSelector: nodeSelector:
{{- toYaml .nodeSelector | nindent 8 }} {{- toYaml .Values.nodeSelector | nindent 8 }}
affinity: affinity:
{{- toYaml .affinity | nindent 8 }} {{- toYaml .Values.affinity | nindent 8 }}
tolerations: tolerations:
{{- toYaml .tolerations | nindent 8 }} {{- toYaml .Values.tolerations | nindent 8 }}
{{- end }}
` `
const defaultHorizontalPodAutoscaler = `{{- if .Values.deployment.hpa.enabled }} const defaultHorizontalPodAutoscaler = `{{- if .Values.hpa.enabled }}
apiVersion: autoscaling/v2beta2 apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler kind: HorizontalPodAutoscaler
metadata: metadata:
@ -283,13 +280,13 @@ metadata:
helm.sh/chart: {{ include "<CHARTNAME>.chart" . }} helm.sh/chart: {{ include "<CHARTNAME>.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
name: {{ template "<CHARTNAME>.fullname" . }} name: {{ include "<CHARTNAME>.fullname" . }}
spec: spec:
scaleTargetRef: scaleTargetRef:
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
name: {{ template "<CHARTNAME>.fullname" . }} name: {{ include "<CHARTNAME>.fullname" . }}
{{- with .Values.deployment.hpa }} {{- with .Values.hpa }}
minReplicas: {{ .minReplicas }} minReplicas: {{ .minReplicas }}
maxReplicas: {{ .maxReplicas }} maxReplicas: {{ .maxReplicas }}
metrics: metrics:

Loading…
Cancel
Save