From e75a173d9df4e4fba56197173fbe7e5a572b8f62 Mon Sep 17 00:00:00 2001 From: Chi-En Wu Date: Wed, 22 Apr 2020 16:34:27 +0800 Subject: [PATCH] docs: add description about `common.deployment` --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/README.md b/README.md index 2796415..2419b13 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,51 @@ Each implemented base resource is described in greater detail below. +### `common.deployment` + +The `common.deployment` template accepts a list of three values: + +- the top context +- `$deployment`, a dictionary of values used in the deployment template +- `$autoscaling`, a dictionary of values used in the hpa template +- [optional] the template name of the overrides + +It defines a basic `Deployment` with the following settings: + +| Value | Description | +| ----- | ----------- | +| `$deployment.replicaCount` | Number of replica. If autoscaling enabled, this field will be ignored | +| `$deployment.imagePullSecrets` | [optional] Name of Secret resource containing private registry credentials | +| `$deployment.podSecurityContext` | [optional] Security options for pod | +| `$deployment.nodeSelector` | [optional] Node labels for pod assignment | +| `$deployment.affinity` | [optional] Expressions for affinity | +| `$deployment.tolerations` | [optional] Toleration labels for pod assignment | +| `$autoscaling.enabled` | [optional] Set this to `true` to enable autoscaling | + +Underneath the hood, it uses [`common.container`](#commoncontainer). + +By default, the pod template within the deployment defines the labels + +```yaml +app.kubernetes.io/name: {{ template "common.name" }} +app.kubernetes.io/instance: {{ .Release.Name }} +``` + +as this is also used as the selector. The standard set of labels are not used as some of these can change during upgrades, which causes the replica sets and pods to not correctly match. + +Example use: + +```yaml +{{- template "common.deployment" (list . .Values .Values.autoscaling) -}} + +## The following is the same as above: +# {{- template "common.deployment" (list . .Values .Values.autoscaling "mychart.deployment") -}} +# {{- define "mychart.deployment" -}} +# {{- end -}} +``` + + + ### `common.service` The `common.service` template accepts a list of three values: