Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

v0.13.x: Plugin enhancement - allow embedding templates within templates #1661

Conversation

davidmccormick
Copy link
Contributor

add insertTemplateFile template function which allows embedding a template file within any templatable plugin object, e.g. within in stack resource: -

        "prometheus-server-cloud-int": {
          "files": {
            "/var/run/coreos/cloud_config": {
              "content": {
                "Fn::Sub": {{ insertTemplateFile "plugins/prometheus/assets/cloud-config.yaml" $ | toJSON }}
              }
            },
            "/var/run/coreos/prometheus.yaml": {
                "content": {
                  "Fn::Sub": {{ insertTemplateFile "plugins/prometheus/assets/prometheus-config.yaml" $ | toJSON }}
              }
            },
            "/var/run/coreos/nginx_config": {
                "content": {
                  "Fn::Sub": {{ insertTemplateFile "plugins/prometheus/assets/nginx-config" $ | toJSON }}
              }
            },
            "/var/run/coreos/script_exporter.yaml": {
              "content": {
                "Fn::Sub": {{ insertTemplateFile "plugins/prometheus/assets/script-exporter-config.yaml" $ | toJSON }}
              }
            }
          }
        }

e.g. within an inserted template for userdata: -

#!/bin/bash -xe
# Trigger updates any of these files change:-
# cloud-config: {{ insertTemplateFile "plugins/prometheus/assets/cloud-config.yaml" $ | fingerprint }}
# promethus-config: {{ insertTemplateFile "plugins/prometheus/assets/prometheus-config.yaml" $ | fingerprint }}
# nginx-config: {{ insertTemplateFile "plugins/prometheus/assets/nginx-config" $ | fingerprint }}
# script-exporter-config: {{ insertTemplateFile "plugins/prometheus/assets/script-exporter-config.yaml" $ | fingerprint }}
cloud-init() {
  container_name="cloud-init-container"
...

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 1, 2019
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 1, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign davidmccormick
You can assign the PR to them by writing /assign @davidmccormick in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@davidmccormick davidmccormick added this to the v0.13.0-rc.3 milestone Jul 1, 2019
@codecov-io
Copy link

Codecov Report

Merging #1661 into v0.13.x will decrease coverage by 0.02%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff             @@
##           v0.13.x    #1661      +/-   ##
===========================================
- Coverage    25.49%   25.46%   -0.03%     
===========================================
  Files           98       98              
  Lines         5049     5054       +5     
===========================================
  Hits          1287     1287              
- Misses        3619     3624       +5     
  Partials       143      143
Impacted Files Coverage Δ
filereader/texttemplate/texttemplate.go 5.33% <0%> (-0.39%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 258abe5...c3826ff. Read the comment docs.

@davidmccormick davidmccormick merged commit acbaaf8 into kubernetes-retired:v0.13.x Jul 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants