Had a good chat with @niemeyer, the plan is to have a general mechanism for the root user on the system to have a voice about configuration defaults for snaps before seeding (first time snapd starts at all) or before the snap is installed, this is similar to how the defaults
stanza in the gadget works for the brand.
The plan is to support having files under /var/lib/snapd/seed/config/*.yaml
, they would need to be non-world writable, each file would have the format:
defaults:
<snap id>:
<key>: <value>
the default configuration used at seeding or install for a snap would be equivalent to appling the stanzas for the snap (matching by snap id
), first from gadget.yaml
and then from the files under /var/lib/snapd/seed/config/
processed in lexicographical order by file name.
This is quite consistent with the preexisting mechanism. Now concretely for the original specific use case cloud-init would make sure to write – before snapd starts – a file /var/lib/snapd/seed/config/cloud-init.yaml with content like:
defaults:
99T7MUlRhtI3U0QFgl5mXXESAiSwt776: # snap-id of core
proxy.cloud-placement:
cloud-name: CLOUD-NAME
region: REGION
availability-zone: AZ