Kustomization variable substitution type issue #2957
-
I'm attempting to use the variable substitution feature in Flux's Kustomizations, but I'm getting weird issues with ambiguous strings (e.g. "20220802.5"):
I quoted each occurrence of EDIT: apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: other-namespace
namespace: other-ks
spec:
path: "./apps/some/path/dev"
targetNamespace: my-namespace
prune: true
interval: 5m
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
postBuild:
substitute:
namespace: "my-namespace"
dd_commit: "bba2c2d53adeed14b838efd256c55c47490bb10e"
dd_tag: "20220802.5" where apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: my-ks
spec:
targetNamespace: ${namespace}
path: "./apps/some/path/base"
prune: true
interval: 5m
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
postBuild:
substitute:
namespace: "${namespace}"
dd_commit: "${dd_commit:=main}"
dd_tag: "${dd_tag:=latest}"
patches:
# etc. So the variable in question is actually passing through two Kustomizations before being applied to resources in Changing the value of |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
@netthier you can quote it w single quotes first like |
Beta Was this translation helpful? Give feedback.
-
I'm getting the same issue creating Kustomizations to work around cross-resource dependencies. Top level Kustomization has variable to replace multiple directories per environment, e.g. |
Beta Was this translation helpful? Give feedback.
-
Docs on how to use numbers and booleans in post build substitutions are here: fluxcd/kustomize-controller#1129 |
Beta Was this translation helpful? Give feedback.
@netthier you can quote it w single quotes first like
dd_tag: "'20220802.5'"