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
This commit is contained in:
Vincent Ambo 2018-03-09 14:49:33 +01:00 committed by Vincent Ambo
parent bafb792339
commit b8722ce83b
4 changed files with 26 additions and 33 deletions

View file

@ -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