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,72 +61,71 @@ const defaultValues = `# Default values for %s.
nameOverride: "" nameOverride: ""
fullnameOverride: "" fullnameOverride: ""
deployment: image:
image: repository: nginx
repository: nginx tag: stable
tag: stable pullPolicy: IfNotPresent
pullPolicy: IfNotPresent
replicaCount: 1
replicaCount: 1
hpa:
hpa: enabled: false
enabled: false minReplicas: 1
minReplicas: 1 maxReplicas: 10
maxReplicas: 10 targetCPUUtilizationPercentage: 80
targetCPUUtilizationPercentage: 80 targetMemoryUtilizationPercentage: 80
targetMemoryUtilizationPercentage: 80
volumes: []
volumes: [] # - name: cache-volume
# - name: cache-volume # emptyDir: {}
# emptyDir: {}
volumeMounts: []
volumeMounts: [] # - name: cache-volume
# - name: cache-volume # mountPath: /cache
# mountPath: /cache
podSecurityContext: {}
podSecurityContext: {} # fsGroup: 2000
# fsGroup: 2000
securityContext: {}
securityContext: {} # capabilities:
# capabilities: # drop:
# drop: # - ALL
# - ALL # readOnlyRootFilesystem: true
# readOnlyRootFilesystem: true # runAsNonRoot: true
# runAsNonRoot: true # runAsUser: 10001
# runAsUser: 10001
resources: {}
resources: {} # We usually recommend not to specify default resources and to leave this as a conscious
# We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little
# choice for the user. This also increases chances charts run on environments with little # resources, such as Minikube. If you do want to specify resources, uncomment the following
# resources, such as Minikube. If you do want to specify resources, uncomment the following # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# lines, adjust them as necessary, and remove the curly braces after 'resources:'. # limits:
# limits: # cpu: 100m
# cpu: 100m # memory: 128Mi
# memory: 128Mi # requests:
# requests: # cpu: 100m
# cpu: 100m # memory: 128Mi
# memory: 128Mi
env: []
env: [] # - name: FOO
# - name: FOO # value: bar
# value: bar # - name: BAZ
# - name: BAZ # value: qux
# value: qux
readinessProbe:
readinessProbe: httpGet:
httpGet: path: /
path: / port: http
port: http livenessProbe:
livenessProbe: httpGet:
httpGet: path: /
path: / port: http
port: http
nodeSelector: {}
nodeSelector: {}
tolerations: []
tolerations: []
affinity: {}
affinity: {}
service: service:
type: ClusterIP type: ClusterIP
@ -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