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

systemd: enable sshkeys unit on supported platforms #217

Merged
merged 1 commit into from
May 17, 2019

Conversation

rfairley
Copy link

Add ConditionKernelCommandLine triggering conditions so that
the [email protected] unit is enabled only when recognized
cloud platforms are specified through ignition.platform.id.

For now, these platforms are azure and packet which are
currently supported in the afterburn-checkin and
afterburn-firstboot-checkin services.

Part of: coreos/fedora-coreos-tracker#4

@rfairley
Copy link
Author

Tested on FCOS - this avoids an error when using a non-cloud platform such as qemu when [email protected] is enabled (coreos/fedora-coreos-tracker#4 (comment)).

I wonder if we should go ahead and enable all the supported platforms that are listed in the README. For FCOS however, some values of ignition.platform.id are different (e.g. the buildextend-openstack script adds the karg ignition.platform.id=openstack whereas the supported platform in Afterburn is identified by ignition.platform.id=openstack-metadata).

Alternatively this could go the other way, e.g. add a condition ConditionKernelCommandLine=!ignition.platform.id=qemu.

@bgilbert
Copy link
Contributor

For the record, we didn't have this problem on Container Linux because the sshkeys service was enabled by the OEM-specific Ignition config. Your approach is a better way to do this, though.

We should add all the platforms for which Afterburn supports retrieving SSH keys. You're right that OpenStack and CloudStack are a problem, though. Afterburn providers are intentionally not the same as Ignition platforms. The expected flow for these platforms is that the user will tell CT that they're on openstack-metadata or cloudstack-configdrive, and CT will have Ignition write a drop-in which sets AFTERBURN_OPT_PROVIDER to --provider=<provider>. From a quick look at the CL OEMs, though, I'm not sure that CL even enables the sshkeys service on those platforms.

On FCOS... maybe CT should add the triggering condition on those platforms, since it's writing a drop-in anyway? @ajeddeloh?

@ajeddeloh
Copy link

CT adding the platform specific makes sense to me, but I'm also fine with this. Given CT doesn't quite exist yet I'm in favor of merging this now and possibly revisiting it later?

@bgilbert
Copy link
Contributor

I was suggesting having CT handle it for the specific cases where Afterburn can't run without CT writing a drop-in first. So this PR would add triggering conditions for every provider except CloudStack, OpenStack, and VirtualBox (which doesn't support SSH keys).

@ajeddeloh
Copy link

Ah, gotcha. Works for me.

@rfairley
Copy link
Author

The expected flow for these platforms is that the user will tell CT that they're on openstack-metadata or cloudstack-configdrive, and CT will have Ignition write a drop-in which sets AFTERBURN_OPT_PROVIDER to --provider=

This clarifies the difference a lot - thanks!

So this PR would add triggering conditions for every provider except CloudStack, OpenStack, and VirtualBox (which doesn't support SSH keys).

Makes sense - will update the PR for this.

Add `ConditionKernelCommandLine` triggering conditions so that
the `[email protected]` unit is enabled on supported
platforms only.

Note this only adds conditions for platforms where the cloud
metadata provider is also identified through `ignition.platform.id`.

Part of: coreos/fedora-coreos-tracker#4
@rfairley rfairley force-pushed the rfairley-add-sshkey-platforms branch from f68f56c to 25ed3f3 Compare May 16, 2019 19:53
@rfairley
Copy link
Author

rfairley commented May 16, 2019

Updated (also updated the commit message)!

@rfairley rfairley changed the title systemd: enable sshkeys unit only on packet and azure systemd: enable sshkeys unit on supported platforms May 16, 2019
@lucab
Copy link
Contributor

lucab commented May 17, 2019

@bgilbert just to be clear, your plan here is for CT to write both a --provider=openstack-metadata dropin and a ConditionKernelCommandLine=|ignition.platform.id=openstack one, correct?

@bgilbert
Copy link
Contributor

@lucab I was thinking both directives would be in the same drop-in, but yes.

@lucab lucab merged commit b7902eb into coreos:master May 17, 2019
@jlebon
Copy link
Member

jlebon commented May 17, 2019

I posted a follow-up in #218 to solidify my understanding of how all this will get wired up.

rfairley pushed a commit to rfairley/fedora-coreos-config that referenced this pull request May 22, 2019
With coreos/afterburn#217 in Fedora, enable
this unit in FCOS.
rfairley pushed a commit to rfairley/fedora-coreos-config that referenced this pull request May 22, 2019
With coreos/afterburn#217 in Fedora, enable
this unit in FCOS.
rfairley pushed a commit to rfairley/fedora-coreos-config that referenced this pull request May 22, 2019
With coreos/afterburn#217 in Fedora, enable
this unit in FCOS.
jlebon pushed a commit to coreos/fedora-coreos-config that referenced this pull request May 27, 2019
With coreos/afterburn#217 in Fedora, enable
this unit in FCOS.
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.

5 participants