Refactor OpenStack push support to use Gophercloud

This commit refactors the OpenStack push support to make use of the
Gophercloud library in order to handle authentication and talking to the
right image service as defined in the service catalogue.

Signed-off-by: Nick Jones <nick@dischord.org>
This commit is contained in:
Nick Jones
2017-07-23 18:08:44 +01:00
parent b156663f12
commit 7c65860a5c
47 changed files with 5204 additions and 189 deletions

View File

@@ -1,16 +1,15 @@
# LinuxKit with OpenStack
LinuxKit interacts with OpenStack through its native APIs and requires access
to both an OpenStack Keystone server for authentication and a OpenStack Glance
server in order to host the LinuxKit images.
to both an OpenStack Keystone server for authentication and an OpenStack image
service (Glance) in order to host the LinuxKit images.
Supported (Tested) Versions:
Supported (tested) versions of the relevant OpenStack APIs:
- OpenStack Ocata Release
- Keystone v3 API
- Glance v2 API
- Keystone v3
- Glance v2
##Push
## Push
### Image types supported:
- **ami** (Amazon Machine image)
@@ -21,33 +20,27 @@ Supported (Tested) Versions:
- **qcow2** (Qemu disk image)
- **iso** (ISO9660 compatible CD-ROM image)
A compatible/supported image needs to have the correct extension (must match
A compatible image needs to have the correct extension (must match
one from above) in order to be supported by the `linuxkit push openstack`
command. The `openstack` backend will use the filename extension to determine
the image type, and use the filename as a label for the new image.
The `openstack` backend also supports OpenStack projects to provide
multi-tenancy support when uploading images.
### Usage
The `openstack` backend uses the password authentication method in order to
retrieve a token that can be used to interact with the various components of
OpenStack. The URLs for the Keystone/Glance server components need to have
the ports detailed as below.
OpenStack. Example usage:
```
./linuxkit push openstack \
-keystoneAddr=http://keystone.com:5000 \
-authurl=http://keystone.com:5000/v3 \
-username=admin \
-password=XXXXXXXXXXX \
-project=linuxkit \
-glanceAddr=http://glance.com:9292 \
./linuxkit.iso
```
### Execution Flow
1. Log in to OpenStack (Keystone)
2. Retrieve the OpenStack Key from the response header
3. Create a "queued" image on the glance server and return the new image ID
4. Use the new image ID and upload the LinuxKit image under this new ID
1. Authenticate with OpenStack's identity service
2. Create a "queued" image in Glance and retrieve its UUID
3. Use this new image ID to upload the LinuxKit image