Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloud.cfg.tmpl: reorganise, minimise/reduce duplication #4272

Merged

Conversation

dermotbradley
Copy link
Contributor

@dermotbradley dermotbradley commented Jul 21, 2023

Proposed Commit Message

cloud.cfg.tmpl: reorganise, minimise/reduce duplication

Simplify the cloud.cfg.tmpl file. There is a lot of duplication (e.g.
the same sudo rule specified multiple times).

This also addresses #4267 and aligns Debian-specific template
configuration with Debian's own packaged cloud.cfg, located here:
https://salsa.debian.org/cloud-team/cloud-init/-/blob/master/debian/cloud.cfg

Fixes GH-4267

Additional Context

Test Steps

Checklist:

  • My code follows the process laid out in the documentation
  • I have updated or added any unit tests accordingly
  • I have updated or added any documentation accordingly

Copy link
Collaborator

@igalic igalic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

config/cloud.cfg.tmpl Outdated Show resolved Hide resolved
@dermotbradley dermotbradley force-pushed the reorganise-cloud.cfg.tmpl branch 2 times, most recently from 9238d80 to 25edfc5 Compare July 23, 2023 02:25
Copy link
Member

@TheRealFalcon TheRealFalcon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work here. I have a couple thoughts inline that I think we should figure out before we go any further.

config/cloud.cfg.tmpl Show resolved Hide resolved
@TheRealFalcon TheRealFalcon self-assigned this Jul 31, 2023
Copy link
Member

@TheRealFalcon TheRealFalcon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bah...I had left another comment yesterday that seems to have disappeared. Sorry about that. It was the main thing I was wondering about so I recreated it here.

config/cloud.cfg.tmpl Outdated Show resolved Hide resolved
@dermotbradley
Copy link
Contributor Author

dermotbradley commented Aug 14, 2023

I made some more changes including tidying up multiple blank lines, making YAML indentation uniform.

I used tools/render-cloudcfg to compare all the distros it supports "before" and "after" and things look good.

I notice that render-cloudcfg does not permit some distros as valid parameters though. Should "dragonfly", "cos", and the various Suse variations be valid options for that script?

@dermotbradley
Copy link
Contributor Author

BTW I happened to notice that for variant "amazon" there is no module enabled in cloud_config_modules section for (RPM) packages, e.g yum_add_repo.

This is not something I've broken, I checked the rendered version of the existing cloud.cfg.tmpl and it is the same situation.

I assume therefore that AWS must be modifying or replacing the cloud.cfg when they package cloud-init for AWS Linux.

@TheRealFalcon
Copy link
Member

This is looking really good. Thanks @dermotbradley

I notice that render-cloudcfg does not permit some distros as valid parameters though. Should "dragonfly", "cos", and the various Suse variations be valid options for that script?

Let's add dragonfly as that is specifically called out in the template, but I think we can leave the others.

I left a few small nits inline. Beyond that:

For Alpine, I noticed a few non-trivial changes. I'm assuming those are intentional? In particular, groups changed from [adm, sudo] to [adm, wheel]. Also, there's an added eni network renderer when there was none before.

For Debian, I don't think the added renderers/activators are correct. Bookworm cloud images are shipping with netplan and systemd-networkd by default. I would expect a list similar to Ubuntu.

Copy link
Member

@TheRealFalcon TheRealFalcon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few small nits inline

Here's the inline comments.

config/cloud.cfg.tmpl Show resolved Hide resolved
config/cloud.cfg.tmpl Outdated Show resolved Hide resolved
@dermotbradley
Copy link
Contributor Author

Let's add dragonfly as that is specifically called out in the template, but I think we can leave the others.

Ok, I'll do that.

For Alpine, I noticed a few non-trivial changes. I'm assuming those are intentional? In particular, groups changed from [adm, sudo] to [adm, wheel]. Also, there's an added eni network renderer when there was none before.

Yes these are intentional.

For Debian, I don't think the added renderers/activators are correct. Bookworm cloud images are shipping with netplan and systemd-networkd by default. I would expect a list similar to Ubuntu.

I wasn't sure what these should be and so assumed only 'eni' (for older Debian releases) and 'networkd' as newer releases seemed to use that. Didn't realise Debian used/supported netplan.

I'll change this as you indicated.

Copy link
Member

@TheRealFalcon TheRealFalcon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Final thing is this branch needs a rebase. There's a conflict (I believe due to openeuler changing case).

Copy link
Collaborator

@igalic igalic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Simplify the cloud.cfg.tmpl file. There is a lot of duplication
(e.g. the same sudo rule specified multiple times).

This also addresses canonical#4267 and aligns Debian-specific template
configuration with Debian's own packaged cloud.cfg, located here:
https://salsa.debian.org/cloud-team/cloud-init/-/blob/master/debian/cloud.cfg

Use uniform YAML indentation.

Modify jinja template to avoid duplicate blank lines.
@dermotbradley
Copy link
Contributor Author

Final thing is this branch needs a rebase. There's a conflict (I believe due to openeuler changing case).

Done.

@TheRealFalcon
Copy link
Member

Thanks!

@TheRealFalcon TheRealFalcon merged commit cda82fe into canonical:main Aug 16, 2023
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants