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

WIP: Initial import and azure hostname module #1

Closed
wants to merge 4 commits into from

Conversation

yuqi-zhang
Copy link
Owner

Create an azure-hostname.service to fetch the hostname and write to /etc/hostname.

Questions:

  1. I feel that this should run before ignition, in case ignition wants to overwrite the file with a static config? I assume this is for DHCP only.

  2. This should be firstboot only right?

  3. From what little rust I know I think /usr/bin/afterburn --cmdline --hostname /etc/hostname is the right call for this

  4. I think this needs systemd network and that should be it?

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>
Include afterburn in the initramfs, and create initial hostname
fetching service for Azure.

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>
@yuqi-zhang
Copy link
Owner Author

cc @lucab

@lucab
Copy link

lucab commented Jun 3, 2019

Paging @ajeddeloh as well as this could be tricky.

  1. I would place in-between ignition-disks and ignition-files
  2. technically the hostname could change at anytime, so I don't think this is first-boot only
  3. I think it needs a /sysroot/ prefix as well (and proper ordering so that sysroot is mounted already)
  4. assuming that means network-online.target, yes

@yuqi-zhang
Copy link
Owner Author

Sorry for the delay, I fixed it up to a working state and tested on metal for now.

One question is, since Afterburn is so closely coupled with ignition, should we make this a separate repo like coreos/afterburn-dracut or should be add this under ignition-dracut/overlay it in? I have been modifying the afterburn specfile to build this so its not hard to do either way.

cc @jlebon @ajeddeloh

Fix module-setup and add a test-metal.service
@yuqi-zhang yuqi-zhang force-pushed the initial-azure-hostname-module branch from 9d60fbc to f5cacf7 Compare June 6, 2019 14:32
@jlebon
Copy link

jlebon commented Jun 6, 2019

Let's make this part of the Afterburn repo itself? I'm hoping this is something we can do for Ignition as well eventually. That one started out as separate because it did more things than just Ignition. But for this, since it's purely about enabling Afterburn, I'd prefer we keep it all together from the start.


mkdir -p "$initdir/$systemdsystemunitdir/initrd.target.requires"

ln -s "../azure-hostname.service" "$initdir/$systemdsystemunitdir/initrd.target.requires/azure-hostname.service"
Copy link

Choose a reason for hiding this comment

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

Maybe just afterburn-hostname.service ? Theoretically, other clouds could need this too in the future.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Good point

inst_simple "$moddir/test-metal.service" \
"$systemdutildir/system/test-metal.service"

ln -s "../test-metal.service" "$initdir/$systemdsystemunitdir/initrd.target.requires/test-metal.service"
Copy link

Choose a reason for hiding this comment

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

Did you mean to commit this, or was it just a test?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I committed a test service in case people wanted to verify since its WIP and I don't have Azure access atm

# during the initramfs

[Unit]
Description=Afterburn hostname
Copy link

Choose a reason for hiding this comment

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

Super minor: let's do descriptions in Title Case?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Will do

@yuqi-zhang
Copy link
Owner Author

I don't have strong feelings either way. It will probably easier to do as part of the main Afterburn repo then. Will open a similar PR against it for discussion

@jlebon
Copy link

jlebon commented Jun 6, 2019

  1. I would place in-between ignition-disks and ignition-files
  2. technically the hostname could change at anytime, so I don't think this is first-boot only

These two conflict, no? If Ignition runs only on first boot, but Afterburn runs on every boot, then:

  1. running before ignition-files means that Ignition will be able to set the hostname on the first boot, but then the machine will revert back to another hostname on reboot
  2. more generally, it's impossible to persistently set the hostname different from the Azure hostname since it'll be reset on the next boot; not sure if that's the behaviour we want

IOW, ISTM if we do want the hostname to be overridable by Ignition, then we should also be first boot only. If we don't, then we should run after Ignition so that the machine consistently has the same hostname.

(I guess one hybrid approach is to conditionally track Azure's hostname iif no Ignition hostname is specified, though that's more complex to implement.)

@yuqi-zhang
Copy link
Owner Author

These two conflict, no?

That is true.

IOW, ISTM if we do want the hostname to be overridable by Ignition, then we should also be first boot only.

I think its safe to implement this for now as I believe Azure leases are in the order of many years, so its not SUPER likely we will see a switch in behaviour that often.

I guess one hybrid approach is to conditionally track Azure's hostname iif no Ignition hostname is specified

The other thing is I haven't really used Azure much, will there be a lot of situations that we foresee people doing static IP/hostname setup with ignition?

@ashcrow
Copy link

ashcrow commented Jun 17, 2019

Is this still relevant post coreos/afterburn#224 being merged?

@yuqi-zhang
Copy link
Owner Author

Yes, closing.

@yuqi-zhang yuqi-zhang closed this Jun 20, 2019
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.

4 participants