Coder Social home page Coder Social logo

helm-plugin-render-values's Introduction

helm-plugin-render-values

The helm-plugin-render-values is a Helm downloader plugin that enhances the rendering of templated values.

This plugin is particularly useful when working with third-party charts that don't have the tpl() function for values, but you still want to utilize it.

Feel free to explore the capabilities of this plugin and enjoy a more streamlined and efficient Helm charting experience!

Install

Use helm CLI to install this plugin:

$ helm plugin install https://github.com/vivid-money/helm-plugin-render-values --version 0.2.3

Usage

helm upgrade name . -f render://templated-values.yaml

templated-values.yaml should looks like this

## Extra files values imorted from. They must not have templating
importValuesFrom: 
- base-values1.yaml
- base-values2.yaml
- services/*/deploy.yaml
- services/*/env/dev.yaml

## Extra files with templating to render. They should have templating
extendRenderWith: 
- extended-values1.yaml

myapp:
  cluster: {{ .Values.clusterName }}
  enabled: {{ .Values.enabled }}
  {{if .Values.default }}
  run: {{ .Values.default }}
  {{- end }}

importValuesFrom

  • The importValuesFrom keyword allows you to specify a list of sources for values to render them.
  • These files should not contain any templating. Only values for templating!
  • If you use importValuesFrom with a pattern, the values will be nested under the corresponding folder structure. For example, if you have values in files under the folder1/folder2 directory, they will be nested under "folder1"."folder2" in the rendered values.
  • The values specified in importValuesFrom will be merged, and if there are conflicting keys, the last imported value will override the first one.

extendRenderWith

  • The extendRenderWith section specifies a list of files with templating to render. These files can contain templating logic. In the example, values are extended from extended-values1.yaml

Self values rendering

If neither importValuesFrom nor extendRenderWith is specified in the file, the values will be taken from the same file, and the file itself will be used for template rendering.

  • Since this file renders values based on its own values, templating will only work with a single level of nesting. For example, if we define param1: value1, we can use it for param2: {{ .Values.param1 }}, but we cannot use param2 to generate the next value.

  • The plugin doesn't know about .Release values!

  • Another limitation is that you cannot use string values with {{ xxx }} in the main file that should not be rendered (e.g., passing strings with templating for Prometheus rules).

Example:

helm upgrade releasename -f render://test-values.yaml

env: dev
namespace: release-{{.Value.env}}
hostname: service-{{.Value.env}}.domain.com

Notes

v0.2.3

  • update go to 1.20
  • add test for glob import files
  • fix glob import files

v0.2.2

  • update go to 1.19
  • added tests
  • update README

v0.2.1

  • importValuesFrom now can been set with files pattern

v0.2.0

  • add "extendRenderWith" key to include those files to output render
  • fix mergeKeys func

v0.1.3

  • fixed all from previous(0.1.2) note
  • could use "self" in importValuesFrom

Development

Run tests go test ./tests/ -v

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.