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

add mariner support #1780

Merged
merged 7 commits into from
Nov 7, 2022
Merged

Conversation

rmhsawyer
Copy link
Contributor

Proposed Commit Message

This PR is aimed to add Mariner support for cloud-init

Additional Context

CBL-Mariner is an internal Linux distribution for Microsoft’s cloud infrastructure and edge products and services.
Details can you found here: CBL-Mariner

Test Steps

Running tox -e do_format and tox command to test

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
Contributor

@cjp256 cjp256 left a comment

Choose a reason for hiding this comment

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

Awesome! Thank you for upstreaming this :D

config/cloud.cfg.tmpl Outdated Show resolved Hide resolved
tests/unittests/test_render_cloudcfg.py Outdated Show resolved Hide resolved
tests/unittests/test_util.py Show resolved Hide resolved
}


class TestMariner(CiTestCase):
Copy link
Contributor

Choose a reason for hiding this comment

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

For future reference, I'd recommend new tests use pytest rather than unittest where practical.

cloudinit/distros/mariner.py Outdated Show resolved Hide resolved
cloudinit/distros/mariner.py Outdated Show resolved Hide resolved
cloudinit/distros/mariner.py Outdated Show resolved Hide resolved
@rmhsawyer rmhsawyer requested a review from cjp256 October 14, 2022 00:36
config/cloud.cfg.tmpl Outdated Show resolved Hide resolved
@rmhsawyer rmhsawyer marked this pull request as ready for review October 19, 2022 00:06
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 think we can simply the Distro class a ton by inheriting from photon.Distro.

"""


class Distro(distros.Distro):
Copy link
Member

Choose a reason for hiding this comment

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

Given that this class is almost entirely copied from the Photon distro class, why not just have the Distro class here inherit from photon.Distro and override the small pieces necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Totally make senses. I am working with my team to dig into this and find out what exactly are required for mariner.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

change as suggested to inherit from photon and override few methods

@@ -99,11 +99,11 @@ cloud_init_modules:
- set_hostname
- update_hostname
- update_etc_hosts
{% if variant in ["alpine", "photon"] %}
{% if variant in ["alpine", "mariner", "photon"] %}
Copy link
Member

@TheRealFalcon TheRealFalcon Oct 19, 2022

Choose a reason for hiding this comment

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

I see that you're basically copying whatever Photon does in this file, but does Mariner work exactly the same way? Is the resolv_conf module needed? Is there a reason to disable ca-certs and ssh-import-id?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Working with my team to confirm these. will push a new commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After discussion, we decided to leave those modules enabled and give the abilities to run those modules to users as long as they don't bring any side effects when no detailed configurations are specified under the module.

@TheRealFalcon TheRealFalcon self-assigned this Oct 19, 2022
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!

@TheRealFalcon TheRealFalcon merged commit 699b6a0 into canonical:main Nov 7, 2022
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