Compatible issue between ubuntuSeedCloudCfg and <gadget>/cloud.conf

Bug #1918299 reported by hugh chao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Fix Released
High
Ian Johnson

Bug Description

Current priority of cloud init configs in snapd [0] are:

1. gadget-cloud.conf
2. ubuntuSeedCloudCfg

these two configs can only choice one.

The scenario I'm facing is:

1. I have a cloud.conf in my gadget.
2. Maas is being used to deploy this customized core 20 image.

So since I have the cloud.conf in my gadget, after maas put the maas configs into ubuntuSeedCloudCfg, snpad will not use those maas cloud-init configs which makes the maas deployment failed.

And seems snapd team was considering about make it compatible as below comment[1], so please help to review this request and implement it, thank you:

// TODO:UC20: we may eventually want to consider both CloudInitSrcDir
// and the gadget cloud.conf so returning here may be wrong

[0] https://github.com/snapcore/snapd/blob/master/overlord/devicestate/handlers_install.go#L52
[1] https://github.com/snapcore/snapd/blob/master/sysconfig/cloudinit.go#L117

Tags: oem-priority
hugh chao (hugh712)
tags: added: oem-priority
Revision history for this message
Ian Johnson (anonymouse67) wrote :

Hi, can you explain a bit more your use case why you need both cloud-init in the gadget and cloud-init in ubuntu-seed ?

Changed in snapd:
status: New → Incomplete
Revision history for this message
Ian Johnson (anonymouse67) wrote :

After discussing with Samuele this is a valid use case and one we will work on, but I would still like to know more about the use case.

Changed in snapd:
status: Incomplete → Confirmed
assignee: nobody → Ian Johnson (anonymouse67)
Revision history for this message
hugh chao (hugh712) wrote :

@Ian

Some of our images need a default user which implement by cloud-init of gadget,
and we have a mechanism to run the whole CI flow as:

build images -> deploy images to devices with MAAS-> run checkbox with testflinger --> send report to the owner...

So in current situation the process stocks in "deployment" due to the environment can not get the cloud-init in ubuntu-seed

Changed in snapd:
importance: Undecided → High
Revision history for this message
Ian Johnson (anonymouse67) wrote :
Changed in snapd:
status: Confirmed → In Progress
Revision history for this message
Ian Johnson (anonymouse67) wrote :

Hi folks, can you clarify if the preference for your deployment (which is the only known use case we have right now of using both cloud-init from ubuntu-seed and from the gadget) is either:

1. Have the gadget config file be named to take precedence over the ubuntu-seed one
2. Have the ubuntu-seed config file be named to take precedence over the gadget one

This is relevant because cloud-init when processing all of the config files will process them in lexical order, with keys that have different values in earlier files being overwritten by keys in later files. For example the users key in the gadget file may also be in the ubuntu-seed file, and it's unclear which one should take precedence. We need to decide in snapd for now which one should take precedence before moving forward with the PR.

If you need to be able to accommodate both situations, can you make clear the reasons for each situation?

Changed in snapd:
status: In Progress → Incomplete
Revision history for this message
hugh chao (hugh712) wrote :

@Ian

Currently I don't have the answer,
let me collect some data and provide you the feedback later.

Revision history for this message
hugh chao (hugh712) wrote :

@Ian

Basically, the cloud-init config in our gadget only for adding system user, nothing more,
we don't add any key in our gadget.

So I think just let ubuntu-seed config file be named to take precedence over the gadget one, thank you.

Revision history for this message
Ian Johnson (anonymouse67) wrote :

Thanks for that information I will adjust the PR accordingly.

Changed in snapd:
status: Incomplete → In Progress
Revision history for this message
Ian Johnson (anonymouse67) wrote :

The PR has been merged and will be available on edge in a few hours, and will be included in the next snapd major version release, 2.52.

Changed in snapd:
status: In Progress → Fix Committed
milestone: none → 2.52
Revision history for this message
hugh chao (hugh712) wrote :

Great, let me verify it in edge channel :)

Revision history for this message
hugh chao (hugh712) wrote :

@Ian,

Just want to confirm that are the naming which shown below is expected?

05_logging.cfg
10_snappy.cfg
80_device_gadget.cfg
90_50-cloudconfig-maas-cloud-config.cfg
90_50-cloudconfig-maas-datasource.cfg
90_50-cloudconfig-maas-reporting.cfg
90_50-cloudconfig-maas-ubuntu-sso.cfg
90_50-curtin-networking.cfg

Revision history for this message
Ian Johnson (anonymouse67) wrote : Re: [Bug 1918299] Re: Compatible issue between ubuntuSeedCloudCfg and <gadget>/cloud.conf

Yes, the ubuntu-seed config files are ordered later than the gadget config
files.

On Mon, Jun 21, 2021 at 2:00 AM hugh chao <email address hidden>
wrote:

> @Ian,
>
> Just want to confirm that are the naming which shown below is expected?
>
> 05_logging.cfg
> 10_snappy.cfg
> 80_device_gadget.cfg
> 90_50-cloudconfig-maas-cloud-config.cfg
> 90_50-cloudconfig-maas-datasource.cfg
> 90_50-cloudconfig-maas-reporting.cfg
> 90_50-cloudconfig-maas-ubuntu-sso.cfg
> 90_50-curtin-networking.cfg
>
> --
> You received this bug notification because you are a bug assignee.
> Matching subscriptions: snapd-all-bugs
> https://bugs.launchpad.net/bugs/1918299
>
> Title:
> Compatible issue between ubuntuSeedCloudCfg and <gadget>/cloud.conf
>
> Status in snapd:
> Fix Committed
>
> Bug description:
> Current priority of cloud init configs in snapd [0] are:
>
> 1. gadget-cloud.conf
> 2. ubuntuSeedCloudCfg
>
> these two configs can only choice one.
>
> The scenario I'm facing is:
>
> 1. I have a cloud.conf in my gadget.
> 2. Maas is being used to deploy this customized core 20 image.
>
> So since I have the cloud.conf in my gadget, after maas put the maas
> configs into ubuntuSeedCloudCfg, snpad will not use those maas cloud-
> init configs which makes the maas deployment failed.
>
> And seems snapd team was considering about make it compatible as below
> comment[1], so please help to review this request and implement it,
> thank you:
>
> // TODO:UC20: we may eventually want to consider both CloudInitSrcDir
> // and the gadget cloud.conf so returning here may be wrong
>
>
>
> [0]
> https://github.com/snapcore/snapd/blob/master/overlord/devicestate/handlers_install.go#L52
> [1]
> https://github.com/snapcore/snapd/blob/master/sysconfig/cloudinit.go#L117
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/snapd/+bug/1918299/+subscriptions
>
> Launchpad-Notification-Type: bug
> Launchpad-Bug: product=snapd; milestone=2.52; status=Fix Committed;
> importance=High; <email address hidden>;
> Launchpad-Bug-Tags: oem-priority
> Launchpad-Bug-Information-Type: Public
> Launchpad-Bug-Private: no
> Launchpad-Bug-Security-Vulnerability: no
> Launchpad-Bug-Commenters: anonymouse67 hugh712
> Launchpad-Bug-Reporter: hugh chao (hugh712)
> Launchpad-Bug-Modifier: hugh chao (hugh712)
> Launchpad-Message-Rationale: Assignee
> Launchpad-Message-For: anonymouse67
> Launchpad-Subscription: snapd-all-bugs
>

Revision history for this message
hugh chao (hugh712) wrote :

got it, thank you :)

Changed in snapd:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.