about summary refs log tree commit diff
path: root/example
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2018-03-09T13·49+0100
committerVincent Ambo <github@tazj.in>2018-03-09T13·54+0100
commitb8722ce83bce727d88a61cecff3343d3046e75f7 (patch)
treed3ebcea70f8944d70093bf4201dc0f15468909ba /example
parentbafb792339b5898a0e6b6219ad54b5f501d727c2 (diff)
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
Diffstat (limited to 'example')
-rw-r--r--example/some-api/some-api.yaml15
1 files changed, 12 insertions, 3 deletions
diff --git a/example/some-api/some-api.yaml b/example/some-api/some-api.yaml
index 44b6154174..887eb69a99 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