jimmycuadra / ktmpl

Parameterized templates for Kubernetes manifests.

Home Page:https://docs.rs/ktmpl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

int / boolean are written as strings into the output

blushingpenguin opened this issue · comments

foo.yaml:

kind: Template
apiVersion: v1
objects:
  - kind: Deployment
    apiVersion: apps/v1
    spec:
      replicas: $(REPLICAS)
parameters:
  - name: "REPLICAS"
    description: "number of pods"
    required: true
    value: 1
    parameterType: "bool"

ktmpl foo.yaml

---
kind: Deployment
apiVersion: apps/v1
spec:
  replicas: "1"

this causes k8s to complain because replicas is a string not an integer. A similar thing happens with boolean values.

This is how the template system works. To get an unquoted value, you use two sets of parens: $((VAR)). You can read the full explanation of the system in the original proposal. I discovered this document had moved so I updated the link in the project's README as well.