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 equinix support #56

Merged
merged 10 commits into from
Oct 21, 2022
Merged

Conversation

bwarden
Copy link
Member

@bwarden bwarden commented Oct 10, 2022

No description provided.

@bwarden bwarden marked this pull request as ready for review October 14, 2022 17:48
@bwarden bwarden force-pushed the add-equinix-support branch from a4dffbc to c5a293a Compare October 14, 2022 17:58
@bwarden
Copy link
Member Author

bwarden commented Oct 14, 2022

@ahkok mind reviewing?

src/ucd-data-fetch.c Outdated Show resolved Hide resolved
configure.ac Outdated Show resolved Hide resolved
src/ucd-data-fetch.c Outdated Show resolved Hide resolved
src/ucd-data-fetch.c Outdated Show resolved Hide resolved
tests/fetch_data/public-keys Outdated Show resolved Hide resolved
@bwarden bwarden force-pushed the add-equinix-support branch 2 times, most recently from b51796b to 85f6755 Compare October 14, 2022 18:42
Makefile.am Show resolved Hide resolved
@bwarden bwarden force-pushed the add-equinix-support branch 4 times, most recently from 5d50b21 to 808d95c Compare October 14, 2022 21:57
@bwarden
Copy link
Member Author

bwarden commented Oct 14, 2022

I finally figured out how to get the fetch_test and fetch_data contents into the dist tarball.

@ahkok
Copy link
Contributor

ahkok commented Oct 21, 2022

This looks mostly ready now.

ahkok and others added 9 commits October 21, 2022 10:12
The data fetcher tool operated assuming the key file presented on the
server contains only 1 key. However, several cloud providers use this
file to present multiple keys to the client systems at provisioning time
and this should be functional.

Without this change, only the first key will be properly inserted into
yaml, and all secondary keys will result in a yaml failure or be ignored
entirely. It would look something like this:

```
ssh_authorized_keys:
   - ssh-rsa <correct key 1>
ssh-rsa <this key 2 will be ignored>
ssh-rsa <this key 3 will be ignored>
```

The template is modified to allow line-by-line reading of the key file
from the server, and each line written will be prefixed with the yaml
"  - " entry prefix in the output file.

When writing the SSH keys to our generated cloud-config file, make sure
to follow with an extra line feed before we concatenate the user-data
contents. Otherwise, we could end up including the first line of the
user-data response in the authorized_keys file, e.g.
ssh-rsa <...key...> user@host#cloud-config
                             ^^^^^^^^^^^^^

Instead, worst case, /var/lib/cloud/<provider>-user-data might just have
an extra (ignored) blank line.
Instead of creating a unique service file for each provider, just use a
single instance service. We'll change the symlinks in packaging.
Some servers require the host name to be sent in the user-data API request.
We can allow a host name instead of IP address in the config struct by
doing a lookup if it's not an IP address already.
To provision on equinix we can grab the `keys` file from their
service. The address I entered in the template is tentative - it
needs to be checked that metadata.platformequinix.com resolves to that
address in their internal network as well that it's on a static IP
address and not some RR load balancer service - ideally.
Don't close the socket until we're done reading.
Make sure the socket fd/stream gets closed in all the error paths
preceding our close/fclose.
Also ensure the output file is closed properly in error cases.
Additional URI https://metadata.platformequinix.com/userdata

Also add missing users key in generated equinix conf
Our output for the equinix cloud config file omitted the "users:" key
prior to defining the user.
To improve package test capabilities, introduce a test target that will
attempt to fetch SSH keys and user data from a locally-spawned test
server. Add other bits in ucd-data-fetch.c to support testing.

Add fetch_test, which spawns an HTTP server to serve some sample
user-data and cloud-config files, and verify that ucd-data-fetch can
retrieve them.
In case networking takes as long as a minute to come up, give hostname
lookup up to 100 seconds to complete. Give initial HTTP request up to 120
seconds _from when we started_ to succeed, so even if we spent all our
time waiting on DNS, we still give 20 more seconds for the HTTP server.
@bwarden bwarden force-pushed the add-equinix-support branch from affc58c to 95ee67a Compare October 21, 2022 17:39
@bryteise bryteise merged commit 69103d6 into clearlinux:master Oct 21, 2022
@bwarden bwarden deleted the add-equinix-support branch November 4, 2022 16:50
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