[OpenStack] Support os-client-config usage for authentication

Update Gophercloud dependencies and also bring in the 'utils'
package.  This provides support for configuring access to OpenStack
clouds as detailed in the [official
documentation](https://docs.openstack.org/os-client-config/latest/user/configuration.html).

By relying on this package we can simplify the code required to
interact with OpenStack's APIs.  Support is also provided upstream for
self-signed and insecure SSL configurations.

Tested with a public cloud running OpenStack 'Rocky', the latest release.

Signed-off-by: Nick Jones <nick@dischord.org>
This commit is contained in:
Nick Jones
2019-01-19 23:07:21 +00:00
parent 668dc5a6ca
commit 10b2436eec
57 changed files with 4090 additions and 900 deletions

View File

@@ -11,17 +11,7 @@ Supported (tested) versions of the relevant OpenStack APIs are:
## Authentication
LinuxKit's support for OpenStack handles two ways of providing the endpoint and authentication details. You can either set the standard set of environment variables and the commands detailed below will inherit those, or you can explicitly provide them on the command-line as options to `push` and `run`. The examples below use the latter, but if you prefer the former then you'll need to set the following:
```shell
OS_USERNAME="admin"
OS_PASSWORD="xxx"
OS_TENANT_NAME="linuxkit"
OS_AUTH_URL="https://keystone.com:5000/v3"
OS_USER_DOMAIN_NAME=default
OS_CACERT=/path/to/cacert.pem
OS_INSECURE=false
```
LinuxKit's support for OpenStack includes configuring access to your cloud as detailed in the official [os-client-config](https://docs.openstack.org/os-client-config/latest/user/configuration.html) documentation.
## Push
@@ -40,32 +30,17 @@ Images generated with Moby can be uploaded into OpenStack's image service with `
```shell
./linuxkit push openstack \
-authurl=https://keystone.example.com:5000/v3 \
-username=admin \
-password=XXXXXXXXXXX \
-project=linuxkit \
-img-name=LinuxKitTest
./linuxkit.iso
```
If successful, this will return the image's UUID. If you've set your environment variables up as described above, this command can then be simplified:
```shell
./linuxkit push openstack \
-img-name "LinuxKitTest" \
~/Desktop/linuxkitmage.qcow2
```
## Run
Virtual machines can be launched using `linuxkit run openstack`. As an example:
```shell
linuxkit run openstack \
-authurl https://keystone.example.com:5000/v3 \
-username=admin \
-password=xxx \
-project=linuxkit \
-flavor=hotdog
-keyname=deadline_ed25519 \
-sec-groups=allow_ssh,nginx \
-network c5d02c5f-c625-4539-8aed-1dab3aa85a0a \