From b8722ce83bce727d88a61cecff3343d3046e75f7 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 9 Mar 2018 14:49:33 +0100 Subject: refactor(templater): Pass resource set path to insertFile function This is actually several refactors in one: * rename "fileContent" function to "insertFile" * pass the resource set path to the "insetFile" function * update docs and example with a pipeline including indentation adjustments for the inserted file --- example/some-api/some-api.yaml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'example') diff --git a/example/some-api/some-api.yaml b/example/some-api/some-api.yaml index 44b61541744c..887eb69a99cc 100644 --- a/example/some-api/some-api.yaml +++ b/example/some-api/some-api.yaml @@ -4,7 +4,18 @@ kind: Secret metadata: name: secret-certificate data: - cert.pem: {{ passLookup "my/secret/certificate" | b64enc }} + cert.pem: { passLookup "my/secret/certificate" | b64enc }} +--- +apiVersion: extensions/v1beta1 +kind: ConfigMap +metadata: + name: some-config +data: + # The content of the example configuration file is templated in here + # by the 'insertFile' function and indented for YAML-compatibility + # with the 'indent' function: + some.cfg: | +{{ insertFile "some.cfg" | indent 4 }} --- apiVersion: extensions/v1beta1 kind: Deployment @@ -25,8 +36,6 @@ spec: value: {{ .importantFeature }} - name: SOME_GLOBAL_VAR value: {{ .globalVar }} - - name: FILE_VAR - value: {{ fileContent "some-api/filevar.txt" }} --- apiVersion: v1 kind: Service -- cgit 1.4.1