From f848f3e7f4ae333fef6821fa2483ac358d4d5af7 Mon Sep 17 00:00:00 2001 From: Chi-En Wu Date: Thu, 23 Apr 2020 09:42:15 +0800 Subject: [PATCH] docs: add description about `common.secret` --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/README.md b/README.md index 06b4ee8..c569b51 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ It provides utilities that reflect best practices of Kubernetes chart developmen - [Resource Kinds](#resource-kinds) * [`common.configMap`](#commonconfigmap) * [`common.deployment`](#commondeployment) + * [`common.secret`](#commonsecret) * [`common.service`](#commonservice) - [Partial Objects](#partial-objects) * [`common.container`](#commoncontainer) @@ -144,6 +145,51 @@ Example use: ``` +### `common.secret` + +The `common.secret` template accepts a list of two values: + +- the top context +- [optional] the template name of the overrides + +It creates an empty `Secret` resource that you can override with your secrets. + +Example use: + +```yaml +{{- include "common.secret" (list . "mychart.secret") -}} +{{- define "mychart.secret" -}} +data: + zeus: {{ print "cat" | b64enc }} + athena: {{ print "cat" | b64enc }} + julius: {{ print "cat" | b64enc }} + one: |- + {{ .Files.Get "file1.txt" | b64enc }} +{{- end -}} +``` + +Output: + +```yaml +apiVersion: v1 +data: + athena: Y2F0 + julius: Y2F0 + one: VGhpcyBpcyBhIGZpbGUuCg== + zeus: Y2F0 +kind: Secret +metadata: + labels: + app.kubernetes.io/instance: release-name + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: mychart + app.kubernetes.io/version: 1.16.0 + helm.sh/chart: mychart-0.1.0 + name: release-name-mychart +type: Opaque +``` + + ### `common.service`