kitchen-rackspace 0.21.2 → 0.22.1

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.
data/README.md CHANGED
@@ -1,95 +1,364 @@
1
- # Kitchen::Rackspace
1
+ # kitchen-rackspace
2
2
 
3
- [![Gem Version](https://img.shields.io/gem/v/kitchen-rackspace.svg)][gem]
3
+ [![Gem Version](https://img.shields.io/gem/v/kitchen-rackspace.svg)](https://rubygems.org/gems/kitchen-rackspace)
4
4
 
5
- [gem]: https://rubygems.org/gems/kitchen-rackspace
5
+ A [Test Kitchen](https://kitchen.ci/) driver that creates and destroys [Rackspace Cloud Servers](https://www.rackspace.com/cloud/servers), so you can test your cookbooks and infrastructure code on Rackspace instances.
6
6
 
7
- A Rackspace Cloud Servers driver for Test Kitchen!
7
+ > **This project is no longer under active development.** It has no active
8
+ > maintainers. The driver may continue to work for some or all use cases, but
9
+ > issues filed on GitHub will most likely not be triaged. If you are interested
10
+ > in maintaining it, come and talk to us in `#test-kitchen` on
11
+ > [Chef Community Slack](https://community-slack.chef.io/).
8
12
 
9
- Shamelessly copied from [Fletcher Nichol](https://github.com/fnichol)'s
10
- awesome work on an [EC2 driver](https://github.com/opscode/kitchen-ec2).
13
+ <!-- -->
11
14
 
12
- ## Status
15
+ > **This driver targets Legacy Rackspace Cloud, not OpenStack Flex.** It
16
+ > authenticates against Rackspace Cloud Identity v2.0, which is the API of the
17
+ > original Rackspace Public Cloud.
18
+ >
19
+ > In 2025 Rackspace launched [Rackspace OpenStack Flex][flex] — now branded
20
+ > simply "Rackspace Cloud" — built on vanilla OpenStack with Keystone v3. That
21
+ > platform is **not** supported by this driver. Use
22
+ > [kitchen-openstack][kitchen-openstack] instead, with `openstack_auth_url` set
23
+ > to `https://keystone.api.<region>.rackspacecloud.com/v3` (regions include
24
+ > `sjc3`, `iad3`, and `dfw3`).
25
+ >
26
+ > Rackspace continues to operate and maintain the legacy platform, so this
27
+ > driver still works against it, but Rackspace has said that new development is
28
+ > focused on Flex.
13
29
 
14
- This software project is no longer under active development as it has no active maintainers. The software may continue to work for some or all use cases, but issues filed in GitHub will most likely not be triaged. If a new maintainer is interested in working on this project please come chat with us in #test-kitchen on Chef Community Slack.
30
+ [flex]: https://docs.rackspace.com/docs/rackspace-openstack-flex-vs-rackspace-cloud
31
+ [kitchen-openstack]: https://github.com/test-kitchen/kitchen-openstack
32
+
33
+ <!-- -->
34
+
35
+ > This documentation uses [Cinc Workstation](https://cinc.sh/) and the `cinc` commands throughout. Everything here works identically with Chef Workstation — see [Using with Chef](#using-with-chef).
36
+
37
+ ## Requirements
38
+
39
+ - Ruby 3.1 or later (already satisfied if you use Cinc Workstation)
40
+ - A Rackspace Cloud account, with its username and API key
41
+ - An SSH public key, used to grant access to the created server
15
42
 
16
43
  ## Installation
17
44
 
18
- Add this line to your application's Gemfile:
45
+ This driver ships as part of [Cinc Workstation](https://cinc.sh/start/workstation/). If you have Cinc Workstation installed, there is nothing else to install.
19
46
 
20
- ```ruby
21
- gem 'kitchen-rackspace'
47
+ To install it into a standalone Ruby:
48
+
49
+ ```sh
50
+ gem install kitchen-rackspace
22
51
  ```
23
52
 
24
- And then execute:
53
+ Or with Bundler, add it to your `Gemfile`:
25
54
 
26
- ```shell
27
- bundle
55
+ ```ruby
56
+ gem "kitchen-rackspace"
28
57
  ```
29
58
 
30
- Or install it yourself as:
59
+ ...then run `bundle install`.
31
60
 
32
- ```shell
33
- gem install kitchen-rackspace
61
+ ## Authentication
62
+
63
+ Credentials come from either the driver options or the environment. The
64
+ environment is preferred, so credentials stay out of `kitchen.yml`:
65
+
66
+ ```sh
67
+ export RACKSPACE_USERNAME="myuser" # or OS_USERNAME
68
+ export RACKSPACE_API_KEY="myapikey" # or OS_PASSWORD
69
+ export RACKSPACE_REGION="dfw" # or OS_REGION_NAME
34
70
  ```
35
71
 
36
- ## Usage
72
+ If `RACKSPACE_REGION` is unset, the driver defaults to `dfw`.
37
73
 
38
- Provide, at a minimum, the required driver options in your `.kitchen.yml` file:
74
+ ## Quick Start
39
75
 
40
76
  ```yaml
77
+ ---
41
78
  driver:
42
79
  name: rackspace
43
- rackspace_username: [YOUR RACKSPACE CLOUD USERNAME]
44
- rackspace_api_key: [YOUR RACKSPACE CLOUD API KEY]
45
- require_chef_omnibus: [e.g. 'true' or a version number if you need Chef]
80
+ image_id: 09de0a66-3156-48b4-90a5-1cf25a905207 # see Choosing an image
81
+
82
+ provisioner:
83
+ name: cinc_infra
84
+
85
+ verifier:
86
+ name: cinc_auditor
87
+
46
88
  platforms:
47
- - name: [A PLATFORM NAME, e.g. 'centos-6']
89
+ - name: ubuntu-22.04
90
+
91
+ suites:
92
+ - name: default
93
+ run_list:
94
+ - recipe[my_cookbook::default]
95
+ ```
96
+
97
+ With credentials in the environment, that is enough: the driver builds the
98
+ image you named on a 2 GB General Purpose flavor, using an SSH key from your
99
+ `~/.ssh` directory.
100
+
101
+ > **Set `image_id` yourself.** The driver ships a table that maps platform
102
+ > names like `ubuntu-22.04` to image IDs, but it has not been refreshed since
103
+ > 2016, so most modern platform names are not in it and the build fails with
104
+ > `image_id` missing. See [Choosing an image](#choosing-an-image).
105
+
106
+ Then run the full test cycle:
107
+
108
+ ```sh
109
+ cinc kitchen test
110
+ ```
111
+
112
+ Or step through it:
113
+
114
+ ```sh
115
+ cinc kitchen create # build the Rackspace server
116
+ cinc kitchen converge # apply your cookbook
117
+ cinc kitchen verify # run your tests
118
+ cinc kitchen destroy # delete the server
119
+ ```
120
+
121
+ ## Choosing an image
122
+
123
+ `image_id` is a Rackspace image UUID, and it is the one option most people have
124
+ to set by hand.
125
+
126
+ The driver ships `data/images.json`, a table mapping Test Kitchen platform
127
+ names to image IDs so that a platform like `centos-7` resolves on its own.
128
+ **That table was last generated in 2016.** Its newest entries are Ubuntu 16.04,
129
+ CentOS 7, Debian 8, and Fedora 25. A modern platform name is not in it:
130
+
131
+ | Platform name | Resolves? |
132
+ | --- | --- |
133
+ | `ubuntu-16.04`, `centos-7`, `debian-8` | yes, to a 2016-era image |
134
+ | `ubuntu` (bare distro name) | yes, to Ubuntu 16.04 |
135
+ | `ubuntu-22.04`, `ubuntu-24.04`, `debian-12`, `rocky-9` | **no** |
136
+
137
+ When the platform name is not in the table, `image_id` has no default and
138
+ Test Kitchen fails validation. Set it explicitly.
139
+
140
+ ### Finding an image ID
141
+
142
+ Image IDs differ per region, so look them up in the region you build in:
143
+
144
+ ```sh
145
+ export RACKSPACE_USERNAME="myuser"
146
+ export RACKSPACE_API_KEY="myapikey"
147
+ export RACKSPACE_REGION="ord"
148
+
149
+ bundle exec ruby helpers/dump_image_list.rb
48
150
  ```
49
151
 
50
- By default, the driver will spawn a 1GB Performance server on the base image
51
- for your specified platform. Additional, optional overrides can be provided:
152
+ That prints every image the account can see, with its ID and the platform names
153
+ it would answer to. Copy the ID you want into `image_id`.
154
+
155
+ Refreshing the bundled table is contributor work — see
156
+ [Maintaining the bundled data](CONTRIBUTING.md#maintaining-the-bundled-data).
157
+
158
+ ## Choosing a flavor
159
+
160
+ `flavor_id` selects CPU, memory, and disk. The default is `general1-2`.
161
+
162
+ ### General Purpose v1
163
+
164
+ The right class for almost every test workload:
165
+
166
+ | Flavor | RAM | vCPUs | Disk |
167
+ | --- | --- | --- | --- |
168
+ | `general1-1` | 1 GB | 1 | 20 GB |
169
+ | `general1-2` *(default)* | 2 GB | 2 | 40 GB |
170
+ | `general1-4` | 4 GB | 4 | 80 GB |
171
+ | `general1-8` | 8 GB | 8 | 160 GB |
172
+
173
+ ### Other current classes
174
+
175
+ | Class | Flavors | Shape |
176
+ | --- | --- | --- |
177
+ | I/O v1 | `io1-15`, `io1-30`, `io1-60`, `io1-90`, `io1-120` | 15–120 GB RAM, 4–32 vCPUs, 40 GB SSD |
178
+ | Compute v1 | `compute1-4`, `compute1-8`, `compute1-15`, `compute1-30`, `compute1-60` | CPU-weighted, no local data disk |
179
+ | Memory v1 | `memory1-15`, `memory1-30`, `memory1-60`, `memory1-120`, `memory1-240` | RAM-weighted, no local data disk |
180
+ | OnMetal | `onmetal-compute1`, `onmetal-io1`, `onmetal-memory1` | Single-tenant bare metal |
181
+
182
+ Compute v1 and Memory v1 flavors have no local data disk, so they need a Cloud
183
+ Block Storage volume to boot from. That is outside what this driver sets up.
184
+
185
+ ### Retired classes
186
+
187
+ Do not use these. Rackspace removed them from the Control Panel and has said
188
+ they will be discontinued; some are still visible in the API.
189
+
190
+ | Class | Flavors | Replaced by |
191
+ | --- | --- | --- |
192
+ | Standard | numeric IDs `2` through `8` | General Purpose v1 |
193
+ | Performance 1 | `performance1-1`, `performance1-2`, `performance1-4`, `performance1-8` | General Purpose v1 |
194
+ | Performance 2 | `performance2-15` … `performance2-120` | I/O v1 |
195
+
196
+ ### Listing what your account offers
197
+
198
+ Flavor availability varies by account and region:
199
+
200
+ ```sh
201
+ bundle exec ruby helpers/dump_flavor_list.rb
202
+ ```
203
+
204
+ ## Configuration
205
+
206
+ All options below are set under the `driver:` key in `kitchen.yml`.
207
+
208
+ ### Credentials
209
+
210
+ | Option | Default | Description |
211
+ | --- | --- | --- |
212
+ | `rackspace_username` | `$RACKSPACE_USERNAME`, else `$OS_USERNAME` | Rackspace Cloud username. Required, from here or the environment. |
213
+ | `rackspace_api_key` | `$RACKSPACE_API_KEY`, else `$OS_PASSWORD` | Rackspace Cloud API key. Required, from here or the environment. |
214
+ | `rackspace_region` | `$RACKSPACE_REGION`, else `$OS_REGION_NAME`, else `"dfw"` | Region to build in, e.g. `dfw`, `ord`, `iad`, `lon`, `syd`, `hkg`. |
215
+ | `version` | `"v2"` | Rackspace Cloud Servers API version. |
216
+
217
+ ### Server
218
+
219
+ | Option | Default | Description |
220
+ | --- | --- | --- |
221
+ | `image_id` | *looked up from the platform name* | Image UUID to build from. The bundled lookup table is stale, so in practice set this yourself — see [Choosing an image](#choosing-an-image). |
222
+ | `flavor_id` | `"general1-2"` | Flavor, which determines CPU, memory, and disk — see [Choosing a flavor](#choosing-a-flavor). |
223
+ | `server_name` | *generated* | Name for the server. If unset, a unique name of at most 63 characters is generated from the base name, your username, the hostname, and a random string. |
224
+ | `user_data` | `nil` | Extra configuration data passed to the server at build time. |
225
+ | `config_drive` | `true` | Attach the read-only metadata config drive. |
226
+ | `no_passwd_lock` | `false` | Do not let the underlying fog library lock the root account. Forced on when `rackconnect_wait` or `servicelevel_wait` is set — see [Networking](#networking). |
227
+
228
+ ### Networking
229
+
230
+ | Option | Default | Description |
231
+ | --- | --- | --- |
232
+ | `networks` | *PublicNet and ServiceNet* | **Additional** Rackspace network UUIDs to attach. PublicNet and ServiceNet are always attached too — see below. |
233
+ | `servicenet` | `false` | Connect over the ServiceNet address rather than the public one. |
234
+ | `rackconnect_wait` | `false` | Wait for RackConnect to finish before continuing. Enable this if the account uses RackConnect. Forces `no_passwd_lock` on. |
235
+ | `servicelevel_wait` | `false` | Wait for Managed Service Level automation to finish before continuing. Forces `no_passwd_lock` on. |
236
+
237
+ `networks` adds to the standard networks rather than replacing them. Whatever
238
+ you list, the driver puts Rackspace's PublicNet
239
+ (`00000000-0000-0000-0000-000000000000`) and ServiceNet
240
+ (`11111111-1111-1111-1111-111111111111`) at the front of the list first, so
241
+ there is no way to build a server without a public interface. Do not list
242
+ either of those UUIDs yourself — you will just send Rackspace a duplicate.
243
+
244
+ `rackconnect_wait` and `servicelevel_wait` both turn `no_passwd_lock` on
245
+ regardless of how you set it, because RackConnect and Managed Service Level
246
+ each log in as root to do their work and a locked root account leaves them
247
+ stuck.
248
+
249
+ ### SSH
250
+
251
+ | Option | Default | Description |
252
+ | --- | --- | --- |
253
+ | `public_key_path` | first key found in `~/.ssh` | Path to the SSH public key installed on the server. Searched in order: `id_rsa.pub`, `id_dsa.pub`, `identity.pub`, `id_ecdsa.pub`. |
254
+ | `username` | `"root"` | User to connect as. |
255
+ | `port` | `"22"` | SSH port. |
256
+
257
+ ### Waiting
258
+
259
+ | Option | Default | Description |
260
+ | --- | --- | --- |
261
+ | `wait_for` | `600` | Seconds any single wait may take before timing out. This is fog's global timeout, so it applies to the build wait and to the `rackconnect_wait` and `servicelevel_wait` polls individually, not to `kitchen create` as a whole. |
262
+ | `no_ssh_tcp_check` | `false` | Skip the TCP check on the SSH port. Use when a firewall makes the check unreliable. |
263
+ | `no_ssh_tcp_check_sleep` | `120` | Seconds to sleep instead of checking, when `no_ssh_tcp_check` is enabled. |
264
+
265
+ ## Examples
266
+
267
+ ### A bigger instance in a specific region
52
268
 
53
269
  ```yaml
54
- image_id: [SERVER IMAGE ID]
55
- flavor_id: [SERVER FLAVOR ID]
56
- server_name: [A FRIENDLY SERVER NAME]
57
- public_key_path: [PATH TO YOUR PUBLIC SSH KEY]
58
- rackspace_region: [A VALID RACKSPACE DC/REGION]
59
- wait_for: [NUM OF SECONDS TO WAIT BEFORE TIMING OUT, DEFAULT 600]
60
- no_ssh_tcp_check: [DEFAULTS TO false, SKIPS TCP CHECK WHEN true]
61
- no_ssh_tcp_check_sleep: [NUM OF SECONDS TO SLEEP IF no_ssh_tcp_check IS SET]
62
- networks: [LIST OF RACKSPACE NETWORK UUIDS, DEFAULT PUBLICNET AND SERVICE NET]
63
- rackconnect_wait: ['true' IF USING RACKCONNECT TO WAIT FOR IT TO COMPLETE]
64
- servicelevel_wait: ['true' IF USING MANAGED SERVICE LEVEL AUTOMATION TO WAIT FOR IT TO COMPLETE]
65
- no_passwd_lock: ['true' IF FOG LIBRARY SHOULD NOT LOCK ROOT ACCOUNT]
66
- servicenet: ['true' IF USING THE SERVICENET IP ADDRESS TO CONNECT]
67
- config_drive: [DEFAULTS TO true, ENABLES READ-ONLY METADATA DRIVE]
68
- user_data: [EXTRA CONFIGURATION DATA FOR THE SERVER]
270
+ driver:
271
+ name: rackspace
272
+ rackspace_region: ord
273
+ image_id: 09de0a66-3156-48b4-90a5-1cf25a905207
274
+ flavor_id: general1-4
69
275
  ```
70
276
 
71
- You also have the option of providing some configs via environment variables:
277
+ Image IDs are per-region, so `image_id` and `rackspace_region` travel together.
278
+
279
+ ### Connecting over ServiceNet
72
280
 
73
- ```shell
74
- export RACKSPACE_USERNAME="user" # (or OS_USERNAME)
75
- export RACKSPACE_API_KEY="api_key" # (or OS_PASSWORD)
76
- export RACKSPACE_REGION="dfw" # (or OS_REGION_NAME)
281
+ ```yaml
282
+ driver:
283
+ name: rackspace
284
+ servicenet: true
77
285
  ```
78
286
 
79
- Some configs are also derived based on your .ssh directory, specifically the
80
- `public_key_path` setting is derived by searching for:
287
+ `servicenet` is all you need — ServiceNet is attached either way, and this
288
+ tells the driver to hand the transport the private address instead of the
289
+ public one. Use `networks` only to attach an *extra* network of your own:
81
290
 
82
- - `~/.ssh/id_rsa.pub`
83
- - `~/.ssh/id_dsa.pub`
84
- - `~/.ssh/identity.pub`
85
- - `~/.ssh/id_ecdsa.pub`
291
+ ```yaml
292
+ driver:
293
+ name: rackspace
294
+ servicenet: true
295
+ networks:
296
+ - 4b1c1b3a-8f0f-4a1e-9d33-6f3c7ab2e5d9 # your isolated cloud network
297
+ ```
298
+
299
+ ### RackConnect accounts
300
+
301
+ Without this, the converge can start before RackConnect has finished wiring up
302
+ the server's networking.
303
+
304
+ ```yaml
305
+ driver:
306
+ name: rackspace
307
+ rackconnect_wait: true
308
+ servicelevel_wait: true
309
+ ```
310
+
311
+ ### A specific SSH key
312
+
313
+ ```yaml
314
+ driver:
315
+ name: rackspace
316
+ public_key_path: ~/.ssh/kitchen_rackspace.pub
317
+
318
+ transport:
319
+ ssh_key: ~/.ssh/kitchen_rackspace
320
+ ```
321
+
322
+ ### Slow builds, or a firewall in the way
323
+
324
+ ```yaml
325
+ driver:
326
+ name: rackspace
327
+ wait_for: 1200
328
+ no_ssh_tcp_check: true
329
+ no_ssh_tcp_check_sleep: 180
330
+ ```
331
+
332
+ ## Using with Chef
333
+
334
+ This driver is not tied to Cinc. The examples above use Cinc Workstation and the `cinc_infra` provisioner, but the driver works exactly the same with [Chef Workstation](https://www.chef.io/downloads/tools/workstation) — run `kitchen` instead of `cinc kitchen`, and use `chef_infra` instead of `cinc_infra`:
335
+
336
+ ```yaml
337
+ provisioner:
338
+ name: chef_infra
339
+
340
+ verifier:
341
+ name: inspec
342
+ ```
343
+
344
+ No driver configuration changes are needed.
86
345
 
87
346
  ## Contributing
88
347
 
89
- 1. Fork it
90
- 2. `bundle install`
91
- 3. Create your feature branch (`git checkout -b my-new-feature`)
92
- 4. `bundle exec rake` must pass
93
- 5. Commit your changes (`git commit -am 'Add some feature'`)
94
- 6. Push to the branch (`git push origin my-new-feature`)
95
- 7. Create new Pull Request
348
+ This project has no active maintainers, so please read the status note at the
349
+ top before opening an issue. Pull requests are still welcome on
350
+ [GitHub](https://github.com/test-kitchen/kitchen-rackspace). See
351
+ [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and how to run the
352
+ tests.
353
+
354
+ The most useful contribution right now is a refresh of `data/images.json`,
355
+ which has not been regenerated since 2016 — see
356
+ [Maintaining the bundled data](CONTRIBUTING.md#maintaining-the-bundled-data).
357
+
358
+ ## Acknowledgements
359
+
360
+ Originally derived from [Fletcher Nichol](https://github.com/fnichol)'s work on the [EC2 driver](https://github.com/test-kitchen/kitchen-ec2).
361
+
362
+ ## License
363
+
364
+ Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.
data/Rakefile CHANGED
@@ -9,7 +9,23 @@ RSpec::Core::RakeTask.new(:test, :tag) do |t, args|
9
9
  a << "--backtrace" if ENV["VERBOSE"] || ENV["DEBUG"]
10
10
  a << "--seed #{ENV["SEED"]}" if ENV["SEED"]
11
11
  a << "--tag #{args[:tag]}" if args[:tag]
12
- a << "--default-path test"
13
- a << "-I test/spec"
14
12
  end.join(" ")
15
13
  end
14
+
15
+ begin
16
+ require "yard"
17
+
18
+ # Options and the file list live in .yardopts so that a bare `yard` from the
19
+ # command line produces exactly what `rake doc` does.
20
+ YARD::Rake::YardocTask.new(:doc)
21
+
22
+ desc "List anything in lib/ that is still undocumented"
23
+ task :doc_coverage do
24
+ sh "yard stats --list-undoc"
25
+ end
26
+ rescue LoadError
27
+ desc "Generate YARD documentation (not installed)"
28
+ task :doc do
29
+ abort "YARD is not installed. Run: bundle install"
30
+ end
31
+ end
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Lists the flavors a Rackspace account can build, for setting `flavor_id`.
5
+ #
6
+ # Flavor availability varies by account and region, and Rackspace retires
7
+ # flavor classes over time, so this is the authoritative answer for a given
8
+ # account rather than the tables in the README.
9
+ #
10
+ # Usage:
11
+ #
12
+ # export RACKSPACE_USERNAME=myuser
13
+ # export RACKSPACE_API_KEY=myapikey
14
+ # export RACKSPACE_REGION=ord # optional, defaults to dfw
15
+ #
16
+ # bundle exec ruby helpers/dump_flavor_list.rb
17
+ #
18
+ # Run it under Bundler. fog-rackspace only loads against the fog-core version
19
+ # this gem pins; on a newer fog-core, `require "fog/rackspace"` raises NameError
20
+ # on its "CDN v2" service name.
21
+
22
+ require "fog/rackspace"
23
+
24
+ compute = Fog::Compute.new(
25
+ provider: "Rackspace",
26
+ rackspace_username: ENV.fetch("RACKSPACE_USERNAME"),
27
+ rackspace_api_key: ENV.fetch("RACKSPACE_API_KEY"),
28
+ rackspace_region: ENV.fetch("RACKSPACE_REGION", "dfw"),
29
+ version: :v2
30
+ )
31
+
32
+ flavors = compute.flavors.to_a
33
+ abort "No flavors visible to this account." if flavors.empty?
34
+
35
+ rows = flavors
36
+ .sort_by { |f| [f.ram.to_i, f.id.to_s] }
37
+ .map { |f| [f.id.to_s, "#{f.ram} MB", "#{f.vcpus} vCPU", "#{f.disk} GB"] }
38
+
39
+ header = %w{FLAVOR RAM VCPUS DISK}
40
+ widths = header.each_index.map do |i|
41
+ ([header[i]] + rows.map { |r| r[i] }).map(&:length).max
42
+ end
43
+
44
+ puts header.each_with_index.map { |h, i| h.ljust(widths[i]) }.join(" ")
45
+ puts widths.map { |w| "-" * w }.join(" ")
46
+ rows.each { |row| puts row.each_with_index.map { |c, i| c.ljust(widths[i]) }.join(" ") }