kitchen-openstack 7.0.1 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +477 -81
- data/lib/kitchen/driver/openstack/clouds.rb +124 -23
- data/lib/kitchen/driver/openstack/config.rb +97 -30
- data/lib/kitchen/driver/openstack/helpers.rb +44 -5
- data/lib/kitchen/driver/openstack/networking.rb +127 -32
- data/lib/kitchen/driver/openstack/server_helper.rb +92 -20
- data/lib/kitchen/driver/openstack/volume.rb +121 -25
- data/lib/kitchen/driver/openstack.rb +99 -15
- data/lib/kitchen/driver/openstack_version.rb +7 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7e257b104097e32c3a10839a0b02a216db638aa1f6e122f587ec3b8a7329affc
|
|
4
|
+
data.tar.gz: d5f629ce9b2605d901e935423149717e40d16a5fdc24c26871f3b28ace3328e9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 849cc31b25a28c30d74b68a9955a1f0670a2fc93dac9920d95367ad91dc623a44cc0664afcae21ad9e377485964be9d510cc5aa95f9bfe19256dca2792f8fbb7
|
|
7
|
+
data.tar.gz: 96faf8a295e4deccfb72d203ccbe8ad8a2905f10f52b8cde76ab6969133c0d7e4d4ea6ee5ca3ee13f940d3177d1e248b9655d4bcb7a51c15441efe03cbc96588
|
data/README.md
CHANGED
|
@@ -1,121 +1,214 @@
|
|
|
1
|
-
#
|
|
1
|
+
# kitchen-openstack
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|

|
|
5
5
|
|
|
6
|
-
A Test Kitchen
|
|
6
|
+
A [Test Kitchen](https://kitchen.ci/) driver for OpenStack.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Test Kitchen builds a throwaway machine, converges your configuration code on
|
|
9
|
+
it, runs your tests, and destroys it. This driver makes that throwaway machine
|
|
10
|
+
a Nova instance in an OpenStack cloud, so you can test against the same
|
|
11
|
+
platform you deploy to.
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
Maintained by the [OSU Open Source Lab](https://osuosl.org/).
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
> This documentation uses [Cinc Workstation](https://cinc.sh/) and the `cinc`
|
|
16
|
+
> commands throughout. Everything here works identically with Chef Workstation —
|
|
17
|
+
> see [Using with Chef](#using-with-chef).
|
|
13
18
|
|
|
14
|
-
|
|
19
|
+
---
|
|
15
20
|
|
|
16
|
-
##
|
|
21
|
+
## Contents
|
|
22
|
+
|
|
23
|
+
- [Requirements](#requirements)
|
|
24
|
+
- [Installation](#installation)
|
|
25
|
+
- [Quick start](#quick-start)
|
|
26
|
+
- [Authentication](#authentication)
|
|
27
|
+
- [Configuration reference](#configuration-reference)
|
|
28
|
+
- [Common setups](#common-setups)
|
|
29
|
+
- [Troubleshooting](#troubleshooting)
|
|
30
|
+
- [Using with Chef](#using-with-chef)
|
|
31
|
+
- [Contributing](#contributing)
|
|
17
32
|
|
|
18
|
-
|
|
33
|
+
---
|
|
19
34
|
|
|
20
|
-
##
|
|
35
|
+
## Requirements
|
|
21
36
|
|
|
22
|
-
|
|
37
|
+
- Ruby 3.1 or newer
|
|
38
|
+
- Access to an OpenStack cloud, and credentials for it
|
|
39
|
+
- An SSH keypair uploaded to that cloud (Nova calls this a "keypair"; you
|
|
40
|
+
reference it by name as `key_name`)
|
|
23
41
|
|
|
24
|
-
|
|
42
|
+
There are no other system requirements. The driver talks to OpenStack over
|
|
43
|
+
HTTPS using the [fog-openstack](https://github.com/fog/fog-openstack) library.
|
|
25
44
|
|
|
26
|
-
|
|
45
|
+
## Installation
|
|
27
46
|
|
|
28
|
-
|
|
47
|
+
This driver ships with [Cinc
|
|
48
|
+
Workstation](https://cinc.sh/start/workstation/), which is the simplest way to
|
|
49
|
+
get Test Kitchen and its plugins in one package. It also ships with
|
|
50
|
+
[Chef Workstation](https://www.chef.io/downloads/tools/workstation).
|
|
51
|
+
|
|
52
|
+
To install it yourself, add it to your `Gemfile`:
|
|
29
53
|
|
|
30
54
|
```ruby
|
|
31
|
-
gem
|
|
55
|
+
gem "kitchen-openstack"
|
|
32
56
|
```
|
|
33
57
|
|
|
34
|
-
|
|
58
|
+
then `bundle install`. Or install the gem directly:
|
|
35
59
|
|
|
36
60
|
```bash
|
|
37
|
-
|
|
61
|
+
gem install kitchen-openstack
|
|
38
62
|
```
|
|
39
63
|
|
|
40
|
-
|
|
64
|
+
Confirm Test Kitchen can see it:
|
|
41
65
|
|
|
42
66
|
```bash
|
|
43
|
-
|
|
67
|
+
cinc kitchen driver discover | grep openstack
|
|
44
68
|
```
|
|
45
69
|
|
|
46
|
-
##
|
|
70
|
+
## Quick start
|
|
47
71
|
|
|
48
|
-
|
|
72
|
+
This walks from nothing to a running instance. It assumes you already have a
|
|
73
|
+
project with a `kitchen.yml`.
|
|
49
74
|
|
|
50
|
-
###
|
|
75
|
+
### 1. Get your credentials into your shell
|
|
51
76
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
already use, instead of duplicating them in `kitchen.yml`.
|
|
77
|
+
If you use the `openstack` CLI, you already have what you need. Most clouds
|
|
78
|
+
give you an `openrc` file to source, or a `clouds.yaml` in
|
|
79
|
+
`~/.config/openstack/`. Either works — this driver reads both, the same way
|
|
80
|
+
the CLI does:
|
|
57
81
|
|
|
58
|
-
|
|
82
|
+
```bash
|
|
83
|
+
source openrc.sh # sets OS_AUTH_URL, OS_USERNAME, OS_PASSWORD, ...
|
|
84
|
+
# or
|
|
85
|
+
export OS_CLOUD=mycloud # selects an entry from your existing clouds.yaml
|
|
86
|
+
```
|
|
59
87
|
|
|
60
|
-
|
|
61
|
-
2. `clouds_yaml_path` driver config option (if set)
|
|
62
|
-
3. Current directory (`./clouds.yaml`)
|
|
63
|
-
4. `~/.config/openstack/clouds.yaml`
|
|
64
|
-
5. `/etc/openstack/clouds.yaml`
|
|
88
|
+
Check that it works before involving Test Kitchen:
|
|
65
89
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
[standard convention](https://docs.openstack.org/openstacksdk/latest/user/config/configuration.html#splitting-secrets).
|
|
90
|
+
```bash
|
|
91
|
+
openstack server list
|
|
92
|
+
```
|
|
70
93
|
|
|
71
|
-
|
|
94
|
+
If that fails, fix it first. Test Kitchen will fail the same way, with less
|
|
95
|
+
helpful output.
|
|
72
96
|
|
|
73
|
-
|
|
97
|
+
### 2. Find an image and a flavor
|
|
74
98
|
|
|
75
|
-
|
|
76
|
-
|
|
99
|
+
You need to tell the driver what to boot and how big:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
openstack image list
|
|
103
|
+
openstack flavor list
|
|
104
|
+
openstack keypair list
|
|
105
|
+
```
|
|
77
106
|
|
|
78
|
-
|
|
107
|
+
### 3. Write your `kitchen.yml`
|
|
79
108
|
|
|
80
109
|
```yaml
|
|
110
|
+
---
|
|
81
111
|
driver:
|
|
82
112
|
name: openstack
|
|
83
|
-
|
|
84
|
-
image_ref: ubuntu-22.04
|
|
113
|
+
image_ref: ubuntu-24.04 # name, ID, or /regex/
|
|
85
114
|
flavor_ref: m1.small
|
|
86
|
-
key_name: my-keypair
|
|
115
|
+
key_name: my-keypair # a keypair already uploaded to OpenStack
|
|
116
|
+
|
|
117
|
+
transport:
|
|
118
|
+
username: ubuntu # the image's default login user
|
|
119
|
+
ssh_key: ~/.ssh/my-keypair # the *private* half of key_name
|
|
120
|
+
|
|
121
|
+
provisioner:
|
|
122
|
+
name: cinc_infra
|
|
123
|
+
|
|
124
|
+
verifier:
|
|
125
|
+
name: inspec
|
|
126
|
+
|
|
127
|
+
platforms:
|
|
128
|
+
- name: ubuntu-24.04
|
|
129
|
+
|
|
130
|
+
suites:
|
|
131
|
+
- name: default
|
|
87
132
|
```
|
|
88
133
|
|
|
89
|
-
|
|
134
|
+
Two things new users most often get wrong here:
|
|
135
|
+
|
|
136
|
+
- **`username` and `ssh_key` go under `transport:`, not `driver:`.** The driver
|
|
137
|
+
creates the machine; the transport logs into it. They are separate.
|
|
138
|
+
- **`key_name` is the name OpenStack knows; `ssh_key` is the private key file
|
|
139
|
+
on your disk.** They must be two halves of the same pair.
|
|
140
|
+
|
|
141
|
+
### 4. Run it
|
|
90
142
|
|
|
91
143
|
```bash
|
|
92
|
-
|
|
144
|
+
cinc kitchen create # boot the instance
|
|
145
|
+
cinc kitchen converge # apply your configuration code
|
|
146
|
+
cinc kitchen verify # run your tests
|
|
147
|
+
cinc kitchen destroy # tear it down
|
|
148
|
+
|
|
149
|
+
cinc kitchen test # all four, from scratch
|
|
93
150
|
```
|
|
94
151
|
|
|
152
|
+
`cinc kitchen list` shows the state of each suite. If something goes wrong, jump to
|
|
153
|
+
[Troubleshooting](#troubleshooting).
|
|
154
|
+
|
|
155
|
+
## Authentication
|
|
156
|
+
|
|
157
|
+
You can supply credentials three ways. You do not need to pick one globally —
|
|
158
|
+
they layer, and the precedence is fixed:
|
|
159
|
+
|
|
160
|
+
1. **`kitchen.yml`** — anything set explicitly here always wins
|
|
161
|
+
2. **`OS_*` environment variables** — override `clouds.yaml`
|
|
162
|
+
3. **`clouds.yaml`** (merged with `secure.yaml`) — the base
|
|
163
|
+
|
|
164
|
+
This is the order the upstream OpenStack SDK uses, so it should match what the
|
|
165
|
+
`openstack` CLI does.
|
|
166
|
+
|
|
167
|
+
### Using `clouds.yaml` (recommended)
|
|
168
|
+
|
|
169
|
+
OpenStack's standard
|
|
170
|
+
[`clouds.yaml`](https://docs.openstack.org/python-openstackclient/latest/configuration/index.html)
|
|
171
|
+
keeps credentials in one place shared by every OpenStack tool. If you have one,
|
|
172
|
+
use it — there is nothing to copy into `kitchen.yml`.
|
|
173
|
+
|
|
174
|
+
The driver searches these locations and uses the first file it finds:
|
|
175
|
+
|
|
176
|
+
1. `$OS_CLIENT_CONFIG_FILE`
|
|
177
|
+
2. the `clouds_yaml_path` driver option
|
|
178
|
+
3. `./clouds.yaml`
|
|
179
|
+
4. `~/.config/openstack/clouds.yaml`
|
|
180
|
+
5. `/etc/openstack/clouds.yaml`
|
|
181
|
+
|
|
182
|
+
A `secure.yaml` is searched for in the same locations — with
|
|
183
|
+
`$OS_CLIENT_SECURE_FILE` in place of `$OS_CLIENT_CONFIG_FILE` — and merged on
|
|
184
|
+
top, so you can keep secrets in a separate file following the [standard
|
|
185
|
+
convention](https://docs.openstack.org/openstacksdk/latest/user/config/configuration.html#splitting-secrets).
|
|
186
|
+
|
|
187
|
+
Select which cloud entry to use with either `OS_CLOUD` or the
|
|
188
|
+
`openstack_cloud` driver option:
|
|
189
|
+
|
|
95
190
|
```yaml
|
|
96
191
|
driver:
|
|
97
192
|
name: openstack
|
|
98
|
-
|
|
193
|
+
openstack_cloud: mycloud
|
|
194
|
+
image_ref: ubuntu-24.04
|
|
99
195
|
flavor_ref: m1.small
|
|
100
196
|
key_name: my-keypair
|
|
101
197
|
```
|
|
102
198
|
|
|
103
|
-
|
|
104
|
-
|
|
199
|
+
Because `kitchen.yml` wins, you can adopt a cloud entry and override one piece
|
|
200
|
+
of it:
|
|
105
201
|
|
|
106
202
|
```yaml
|
|
107
203
|
driver:
|
|
108
204
|
name: openstack
|
|
109
205
|
openstack_cloud: mycloud
|
|
110
|
-
openstack_region: RegionTwo
|
|
206
|
+
openstack_region: RegionTwo # everything else still comes from clouds.yaml
|
|
111
207
|
```
|
|
112
208
|
|
|
113
|
-
|
|
209
|
+
### Using `OS_*` environment variables
|
|
114
210
|
|
|
115
|
-
|
|
116
|
-
(e.g. from an `openrc` file). This means you can source your OpenStack
|
|
117
|
-
credentials and use them directly without any extra configuration in
|
|
118
|
-
`kitchen.yml`:
|
|
211
|
+
Sourcing an `openrc` file is enough on its own:
|
|
119
212
|
|
|
120
213
|
```bash
|
|
121
214
|
source openrc.sh
|
|
@@ -124,15 +217,16 @@ source openrc.sh
|
|
|
124
217
|
```yaml
|
|
125
218
|
driver:
|
|
126
219
|
name: openstack
|
|
127
|
-
image_ref: ubuntu-
|
|
220
|
+
image_ref: ubuntu-24.04
|
|
128
221
|
flavor_ref: m1.small
|
|
129
222
|
key_name: my-keypair
|
|
130
223
|
```
|
|
131
224
|
|
|
132
|
-
|
|
225
|
+
Recognized variables:
|
|
133
226
|
|
|
134
|
-
|
|
|
135
|
-
|
|
227
|
+
| Environment variable | Driver option |
|
|
228
|
+
| --- | --- |
|
|
229
|
+
| `OS_CLOUD` | `openstack_cloud` |
|
|
136
230
|
| `OS_AUTH_URL` | `openstack_auth_url` |
|
|
137
231
|
| `OS_USERNAME` | `openstack_username` |
|
|
138
232
|
| `OS_PASSWORD` | `openstack_api_key` |
|
|
@@ -151,38 +245,340 @@ The supported environment variables are:
|
|
|
151
245
|
| `OS_APPLICATION_CREDENTIAL_SECRET` | `openstack_application_credential_secret` |
|
|
152
246
|
| `OS_CACERT` | `ssl_ca_file` |
|
|
153
247
|
|
|
154
|
-
|
|
248
|
+
An exported-but-empty variable is ignored, so `OS_REGION_NAME=""` will not
|
|
249
|
+
shadow a region set in `clouds.yaml`.
|
|
250
|
+
|
|
251
|
+
### Putting credentials in `kitchen.yml`
|
|
252
|
+
|
|
253
|
+
Supported, but avoid committing secrets. Prefer reading them from the
|
|
254
|
+
environment:
|
|
255
|
+
|
|
256
|
+
```yaml
|
|
257
|
+
driver:
|
|
258
|
+
name: openstack
|
|
259
|
+
openstack_username: <%= ENV["OS_USERNAME"] %>
|
|
260
|
+
openstack_api_key: <%= ENV["OS_PASSWORD"] %>
|
|
261
|
+
openstack_auth_url: https://keystone.example.com:5000/v3
|
|
262
|
+
openstack_domain_id: default
|
|
263
|
+
openstack_project_name: my-project
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Application credentials
|
|
267
|
+
|
|
268
|
+
Preferred over a password where your cloud supports them:
|
|
155
269
|
|
|
156
|
-
|
|
270
|
+
```yaml
|
|
271
|
+
driver:
|
|
272
|
+
name: openstack
|
|
273
|
+
openstack_auth_url: https://keystone.example.com:5000/v3
|
|
274
|
+
openstack_application_credential_id: <%= ENV["OS_APPLICATION_CREDENTIAL_ID"] %>
|
|
275
|
+
openstack_application_credential_secret: <%= ENV["OS_APPLICATION_CREDENTIAL_SECRET"] %>
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Configuration reference
|
|
157
279
|
|
|
158
|
-
|
|
159
|
-
2. **`OS_*` env vars** — override `clouds.yaml` values
|
|
160
|
-
3. **`clouds.yaml`** (merged with `secure.yaml`) — base configuration
|
|
280
|
+
Everything below goes under `driver:` in `kitchen.yml`.
|
|
161
281
|
|
|
162
|
-
|
|
282
|
+
### Choosing what to boot
|
|
163
283
|
|
|
164
284
|
| Option | Default | Description |
|
|
165
|
-
|
|
166
|
-
| `
|
|
167
|
-
| `
|
|
285
|
+
| --- | --- | --- |
|
|
286
|
+
| `image_ref` | — | Image to boot, by name, ID, or `/regex/`. Mutually exclusive with `image_id`. |
|
|
287
|
+
| `image_id` | — | Image UUID, used verbatim with no lookup. |
|
|
288
|
+
| `flavor_ref` | — | Flavor, by name, ID, or `/regex/`. Mutually exclusive with `flavor_id`. |
|
|
289
|
+
| `flavor_id` | — | Flavor UUID, used verbatim with no lookup. |
|
|
290
|
+
| `key_name` | `nil` | Name of an SSH keypair already uploaded to OpenStack. |
|
|
291
|
+
| `availability_zone` | `nil` | Availability zone to boot into. |
|
|
292
|
+
| `security_groups` | `nil` | List of security group names. **Must be a list**, even for one group. |
|
|
293
|
+
| `metadata` | `nil` | Hash of Nova instance metadata. |
|
|
294
|
+
|
|
295
|
+
Set exactly one of `image_ref`/`image_id`, and exactly one of
|
|
296
|
+
`flavor_ref`/`flavor_id`. Setting both members of a pair is an error.
|
|
297
|
+
|
|
298
|
+
The `_ref` options accept three forms:
|
|
299
|
+
|
|
300
|
+
```yaml
|
|
301
|
+
image_ref: 8a8c0f4d-... # exact ID (checked first)
|
|
302
|
+
image_ref: ubuntu-24.04 # exact name
|
|
303
|
+
image_ref: /^ubuntu-24\.04/ # regex, first match wins
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Naming the instance
|
|
307
|
+
|
|
308
|
+
| Option | Default | Description |
|
|
309
|
+
| --- | --- | --- |
|
|
310
|
+
| `server_name` | generated | Exact instance name. Overrides everything below. |
|
|
311
|
+
| `server_name_prefix` | `nil` | Prefix, plus a random 8-character suffix. |
|
|
312
|
+
|
|
313
|
+
With neither set, the name is `<suite-platform>-<user>-<host>-<random>`,
|
|
314
|
+
truncated to OpenStack's 63-character limit. Non-word characters are stripped.
|
|
315
|
+
|
|
316
|
+
### Networking
|
|
317
|
+
|
|
318
|
+
| Option | Default | Description |
|
|
319
|
+
| --- | --- | --- |
|
|
320
|
+
| `network_ref` | `nil` | Network(s) to attach, by name, ID, or `/regex/`. A string or a list. Mutually exclusive with `network_id`. |
|
|
321
|
+
| `network_id` | `nil` | Network UUID(s), used verbatim. A string or a list. |
|
|
322
|
+
| `openstack_network_name` | `nil` | Which network's address Test Kitchen should connect to. |
|
|
323
|
+
| `floating_ip` | `nil` | A specific floating IP to attach. |
|
|
324
|
+
| `floating_ip_pool` | `nil` | Pool (external network) to take a floating IP from. |
|
|
325
|
+
| `allocate_floating_ip` | `false` | Allocate a *new* floating IP rather than reusing a free one. Released on `destroy`. |
|
|
326
|
+
| `public_ip_order` | `0` | Index into the public addresses when several exist. |
|
|
327
|
+
| `private_ip_order` | `0` | Index into the private addresses when several exist. |
|
|
328
|
+
| `use_ipv6` | `false` | Connect over IPv6 instead of IPv4. |
|
|
329
|
+
|
|
330
|
+
Address selection, in order: `floating_ip` if set, then
|
|
331
|
+
`openstack_network_name` if set, then the public addresses at
|
|
332
|
+
`public_ip_order`, then the private addresses at `private_ip_order`.
|
|
333
|
+
|
|
334
|
+
### Storage
|
|
335
|
+
|
|
336
|
+
| Option | Default | Description |
|
|
337
|
+
| --- | --- | --- |
|
|
338
|
+
| `block_device_mapping` | `nil` | Boot from, or attach, a Cinder volume. See [below](#booting-from-a-volume). |
|
|
339
|
+
|
|
340
|
+
### Instance customization
|
|
341
|
+
|
|
342
|
+
| Option | Default | Description |
|
|
343
|
+
| --- | --- | --- |
|
|
344
|
+
| `user_data` | `nil` | Path to a cloud-init file. **Must exist**, or `create` fails. |
|
|
345
|
+
| `cloud_config` | `nil` | Inline cloud-config as YAML, rendered for you. Mutually exclusive with `user_data`. |
|
|
346
|
+
| `config_drive` | `nil` | Attach a config drive. |
|
|
347
|
+
|
|
348
|
+
### Connection and timeouts
|
|
349
|
+
|
|
350
|
+
| Option | Default | Description |
|
|
351
|
+
| --- | --- | --- |
|
|
352
|
+
| `connect_timeout` | `60` | Seconds to wait establishing an API connection. |
|
|
353
|
+
| `read_timeout` | `60` | Seconds to wait reading an API response. |
|
|
354
|
+
| `write_timeout` | `60` | Seconds to wait writing an API request. |
|
|
355
|
+
| `glance_cache_wait_timeout` | `600` | Seconds to wait for the instance to reach `ACTIVE`. Raise it if your cloud caches images slowly on first boot. |
|
|
356
|
+
| `server_wait` | `nil` | Extra seconds to sleep after boot before trying SSH. A blunt instrument; try it if your instances need a moment before accepting connections. |
|
|
357
|
+
| `disable_ssl_validation` | `false` | Skip TLS verification. Prefer `ssl_ca_file`. |
|
|
358
|
+
| `ssl_ca_file` | `nil` | Path to a CA bundle, passed to the HTTP connection. Set by `OS_CACERT` or a `cacert` entry in `clouds.yaml`. |
|
|
359
|
+
|
|
360
|
+
### Credentials and endpoints
|
|
361
|
+
|
|
362
|
+
| Option | Default | Description |
|
|
363
|
+
| --- | --- | --- |
|
|
364
|
+
| `openstack_cloud` | `nil` | Cloud entry to read from `clouds.yaml`. Falls back to `OS_CLOUD`. |
|
|
365
|
+
| `clouds_yaml_path` | `nil` | Explicit `clouds.yaml` path, inserted into the search path. |
|
|
366
|
+
| `openstack_auth_url` | `nil` | Keystone endpoint. |
|
|
367
|
+
| `openstack_username` | `nil` | Username. |
|
|
368
|
+
| `openstack_api_key` | `nil` | Password. |
|
|
369
|
+
| `openstack_project_name` | `nil` | Project (tenant) name. |
|
|
370
|
+
| `openstack_project_id` | `nil` | Project ID. |
|
|
371
|
+
| `openstack_domain_id` | `nil` | Domain ID. Usually `default`. |
|
|
372
|
+
| `openstack_domain_name` | `nil` | Domain name. |
|
|
373
|
+
| `openstack_user_domain` | `nil` | User domain name. |
|
|
374
|
+
| `openstack_user_domain_id` | `nil` | User domain ID. |
|
|
375
|
+
| `openstack_project_domain` | `nil` | Project domain name. |
|
|
376
|
+
| `openstack_project_domain_id` | `nil` | Project domain ID. |
|
|
377
|
+
| `openstack_region` | `nil` | Region name. |
|
|
378
|
+
| `openstack_endpoint_type` | `nil` | Endpoint interface: `public`, `internal`, or `admin`. |
|
|
379
|
+
| `openstack_identity_api_version` | `nil` | Keystone API version. |
|
|
380
|
+
| `openstack_service_name` | `nil` | Compute service name. |
|
|
381
|
+
| `openstack_application_credential_id` | `nil` | Application credential ID. |
|
|
382
|
+
| `openstack_application_credential_secret` | `nil` | Application credential secret. |
|
|
383
|
+
| `openstack_tenant` | `nil` | Tenant name. The Keystone v2 name for a project; use `openstack_project_name` on v3. |
|
|
384
|
+
| `openstack_tenant_id` | `nil` | Tenant ID. The Keystone v2 name for a project ID. |
|
|
385
|
+
| `openstack_service_type` | `nil` | Compute service type to look up in the catalog. |
|
|
386
|
+
|
|
387
|
+
Any other `openstack_*` option that fog-openstack recognizes is forwarded as
|
|
388
|
+
well, including `openstack_auth_token`, `openstack_identity_endpoint`,
|
|
389
|
+
`openstack_management_url`, and `openstack_cache_ttl`. To see the full list
|
|
390
|
+
your installed version supports:
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
ruby -r fog/openstack -e 'puts Fog::OpenStack::Compute.recognized.grep(/^openstack/).sort'
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Settings that are not driver options
|
|
397
|
+
|
|
398
|
+
Commonly mistaken for driver options:
|
|
399
|
+
|
|
400
|
+
- **`username`, `ssh_key`, `port`, `connection_timeout`** belong under
|
|
401
|
+
`transport:`. The driver builds the instance; the transport connects to it.
|
|
402
|
+
- **`no_ssh_tcp_check` and `no_ssh_tcp_check_sleep`** are accepted but have no
|
|
403
|
+
effect. They are leftovers from an earlier version and are not read anywhere
|
|
404
|
+
in the driver.
|
|
405
|
+
- **`pre_create_command`** is declared by Test Kitchen's base driver, but this
|
|
406
|
+
driver overrides `create` without invoking it, so setting it does nothing
|
|
407
|
+
here.
|
|
408
|
+
|
|
409
|
+
## Common setups
|
|
410
|
+
|
|
411
|
+
### Attaching a floating IP
|
|
412
|
+
|
|
413
|
+
Reuse an already-allocated but unattached address from a pool:
|
|
414
|
+
|
|
415
|
+
```yaml
|
|
416
|
+
driver:
|
|
417
|
+
name: openstack
|
|
418
|
+
floating_ip_pool: public
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
Or allocate a fresh one, which is released again on `kitchen destroy`:
|
|
422
|
+
|
|
423
|
+
```yaml
|
|
424
|
+
driver:
|
|
425
|
+
name: openstack
|
|
426
|
+
floating_ip_pool: public
|
|
427
|
+
allocate_floating_ip: true
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
Or pin a specific address:
|
|
431
|
+
|
|
432
|
+
```yaml
|
|
433
|
+
driver:
|
|
434
|
+
name: openstack
|
|
435
|
+
floating_ip: 203.0.113.10
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
### Choosing a network
|
|
439
|
+
|
|
440
|
+
```yaml
|
|
441
|
+
driver:
|
|
442
|
+
name: openstack
|
|
443
|
+
network_ref: my-private-net # name, ID, or /regex/
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
Attach several:
|
|
447
|
+
|
|
448
|
+
```yaml
|
|
449
|
+
driver:
|
|
450
|
+
name: openstack
|
|
451
|
+
network_ref:
|
|
452
|
+
- my-private-net
|
|
453
|
+
- my-storage-net
|
|
454
|
+
openstack_network_name: my-private-net # which one to connect over
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
### Running cloud-init
|
|
458
|
+
|
|
459
|
+
Inline, which is usually easier to read:
|
|
460
|
+
|
|
461
|
+
```yaml
|
|
462
|
+
driver:
|
|
463
|
+
name: openstack
|
|
464
|
+
cloud_config:
|
|
465
|
+
packages:
|
|
466
|
+
- htop
|
|
467
|
+
runcmd:
|
|
468
|
+
- [systemctl, restart, sshd]
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
Or from a file, which must exist:
|
|
472
|
+
|
|
473
|
+
```yaml
|
|
474
|
+
driver:
|
|
475
|
+
name: openstack
|
|
476
|
+
user_data: files/cloud-init.yml
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
### Booting from a volume
|
|
480
|
+
|
|
481
|
+
```yaml
|
|
482
|
+
driver:
|
|
483
|
+
name: openstack
|
|
484
|
+
block_device_mapping:
|
|
485
|
+
make_volume: true
|
|
486
|
+
volume_size: 20
|
|
487
|
+
device_name: vda
|
|
488
|
+
delete_on_termination: true
|
|
489
|
+
creation_timeout: 60 # seconds to wait for the volume to be available
|
|
490
|
+
attach_timeout: 5 # extra seconds before attaching
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
`make_volume: true` creates a new volume; source it from `snapshot_id`,
|
|
494
|
+
`imageRef`, or `source_volid`. To attach a volume you already have, drop
|
|
495
|
+
`make_volume` and give `volume_id`.
|
|
496
|
+
|
|
497
|
+
### A cloud with a private CA
|
|
498
|
+
|
|
499
|
+
Point at your CA bundle rather than turning verification off:
|
|
500
|
+
|
|
501
|
+
```bash
|
|
502
|
+
export OS_CACERT=/etc/ssl/certs/my-ca.pem
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
or in `clouds.yaml`:
|
|
506
|
+
|
|
507
|
+
```yaml
|
|
508
|
+
clouds:
|
|
509
|
+
mycloud:
|
|
510
|
+
cacert: /etc/ssl/certs/my-ca.pem
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
Either is passed through to the HTTP connection. `verify: false` in
|
|
514
|
+
`clouds.yaml` disables verification entirely, equivalent to setting
|
|
515
|
+
`disable_ssl_validation: true`.
|
|
516
|
+
|
|
517
|
+
## Troubleshooting
|
|
518
|
+
|
|
519
|
+
Start with `kitchen diagnose`, which prints the fully resolved driver config
|
|
520
|
+
after `clouds.yaml` and `OS_*` have been merged in. If a credential is not
|
|
521
|
+
there, the driver never saw it.
|
|
522
|
+
|
|
523
|
+
```bash
|
|
524
|
+
kitchen diagnose --all
|
|
525
|
+
kitchen create --log-level=debug
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
| Symptom | Likely cause |
|
|
529
|
+
| --- | --- |
|
|
530
|
+
| `Image not found` / `Flavor not found` | The `_ref` matched nothing. Check `openstack image list`. A `/regex/` needs the surrounding slashes. |
|
|
531
|
+
| `Cannot specify both image_ref and image_id` | Set one, not both. Same for flavor and network. |
|
|
532
|
+
| `Could not find an IP` | The instance has no address of the family you asked for. Check `use_ipv6`, and whether you need a floating IP. |
|
|
533
|
+
| `Server is not attached to network <name>` | `openstack_network_name` does not match any network on the instance. |
|
|
534
|
+
| `Floating IP pool <name> not found` | The pool name is wrong; it is the external *network* name. |
|
|
535
|
+
| `No available IPs in pool <name>` | Every address is in use. Set `allocate_floating_ip: true` to make a new one. |
|
|
536
|
+
| `The user_data file <path> does not exist` | The path is wrong. It is resolved relative to where you run `kitchen`. |
|
|
537
|
+
| `The security_groups config must be an array` | Use a list, even for a single group. |
|
|
538
|
+
| Hangs at "Waiting for server to be ready" | The instance booted but SSH is unreachable. Check the security group allows port 22, that a floating IP is attached if you need one, and that `transport: username:` matches the image's default user. |
|
|
539
|
+
| Times out reaching `ACTIVE` | Raise `glance_cache_wait_timeout`. First boot of a large image can be slow. |
|
|
540
|
+
| TLS errors | Set `ssl_ca_file` (or `OS_CACERT`) to your CA bundle. |
|
|
541
|
+
|
|
542
|
+
The instance is destroyed automatically if it never becomes reachable, so a
|
|
543
|
+
failed `kitchen create` should not leak a server. If one does leak, `kitchen
|
|
544
|
+
destroy` or `openstack server delete` will clear it.
|
|
545
|
+
|
|
546
|
+
## Using with Chef
|
|
547
|
+
|
|
548
|
+
This driver is not tied to Cinc. The examples above use Cinc Workstation and the
|
|
549
|
+
`cinc_infra` provisioner, but the driver works exactly the same with
|
|
550
|
+
[Chef Workstation](https://www.chef.io/downloads/tools/workstation) — run
|
|
551
|
+
`kitchen` instead of `cinc kitchen`, and use `chef_infra` instead of
|
|
552
|
+
`cinc_infra`:
|
|
553
|
+
|
|
554
|
+
```yaml
|
|
555
|
+
provisioner:
|
|
556
|
+
name: chef_infra
|
|
557
|
+
|
|
558
|
+
verifier:
|
|
559
|
+
name: inspec
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
No driver configuration changes are needed.
|
|
563
|
+
|
|
564
|
+
## Contributing
|
|
168
565
|
|
|
169
|
-
|
|
566
|
+
Pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for
|
|
567
|
+
development setup, how to run the tests, how the suite is built, and the
|
|
568
|
+
release process.
|
|
170
569
|
|
|
171
|
-
|
|
172
|
-
Ideally create a topic branch for every separate change you make. For
|
|
173
|
-
example:
|
|
570
|
+
## Credits
|
|
174
571
|
|
|
175
|
-
|
|
176
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
177
|
-
3. Run the tests and rubocop, `bundle exec rake spec` and `bundle exec rake rubocop`
|
|
178
|
-
4. Commit your changes (`git commit -am 'Added some feature'`)
|
|
179
|
-
5. Push to the branch (`git push origin my-new-feature`)
|
|
180
|
-
6. Create new Pull Request
|
|
572
|
+
Originally created by Jonathan Hartman.
|
|
181
573
|
|
|
182
|
-
|
|
574
|
+
Structure borrowed from [Fletcher Nichol](https://github.com/fnichol)'s
|
|
575
|
+
[kitchen-ec2](https://github.com/test-kitchen/kitchen-ec2) and [Adam
|
|
576
|
+
Leff](https://github.com/adamleff)'s
|
|
577
|
+
[kitchen-vro](https://github.com/chef-partners/kitchen-vro).
|
|
183
578
|
|
|
184
|
-
|
|
579
|
+
Further reference documentation is at
|
|
580
|
+
<https://kitchen.ci/docs/drivers/openstack/>.
|
|
185
581
|
|
|
186
582
|
## License
|
|
187
583
|
|
|
188
|
-
Apache 2.0
|
|
584
|
+
Apache 2.0. See [LICENSE.txt](LICENSE.txt).
|