rancher / fleet

Deploy workloads from Git to large fleets of Kubernetes clusters
https://fleet.rancher.io/
Apache License 2.0
1.52k stars 229 forks source link

Assigning a variable inside templating #2758

Open shane-davidson opened 3 months ago

shane-davidson commented 3 months ago

Is there an existing issue for this?

Current Behavior

Not sure if this is expected bahaviour on not but I have tried the following (inside the values block) of the fleet.yaml file:

${ $variable := "value" }

and then the following: ${ $variable }

expecting the template to render value but inside fleet does not show any errors.

The git repo (commit SHA) updates but the bundle (commit label) does not

Expected Behavior

No response

Steps To Reproduce

No response

Environment

Rancher v2.8.4

Logs

No response

Anything else?

No response

bigkevmcd commented 2 months ago

Hi @shane-davidson Can you provide a small snippet of your .helm.values illustrating this?

I've tested it, and it seems to be working?

clusterName: '${ .ClusterLabels.name } ${- $variable := "value" }'
testVariable: "${ $variable }"

Gets rendered correctly.