Skip to content

Args templating engine#67

Merged
PrasadG193 merged 3 commits intomainfrom
template_engine
May 11, 2021
Merged

Args templating engine#67
PrasadG193 merged 3 commits intomainfrom
template_engine

Conversation

@sahil-lakhwani
Copy link
Copy Markdown
Contributor

Signed-off-by: sahil-lakhwani sahilakhwani@gmail.com

Adds a template rendering engine to allow templated args for helm apps.
The args passed to helm app would be allowed to use all the template functions from the standard Go template library and the Sprig library.

There are some functions added from the Helm library called from here, and other two called "include" and "lookup"

Note that the values passed to the template itself have to be a constant, meaning - the args can't refer to any values from values.yaml

Example:

apiVersion: v1
kind: kbrew
app:
  args:
    rbac.create: '{{ if (lookup "v1" "ServiceAccount" "" "admin") }}true{{ else }}false{{ end }}'
  repository:    
    name: banzaicloud-stable
    url: https://charts.bitnami.com/bitnami
    type: helm
  name: bitnami/mysql
  namespace: default
  version: 8.5.4

The value for rbac.create is resolved to true only if there's a ServiceAccount named admin present

Signed-off-by: sahil-lakhwani <sahilakhwani@gmail.com>
@sahil-lakhwani sahil-lakhwani requested a review from PrasadG193 May 5, 2021 07:09
Signed-off-by: sahil-lakhwani <sahilakhwani@gmail.com>
Comment thread pkg/engine/funcs.go
Signed-off-by: sahil-lakhwani <sahilakhwani@gmail.com>
@PrasadG193 PrasadG193 changed the title args templating engine Args templating engine May 11, 2021
@PrasadG193 PrasadG193 merged commit aeda485 into main May 11, 2021
@PrasadG193 PrasadG193 deleted the template_engine branch May 11, 2021 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants