knife-google 3.3.6 → 3.3.7

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile DELETED
@@ -1,30 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec
4
-
5
- group :docs do
6
- gem "yard"
7
- gem "redcarpet"
8
- gem "github-markup"
9
- end
10
-
11
- group :test do
12
- gem "chefstyle"
13
- gem "rspec", "~> 3.1"
14
- gem "rake"
15
- gem "chef", ">= 12.0"
16
- end
17
-
18
- group :development do
19
- gem "pry"
20
- gem "pry-byebug"
21
- gem "pry-stack_explorer"
22
- gem "rb-readline"
23
- gem "simplecov", "~> 0.9"
24
- end
25
-
26
- instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
27
-
28
- # If you want to load debugging tools into the bundle exec sandbox,
29
- # add these additional dependencies into Gemfile.local
30
- eval_gemfile(__FILE__ + ".local") if File.exist?(__FILE__ + ".local")
data/README.md DELETED
@@ -1,305 +0,0 @@
1
- # knife-google
2
-
3
- [![Gem Version](https://badge.fury.io/rb/knife-google.svg)](http://badge.fury.io/rb/knife-google)
4
- [![Build Status](https://travis-ci.org/chef/knife-google.svg?branch=master)](https://travis-ci.org/chef/knife-google)
5
-
6
- ## Overview
7
-
8
- This is the official Chef [Knife](http://docs.chef.io/knife.html) plugin for
9
- [Google Compute Engine](https://cloud.google.com/products/compute-engine).
10
- This plugin gives knife the ability to create, bootstrap, and manage
11
- Google Compute Engine (GCE) instances.
12
-
13
- ## Compatibility
14
-
15
- This plugin has been tested with Chef 12.x and uses the [Google API Ruby Client](https://github.com/google/google-api-ruby-client).
16
-
17
- # Getting Started
18
-
19
- ## Install the gem
20
-
21
- Install the gem with:
22
-
23
- ```sh
24
- gem install knife-google
25
- ```
26
-
27
- Or, even better, if you're using the ChefDK:
28
-
29
- ```sh
30
- chef gem install knife-google
31
- ```
32
-
33
- If you're using Bundler, simply add it to your Gemfile:
34
-
35
- ```ruby
36
- gem "knife-google", "~> 2.0"
37
- ```
38
-
39
- ... and then run `bundle install`.
40
-
41
- ## Create a Google Cloud Platform project
42
-
43
- Before getting started with this plugin, you must first create a
44
- [Google Cloud Platform](https://cloud.google.com/) (GCP) "project" and add the
45
- Google Compute Engine service to your project. While GCP has many other services,
46
- such as App Engine and Cloud Storage, this plugin only provides an integration with
47
- Google Compute Engine (GCE).
48
-
49
- ## Authentication and Authorization
50
-
51
- The [underlying API](https://github.com/google/google-api-ruby-client) this plugin uses relies on the
52
- [Google Auth Library](https://github.com/google/google-auth-library-ruby) to handle authentication to the
53
- Google Cloud API. The auth library expects that there is a JSON credentials file located at:
54
-
55
- `~/.config/gcloud/application_default_credentials.json`
56
-
57
- The easiest way to create this is to download and install the [Google Cloud SDK](https://cloud.google.com/sdk/) and run the
58
- `gcloud auth login` command which will create the credentials file for you.
59
-
60
- **Update:** `gcloud auth login` no longer writes application default credentials. Please run `gcloud auth application-default login` for appropriate application credentials file.
61
-
62
- If you already have a file you'd like to use that is in a different location, set the
63
- `GOOGLE_APPLICATION_CREDENTIALS` environment variable with the full path to that file.
64
-
65
- ## Configuration
66
-
67
- All knife-google commands require a project name, and most commands require zone name to be supplied.
68
- You can supply these on the command line:
69
-
70
- ```sh
71
- knife google server list --gce-project my-test-project --gce-zone us-east1-b
72
- ```
73
-
74
- ... or you can set them in your `knife.rb` file:
75
-
76
- ```ruby
77
- knife[:gce_project] = 'my-test-project'
78
- knife[:gce_zone] = 'us-east1-b'
79
- ```
80
-
81
- ## SSH Keys
82
-
83
- In order to Linux bootstrap nodes, you will first need to ensure your SSH
84
- keys are set up correctly. Ensure your SSH public key is properly entered
85
- into your project's Metadata tab in the GCP Console. GCE will add your key
86
- to the appropriate user's `~/.ssh/authorized_keys` file when Chef first
87
- connects to perform the bootstrap process.
88
-
89
- * If you don't have one, create a key using `ssh-keygen`
90
- * Log in to the GCP console, select your project, go to Compute Engine, and go to the Metadata tab.
91
- * Select the "SSH Keys" tab.
92
- * Add a new item, and paste in your public key.
93
- * Note: to change the username automatically detected for the key, prefix your key with the username
94
- you plan to use as the `--ssh-user` when creating a server. For example, if you plan to connect
95
- as "chefuser", your key should look like: `chefuser:ssh-rsa AAAAB3N...`
96
- * Click "Save".
97
-
98
- You can find [more information on configuring SSH keys](https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys) in
99
- the Google Compute Engine documentation.
100
-
101
- # Usage
102
-
103
- To see all knife-google commands, run: `knife google`
104
-
105
- All commands have additional help output. Simply append `--help` to any command.
106
- For example, to see additional help and flags available for the `knife google disk create` command,
107
- run: `knife google disk create --help`
108
-
109
- ## knife google disk create DISKNAME
110
-
111
- Create a disk in GCE.
112
-
113
- ### Parameters
114
-
115
- * **DISKNAME**: required. The name of the disk to create.
116
- * **gce-disk-size**: optional. The size of the disk, in GB, to create. Valid options are between 10 and 10,000. The default is 10.
117
- * **gce-disk-type**: optional. The type of GCE disk to create, such as `pd-ssd`. Default is `pd-standard`.
118
- * **gce-disk-source**: optional. Image to use when creating a disk. By default, the disk will be created blank.
119
-
120
- ### Example
121
-
122
- ```sh
123
- knife google disk create my-test-disk --gce-disk-type pd-ssd --gce-disk-size 50
124
- ```
125
-
126
- ## knife google disk delete DISKNAME [DISKNAME]
127
-
128
- Deletes one or more disks from GCE.
129
-
130
- ### Parameters
131
-
132
- * **DISKNAME**: required. The name of the disk to delete. You can specify more than one disk to delete at a time.
133
-
134
- ### Example
135
-
136
- ```sh
137
- knife google disk delete my-test-disk1 my-test-disk2
138
- ```
139
-
140
- ## knife google disk list
141
-
142
- List all disks in the currently-configured GCE project and zone.
143
-
144
- ### Parameters
145
-
146
- None.
147
-
148
- ## knife google project quotas
149
-
150
- Display all project resources and quotas for the currently-configured project, such as the number of snapshots allowed and currently consumed.
151
-
152
- ### Parameters
153
-
154
- None.
155
-
156
- ## knife google region list
157
-
158
- Display all regions available to the currently-configured project, what each region's status is, and what zones exist in each region.
159
-
160
- Regions are collections of zones. For additional information on regions, please
161
- refer to the [GCE documentation](https://cloud.google.com/compute/docs/zones).
162
-
163
- ### Parameters
164
-
165
- None.
166
-
167
- ## knife google region quotas
168
-
169
- Display all resources and quotas for all regions in the currently-configured project, such as how many instances are allowed and currently configured in a given region.
170
-
171
- ### Parameters
172
-
173
- None.
174
-
175
- ## knife google server create INSTANCE_NAME
176
-
177
- Create a GCE server instance and bootstrap it with Chef. You must supply an instance name,
178
- a machine type, and an image to use.
179
-
180
- For a Linux instance, Chef will connect to the instance over SSH based on the `--ssh-user`
181
- parameter. This user must have SSH keys configured properly in the project's metadata.
182
- See the [SSH Keys](#ssh-keys) section for more information.
183
-
184
- ### Parameters
185
-
186
- * **INSTANCE_NAME**: required. The name to use when creating the instance.
187
- * **--gce-machine-type**: required. The machine type to use when creating the server, such as `n1-standard-2` or `n1-highcpu-2-d`.
188
- * **--gce-network**: The name of the network to which your instance will be attached. Defaults to "default".
189
- * **--gce-subnet**: The name of the subnet to which your instance will be attached. Only applies to custom networks.
190
- * **--gce-image**: required. The name of the disk image to use when creating the server. knife-google will search your current project for this disk image. If the image cannot be found but looks like a common public image, the public image project will be searched as well. Additionally, this parameter supports the same image aliases that `gcloud compute instances create` supports. See the output of `gcloud compute instances create --help` for a full list of aliases.
191
- * Example: if you supply a gce-image of `centos-7-v20160219`, knife-google will first look for an image with that name in your currently-configured project. If it cannot be found, it will look in the `centos-cloud` project.
192
- * This behavior can be overridden with the `--gce-image-project` parameter.
193
- * **--gce-image-project**: optional. The name of the GCP project that contains the image specified with the `--gce-image` flag. If this is specified, knife-google will not search any known public projects for your image.
194
- * **--gce-boot-disk-name**: The name to use when creating the instance's boot disk. Defaults to the instance name.
195
- * **--gce-boot-disk-size**: The size of the boot disk to create, in GB. Defaults to 10.
196
- * **--[no-]gce-boot-disk-ssd**: If true, the boot disk will be created as a `pd-ssd` disk type. By default, this is false, and the boot disk will be created as a `pd-standard` disk type.
197
- * **--[no-]gce-boot-disk-autodelete**: If true, the boot disk will be automatically deleted whenever the instance is deleted. Defaults to true.
198
- * **--additional_disks**: A comma-separated list of disk names to attach to the instance when creating it. The disks must already exist.
199
- * **--[no-]gce-auto-server-restart**: If true, the instance will be automatically restarted if it was terminated for non-user-initiated actions, such as host maintenance. Defaults to true.
200
- * **--[no-]gce-auto-server-migrate**: If true, the instance will be automatically migrated to another host if maintenance would require the instance to be terminated. Defaulst to true.
201
- * **--[no-]gce-can-ip-forward**: If true, the instance will be allowed to perform network forwarding. Defaults to false.
202
- * **--gce-tags**: A comma-separated list of tag values to add to the instance.
203
- * **--gce-metadata**: A comma-separated list of key=value pairs to be added to the instance metadata. Example: `--gce-metadata mykey=myvalue,yourkey=yourvalue`
204
- * **--gce-service-account-scopes**: A comma-separated list of account scopes for this instance. View a list of scoped by running `gcloud compute instances create --help` and searching for the documentation for the `--scopes` parameter. You must supply the full URI (i.e. "https://www.googleapis.com/auth/devstorage.full_control"), the final part of the URI (i.e. "devstorage.full_control"), or the gcloud alias name (i.e. "storage-rw"). See the output of `gcloud compute instances create --help` for a full list of scopes.
205
- * **--gce-service-account-name**: the service account name to use when adding service account scopes. This usually looks like an email address and can be created in the Permissions tab of the Google Cloud Console. Defaults to "default"
206
- * **--gce-use-private-ip**: If true, Chef will attempt to bootstrap the device using the private IP rather than the public IP. Defaulst to false.
207
- * **--gce-public-ip**: The type of public IP to associate with this instance. If "ephemeral", an ephemeral IP will be assigned. If "none", no public IP will be assigned. If a specific IP address is provided, knife-google will attempt to attach that specific IP address to the instance. Default is "ephemeral".
208
- * **--gce-email**: required when creating and bootstrapping Microsoft Windows instances. The email address of the currently-logged-in Google Cloud user. This is required when resetting the Windows instance's password.
209
-
210
- Additionally, all the normal `knife bootstrap` flags are supported. See the output of `knife bootstrap --help` and `knife google server create --help` for additional information.
211
-
212
- ### Example
213
-
214
- ```sh
215
- knife google server create test-instance-1 --gce-image centos-7-v20160219 --gce-machine-type n1-standard-2 --gce-public-ip ephemeral --ssh-user myuser --identity-file /Users/myuser/.ssh/google_compute_engine
216
- ```
217
-
218
- ## knife google server delete INSTANCE_NAME [INSTANCE_NAME]
219
-
220
- Deletes one or more GCE server instance. Additionally, if requested, the client and node object
221
- for the given instance will be deleted off of the Chef Server as well.
222
-
223
- The boot disk will be deleted as well unless `--no-gce-boot-disk-autodelete` was specified during
224
- the server creation.
225
-
226
- ### Parameters
227
-
228
- * **INSTANCE_NAME**: required. The name of the GCE instance to delete. You may provide more than one instance to delete.
229
- * **--purge**: optional. If provided, the instances' client and node objects will be deleted off the Chef Server. Default is NOT to delete the objects.
230
-
231
- ### Example
232
-
233
- ```sh
234
- knife google server delete my-instance-1 my-instance-2 --purge
235
- ```
236
-
237
- ## knife google server list
238
-
239
- Display the instances in the currently-configured project and zone, their statuses, machine types, IP addresses, and network.
240
-
241
- This command will display all instances in the project/zone, even if they weren't created with knife-google.
242
-
243
- ### Parameters
244
-
245
- None.
246
-
247
- ## knife google server show INSTANCE_NAME
248
-
249
- Display information about a single GCE instance, including its status, machine type, IP addresses, and network. Only one server may be displayed at a time.
250
-
251
- ### Parameters
252
-
253
- * **INSTANCE_NAME**: required. The name of the instance to show.
254
-
255
- ## knife google zone list
256
-
257
- List all available zones in the currently-configured project and what each zone's status is.
258
- A zone is an isolated location within a region that is independent of other
259
- zones in the same region. For additional information on zones, please refer
260
- to the [GCE documentation](https://cloud.google.com/compute/docs/zones).
261
-
262
- ### Parameters
263
-
264
- None.
265
-
266
- ## Bootstrapping Windows Nodes
267
-
268
- WinRM is used by Chef to bootstrap Windows nodes. The default settings of the GCE Windows images and GCP projects are not conducive to successful bootstrapping. Therefore, you will likely need to make some changes to your project settings and create your own image based on your company's policies. Some settings you will likely have to change include:
269
-
270
- * inbound firewall rule in the GCP console to allow inbound WinRM (such as port 5985/tcp)
271
- * inbound firewall rule in Windows Firewall to allow the inbound WinRM connections
272
- * enable the appropriate WinRM transports
273
-
274
- ## Development Documentation
275
-
276
- All documentation is written using YARD. You can generate a by running:
277
-
278
- ```
279
- rake docs
280
- ```
281
-
282
- ## Contributing
283
-
284
- For information on contributing to this project please see our [Contributing Documentation](https://github.com/chef/chef/blob/master/CONTRIBUTING.md)
285
-
286
- ## License & Copyright
287
-
288
- Version 3.0.0 of knife-google was rewritten by Chef Partner Engineering but is largely inspired by initial versions of knife-google, thanks to the work of the great folks at Google.
289
-
290
- - Copyright:: Copyright (c) 2016-2018 Chef Software, Inc.
291
- - License:: Apache License, Version 2.0
292
-
293
- ```text
294
- Licensed under the Apache License, Version 2.0 (the "License");
295
- you may not use this file except in compliance with the License.
296
- You may obtain a copy of the License at
297
-
298
- http://www.apache.org/licenses/LICENSE-2.0
299
-
300
- Unless required by applicable law or agreed to in writing, software
301
- distributed under the License is distributed on an "AS IS" BASIS,
302
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
303
- See the License for the specific language governing permissions and
304
- limitations under the License.
305
- ```
@@ -1,18 +0,0 @@
1
- <!---
2
- This file is reset every time a new release is done. The contents of this file are for the currently unreleased version.
3
-
4
- Example Note:
5
-
6
- ## Example Heading
7
- Details about the thing that changed that needs to get included in the Release Notes in markdown.
8
- -->
9
- # knife-google 2.0.0 Release Notes :
10
- In this release of knife-google the option names have been changed to conform to the long option names.
11
- For example the `zone` option has been changed to `--gce-zone` as per the long option.
12
- Also, support has been added so that the options can be set from knife.rb file.
13
-
14
- ## Issues fixed in knife-google 2.0.0
15
-
16
- * [knife-google #70] (https://github.com/chef/knife-google/pull/70) Fix for --bootstrap-version command line option
17
- * [knife-google #76] (https://github.com/chef/knife-google/pull/76) Fix for picking options from knife.rb
18
- * [knife-google #77] (https://github.com/chef/knife-google/pull/77) Changed option names according to long options
data/Rakefile DELETED
@@ -1,35 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- task default: [:style, :spec]
5
-
6
- Bundler::GemHelper.install_tasks
7
-
8
- desc "Run specs"
9
- RSpec::Core::RakeTask.new(:spec) do |spec|
10
- spec.pattern = "spec/**/*_spec.rb"
11
- end
12
-
13
- begin
14
- require "chefstyle"
15
- require "rubocop/rake_task"
16
- RuboCop::RakeTask.new(:style) do |task|
17
- task.options += ["--display-cop-names", "--no-color"]
18
- end
19
- rescue LoadError
20
- puts "chefstyle/rubocop is not available. bundle install first to make sure all dependencies are installed."
21
- end
22
-
23
- begin
24
- require "yard"
25
- YARD::Rake::YardocTask.new(:docs)
26
- rescue LoadError
27
- puts "yard is not available. bundle install first to make sure all dependencies are installed."
28
- end
29
-
30
- task :console do
31
- require "irb"
32
- require "irb/completion"
33
- ARGV.clear
34
- IRB.start
35
- end
data/TESTING.md DELETED
@@ -1,48 +0,0 @@
1
- ## Manual Testing Prerequisite:
2
-
3
- To work with knife google commands following setup needs to be done.
4
-
5
- Configure google authentication and authorization as suggested [here](https://github.com/chef/knife-google#authentication-and-authorization).
6
-
7
- To work with knife google command you should create GCP project and assign zone and region to that project
8
-
9
- **Ref:** https://cloud.google.com/resource-manager/docs/creating-managing-projects
10
- https://cloud.google.com/compute/docs/regions-zones/changing-default-zone-region
11
-
12
- Some useful Google cloud commands which you can use with Google Cloud command line interface [#REF](https://cloud.google.com/compute/docs/gcloud-compute/#set_default_zone_and_region_in_your_local_client)
13
-
14
- ``` gcloud projects create PROJECT_ID ```
15
-
16
- ``` gcloud config configurations activate CONFIGURATION_NAME ```
17
-
18
- ``` gcloud config set compute/zone ZONE ```
19
-
20
- ``` gcloud config set compute/zone ZONE ```
21
-
22
- Once the above setup is done get the PROJECT_ID and Zone and set it in your knife configuration file(knife.rb/config.rb).
23
- ```
24
- knife[:gce_project] = 'my-test-project'
25
- knife[:gce_zone] = 'us-east1-b'
26
- ```
27
- **NOTE** Not providing `gce_project` and `gce_zone` in knife configuartion file will run into following errors while running any knife google command.
28
-
29
- ```
30
- ERROR: The following required parameters are missing: gce_project, gce_zone
31
- ERROR: RuntimeError: The following required parameters are missing: gce_project, gce_zone
32
- ```
33
-
34
- ## Valid knife google commands
35
-
36
- ```
37
- knife google disk create NAME --gce-disk-size N (options)
38
- knife google disk delete NAME [NAME] (options)
39
- knife google disk list
40
- knife google project quotas
41
- knife google region list
42
- knife google region quotas
43
- knife google server create NAME -m MACHINE_TYPE -I IMAGE (options)
44
- knife google server delete INSTANCE_NAME [INSTANCE_NAME] (options)
45
- knife google server list
46
- knife google server show INSTANCE_NAME (options)
47
- knife google zone list
48
- ```
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 3.3.6
@@ -1,25 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- # frozen_string_literal: true
3
- $:.push File.expand_path("../lib", __FILE__)
4
- require "knife-google/version"
5
-
6
- Gem::Specification.new do |s|
7
- s.name = "knife-google"
8
- s.version = Knife::Google::VERSION
9
- s.platform = Gem::Platform::RUBY
10
- s.authors = ["Chiraq Jog", "Ranjib Dey", "James Tucker", "Paul Rossman", "Eric Johnson", "Chef Partner Engineering"]
11
- s.license = "Apache-2.0"
12
- s.email = ["paulrossman@google.com", "partnereng@chef.io"]
13
- s.has_rdoc = true
14
- s.extra_rdoc_files = ["README.md", "LICENSE"]
15
- s.summary = "Google Compute Engine Support for Chef's Knife Command"
16
- s.description = s.summary
17
- s.homepage = "https://github.com/chef/knife-google"
18
- s.required_ruby_version = ">= 2.2.2"
19
-
20
- s.add_dependency "knife-cloud", "~> 1.2.0"
21
- s.add_dependency "google-api-client", ">= 0.19.8", "< 0.25" # each version introduces breaking changes which we need to validate
22
- s.add_dependency "gcewinpass", "~> 1.1"
23
-
24
- s.files = `git ls-files -z`.split("\x0")
25
- end