mammoth-flag-56137
01/25/2023, 3:07 AMone:
config:
name: "defaultvalue"
foo: "bar"
if I have a config for an environment like this
clientenv.yaml
one:
config:
# foo: "bar2"
then when referencing {$var.one.config.name}
in a kubernetes deployment manifest I get an error
errors:
- detail:
results:
task.one-migrate:
type: task
description: running task one-migrate in module one-server
key: task.one-migrate
name: one-migrate
error:
detail:
err:
detail:
value: null
nodePath: []
fullPath: var.one.config.name
opts:
allowPartial: true
unescape: true
stack: []
type: configuration
type: template-string
Is this the intended behaviour that having the config:
section without anything in it is effectively doing config: {}
and blanking/nulling any default values?big-spring-14945
01/26/2023, 10:18 AMone
, and then you're assigning a module-level variable in clientenv.yaml
called one
, the latter will take precedence. See also:
https://docs.garden.io/using-garden/variables-and-templating#variable-precedence-ordermammoth-flag-56137
01/26/2023, 10:18 AMbig-spring-14945
01/26/2023, 10:19 AMmammoth-flag-56137
01/26/2023, 10:19 AMone:
config:
foo: "bar2"
big-spring-14945
01/26/2023, 10:27 AMmammoth-flag-56137
01/26/2023, 10:27 AMbig-spring-14945
01/26/2023, 10:28 AMmammoth-flag-56137
01/26/2023, 10:29 AM- garden --env=$ENVIRONMENT $IMAGE_VARS --yes plugins kubernetes cluster-init
- garden --env=$ENVIRONMENT $IMAGE_VARS --yes -l=silly -o=yaml deploy
if [[ $ENVIRONMENT == "preview" ]]; then
if [[ -f "environments/${ENV_PATH}.yaml" ]]; then
cp -f "environments/${ENV_PATH}.yaml" ./garden.env.yaml
else
cp -f "environments/preview/${PREVIEW_BASE}.yaml" ./garden.env.yaml
fi
fi
if [[ $ENVIRONMENT != "preview" ]]; then
if [[ -f "environments/${ENV_PATH}.yaml" ]]; then
cp -f "environments/${ENV_PATH}.yaml" ./garden.env.yaml
else
echo "Non-preview environment was specified and no environment file exists at `environments/${ENV_PATH}.yaml`.";
exit 1;
fi
fi
one:
config:
name: "defaultvalue"
foo: "bar"
garden.env.yaml
one:
config:
# foo: "bar2"
then whatever module that uses {$var.one.config.name}
will be trying to use nullone:
config:
foo: "bar2"
then {$var.one.config.name}
will be "defaultvalue"big-spring-14945
01/26/2023, 11:24 AMmammoth-flag-56137
01/26/2023, 4:45 PMbig-spring-14945
01/27/2023, 9:19 AM