style: remove most right whitespace chomps except those directly following a template definition

This commit is contained in:
Chi-En Wu
2020-04-27 10:27:26 +08:00
parent dd6822704c
commit a0bfeb4cf6
17 changed files with 195 additions and 195 deletions

View File

@ -62,7 +62,7 @@ The resource kind templates are designed to make it much faster for you to defin
To make use of these templates you must define a template that will extend the base template (though it can be empty). The name of this template is then passed to the base template, for example:
```yaml
{{- include "common.service" (list . .Values.service "mychart.service") -}}
{{- include "common.service" (list . .Values.service "mychart.service") }}
{{- define "mychart.service" -}}
## Define overrides for your Service resource here, e.g.
# metadata:
@ -74,7 +74,7 @@ To make use of these templates you must define a template that will extend the b
# targetPort: http
# protocol: TCP
# name: http
{{- end -}}
{{- end }}
```
Note that the [`common.service`](#commonservice) template defines three parameters:
@ -103,7 +103,7 @@ It creates an empty `ConfigMap` resource that you can override with your configu
Example use:
```yaml
{{- include "common.configMap" (list . "mychart.configMap") -}}
{{- include "common.configMap" (list . "mychart.configMap") }}
{{- define "mychart.configMap" -}}
data:
zeus: cat
@ -111,7 +111,7 @@ data:
julius: cat
one: |-
{{ .Files.Get "file1.txt" }}
{{- end -}}
{{- end }}
```
Output:
@ -165,12 +165,12 @@ Underneath the hood, it invokes [`common.pod.template`](#commonpodtemplate) temp
Example use:
```yaml
{{- include "common.cronJob" (list . .Values.cronJob .Values .Values.serviceAccount) -}}
{{- include "common.cronJob" (list . .Values.cronJob .Values .Values.serviceAccount) }}
## The following is the same as above:
# {{- include "common.cronJob" (list . .Values.cronJob .Values .Values.serviceAccount "mychart.cronJob") -}}
# {{- include "common.cronJob" (list . .Values.cronJob .Values .Values.serviceAccount "mychart.cronJob") }}
# {{- define "mychart.cronJob" -}}
# {{- end -}}
# {{- end }}
```
@ -203,12 +203,12 @@ Underneath the hood, it invokes [`common.pod.template`](#commonpodtemplate) temp
Example use:
```yaml
{{- include "common.deployment" (list . .Values .Values.autoscaling .Values.serviceAccount) -}}
{{- include "common.deployment" (list . .Values .Values.autoscaling .Values.serviceAccount) }}
## The following is the same as above:
# {{- include "common.deployment" (list . .Values .Values.autoscaling .Values.serviceAccount "mychart.deployment") -}}
# {{- include "common.deployment" (list . .Values .Values.autoscaling .Values.serviceAccount "mychart.deployment") }}
# {{- define "mychart.deployment" -}}
# {{- end -}}
# {{- end }}
```
@ -239,12 +239,12 @@ autoscaling:
Example use:
```yaml
{{- include "common.hpa" (list . .Values.autoscaling) -}}
{{- include "common.hpa" (list . .Values.autoscaling) }}
## The following is the same as above:
# {{- include "common.hpa" (list . .Values.autoscaling "mychart.hpa") -}}
# {{- include "common.hpa" (list . .Values.autoscaling "mychart.hpa") }}
# {{- define "mychart.hpa" -}}
# {{- end -}}
# {{- end }}
```
Output:
@ -317,12 +317,12 @@ service:
Example use:
```yaml
{{- include "common.ingress" (list . .Values.ingress .Values.service) -}}
{{- include "common.ingress" (list . .Values.ingress .Values.service) }}
## The following is the same as above:
# {{- include "common.ingress" (list . .Values.ingress .Values.service "mychart.ingress") -}}
# {{- include "common.ingress" (list . .Values.ingress .Values.service "mychart.ingress") }}
# {{- define "mychart.ingress" -}}
# {{- end -}}
# {{- end }}
```
Output:
@ -384,12 +384,12 @@ podDisruptionBudget:
Example use:
```yaml
{{- include "common.pdb" (list . .Values.podDisruptionBudget .Values .Values.autoscaling) -}}
{{- include "common.pdb" (list . .Values.podDisruptionBudget .Values .Values.autoscaling) }}
## The following is the same as above:
# {{- include "common.pdb" (list . .Values.podDisruptionBudget .Values .Values.autoscaling "mychart.pdb") -}}
# {{- include "common.pdb" (list . .Values.podDisruptionBudget .Values .Values.autoscaling "mychart.pdb") }}
# {{- define "mychart.pdb" -}}
# {{- end -}}
# {{- end }}
```
Output:
@ -427,7 +427,7 @@ It creates an empty `Secret` resource that you can override with your secrets.
Example use:
```yaml
{{- include "common.secret" (list . "mychart.secret") -}}
{{- include "common.secret" (list . "mychart.secret") }}
{{- define "mychart.secret" -}}
data:
zeus: {{ print "cat" | b64enc }}
@ -435,7 +435,7 @@ data:
julius: {{ print "cat" | b64enc }}
one: |-
{{ .Files.Get "file1.txt" | b64enc }}
{{- end -}}
{{- end }}
```
Output:
@ -478,9 +478,9 @@ It creates a basic `Service` resource with the following defaults:
Example template:
```yaml
{{- include "common.service" (list . .Values.service "mychart.mail.service") -}}
{{- include "common.service" (list . .Values.service "mychart.mail.service") }}
{{- define "mychart.mail.service" -}}
{{- $top := first . -}}
{{- $top := first . }}
metadata:
name: {{ include "common.fullname" $top }}-mail # overrides the default name to add a suffix
labels: # appended to the labels section
@ -497,9 +497,9 @@ spec:
protocol: mail
{{- end }}
---
{{ include "common.service" (list . .Values.service "mychart.web.service") -}}
{{ include "common.service" (list . .Values.service "mychart.web.service") }}
{{- define "mychart.web.service" -}}
{{- $top := first . -}}
{{- $top := first . }}
metadata:
name: {{ include "common.fullname" $top }}-www # overrides the default name to add a suffix
labels: # appended to the labels section
@ -509,7 +509,7 @@ spec:
- name: www
port: 80
targetPort: 8080
{{- end -}}
{{- end }}
```
The above template defines _two_ services: a web service and a mail service.
@ -593,12 +593,12 @@ serviceAccount:
Example use:
```yaml
{{- include "common.serviceAccount" (list . .Values.serviceAccount) -}}
{{- include "common.serviceAccount" (list . .Values.serviceAccount) }}
## The following is the same as above:
# {{- include "common.serviceAccount" (list . .Values.serviceAccount "mychart.serviceAccount") -}}
# {{- include "common.serviceAccount" (list . .Values.serviceAccount "mychart.serviceAccount") }}
# {{- define "mychart.serviceAccount" -}}
# {{- end -}}
# {{- end }}
```
Output:
@ -650,12 +650,12 @@ serviceMonitor:
Example use:
```yaml
{{- include "common.serviceMonitor" (list . .Values.serviceMonitor) -}}
{{- include "common.serviceMonitor" (list . .Values.serviceMonitor) }}
## The following is the same as above:
# {{- include "common.serviceMonitor" (list . .Values.serviceMonitor "mychart.serviceMonitor") -}}
# {{- include "common.serviceMonitor" (list . .Values.serviceMonitor "mychart.serviceMonitor") }}
# {{- define "mychart.serviceMonitor" -}}
# {{- end -}}
# {{- end }}
```
Output:
@ -719,12 +719,12 @@ serviceMonitor:
Example use:
```yaml
{{- include "common.serviceMonitor.secret" (list . .Values.serviceMonitor) -}}
{{- include "common.serviceMonitor.secret" (list . .Values.serviceMonitor) }}
## The following is the same as above:
# {{- include "common.serviceMonitor.secret" (list . .Values.serviceMonitor "mychart.serviceMonitor.secret") -}}
# {{- include "common.serviceMonitor.secret" (list . .Values.serviceMonitor "mychart.serviceMonitor.secret") }}
# {{- define "mychart.serviceMonitor.secret" -}}
# {{- end -}}
# {{- end }}
```
Output:
@ -799,17 +799,17 @@ It creates a basic `Container` spec to be used within a `Deployment` or `CronJob
Example use:
```yaml
{{- include "common.deployment" (list . .Values .Values.autoscaling "mychart.deployment") -}}
{{- include "common.deployment" (list . .Values .Values.autoscaling "mychart.deployment") }}
{{- define "mychart.deployment" -}}
## Define overrides for your Deployment resource here, e.g.
{{- $top := first . -}}
{{- $deployment := index . 1 -}}
{{- $top := first . }}
{{- $deployment := index . 1 }}
spec:
template:
spec:
containers:
- {{- include "common.container" (list $top $deployment "mychart.deployment.container") | nindent 8 }}
{{- end -}}
{{- end }}
{{- define "mychart.deployment.container" -}}
## Define overrides for your Container here, e.g.
ports:
@ -824,7 +824,7 @@ readinessProbe:
httpGet:
path: /
port: http
{{- end -}}
{{- end }}
```
The above example creates a `Deployment` resource which makes use of the `common.container` template to populate the `PodSpec`'s container list. The usage of this template is similar to the other resources, you must define and reference a template that contains overrides for the container object.
@ -986,7 +986,7 @@ metadata:
# metadata:
# {{- include "common.metadata" (list . "mychart.metadata") | nindent 2 }}
# {{- define "mychart.metadata" -}}
# {{- end -}}
# {{- end }}
```
Example output: