docs: add description about common.cronJob

This commit is contained in:
Chi-En Wu
2020-04-23 12:56:42 +08:00
parent a5d0102367
commit 958453fd4c

View File

@ -10,6 +10,7 @@ It provides utilities that reflect best practices of Kubernetes chart developmen
- [Resource Kinds](#resource-kinds)
* [`common.configMap`](#commonconfigmap)
* [`common.cronJob`](#commoncronjob)
* [`common.deployment`](#commondeployment)
* [`common.ingress`](#commoningress)
* [`common.secret`](#commonsecret)
@ -104,6 +105,50 @@ metadata:
### `common.cronJob`
The `common.cronJob` template accepts a list of four values:
- `$top`, the top context
- `$cronJob`, a dictionary of values used in the cronjob template
- `$pod`, a dictionary of values used in the pod template
- [optional] the template name of the overrides
It defines a basic `CronJob` with the following defaults:
- Defines the labels of `JobTemplate`
```yaml
app.kubernetes.io/name: {{ include "common.name" }}
app.kubernetes.io/instance: {{ .Release.Name }}
```
as this is also used as the selector.
- Restart policy of pod is set to `OnFailure`
In addition, it uses the following configuration from the `$cronJob`:
| Value | Description |
| ----- | ----------- |
| `$cronJob.schedule` | Schedule for the cronjob |
| `$cronJob.concurrencyPolicy` | [optional] `Allow\|Forbid\|Replace` concurrent jobs |
| `$cronJob.failedJobsHistoryLimit` | [optional] Specify the number of failed jobs to keep |
| `$cronJob.successfulJobsHistoryLimit` | [optional] Specify the number of completed jobs to keep |
Underneath the hood, it invokes [`common.pod.template`](#commonpodtemplate) template with `$pod` to populate the `PodTemplate`.
Example use:
```yaml
{{- include "common.cronJob" (list . .Values.cronJob .Values) -}}
## The following is the same as above:
# {{- include "common.cronJob" (list . .Values.cronJob .Values "mychart.cronJob") -}}
# {{- define "mychart.cronJob" -}}
# {{- end -}}
```
### `common.deployment`
The `common.deployment` template accepts a list of four values: