@@ -624,12 +624,15 @@ kind: Kustomization
624624metadata:
625625 name: apps
626626spec:
627- ...
628627 postBuild:
629628 substitute:
630629 var_substitution_enabled: "true"
631630` ` `
632631
632+ **Note:** When using numbers or booleans as values for variables, they must be
633+ enclosed in double quotes vars to be treated as strings, for more information see
634+ [substitution of numbers and booleans](#post-build-substitution-of-numbers-and-booleans).
635+
633636You can replicate the controller post-build substitutions locally using
634637[kustomize](https://github.com/kubernetes-sigs/kustomize)
635638and Drone's [envsubst](https://github.com/drone/envsubst) :
@@ -1554,6 +1557,38 @@ secretGenerator:
15541557 - .dockerconfigjson=ghcr.dockerconfigjson.encrypted
15551558` ` `
15561559
1560+ # ## Post build substitution of numbers and booleans
1561+
1562+ When using [variable substitution](#post-build-variable-substitution) with values
1563+ that are numbers or booleans, the reconciliation may fail if the substitution
1564+ is for a field that must be of type string. To convert the number or boolean
1565+ to a string, you can wrap the variable with a double quotes var :
1566+
1567+ ` ` ` yaml
1568+ apiVersion: v1
1569+ kind: ServiceAccount
1570+ metadata:
1571+ name: app
1572+ annotations:
1573+ id: ${quote}${id}${quote}
1574+ enabled: ${quote}${enabled}${quote}
1575+ ` ` `
1576+
1577+ Then in the Flux Kustomization, define the variables as :
1578+
1579+ ` ` ` yaml
1580+ apiVersion: kustomize.toolkit.fluxcd.io/v1
1581+ kind: Kustomization
1582+ metadata:
1583+ name: app
1584+ spec:
1585+ postBuild:
1586+ substitute:
1587+ quote: '"' # double quote var
1588+ id: "123"
1589+ enabled: "true"
1590+ ` ` `
1591+
15571592# ## Triggering a reconcile
15581593
15591594To manually tell the kustomize-controller to reconcile a Kustomization outside
0 commit comments