civo_cli 0.3.10 → 0.3.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +3 -3
- data/LICENSE.txt +1 -1
- data/civo_cli.gemspec +1 -1
- data/lib/civo_cli/version.rb +1 -1
- data/lib/civo_cli.rb +1 -1
- data/lib/instance.rb +13 -6
- data/lib/kubernetes.rb +22 -7
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3363116c1b2b7de8c58c5c01924973acf7afc59ac458a64f0544ec5260d063cd
|
4
|
+
data.tar.gz: 07e510a81a639f95ca12b7f73efb3132157a1fefb8ed2e88f566518798c37c61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b4a417bc9fd45c00965cd53bc06bf683c3b56e6ad8e7489bcc659b0569ea38ae42aa4bdd98bbd9d0f69ffe84dc3d5980772ffe938cc3198d684aaee75d89616
|
7
|
+
data.tar.gz: 5a7c083587dfabca7e0625070c226b491bb16622aa092f6271c94fd7ac31f8e4e37a9395ca042be10da8e26a16f12c85fd3f49ca7edb608e90dba93c82b49e82
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@ All notable changes to the Civo CLI will be documented in this file.
|
|
3
3
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
5
5
|
|
6
|
+
## [0.3.11] - 2019-08-19
|
7
|
+
### Changed
|
8
|
+
- Updated `civo` gem dependency for correct Kubernetes endpoints.
|
9
|
+
- Aliased `k8s`/`kubernetes` command to be `k3s`
|
10
|
+
|
6
11
|
## [0.3.10] - 2019-08-19
|
7
12
|
### Added
|
8
13
|
- Alias for `instance public_ip` method as `instance ip`
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
civo_cli (0.3.
|
4
|
+
civo_cli (0.3.11)
|
5
5
|
bundler (~> 1.17)
|
6
|
-
civo (>= 1.2.
|
6
|
+
civo (>= 1.2.7)
|
7
7
|
colorize
|
8
8
|
json
|
9
9
|
terminal-table
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
tzinfo (~> 1.1)
|
20
20
|
addressable (2.6.0)
|
21
21
|
public_suffix (>= 2.0.2, < 4.0)
|
22
|
-
civo (1.2.
|
22
|
+
civo (1.2.7)
|
23
23
|
commander
|
24
24
|
flexirest (>= 1.4.6)
|
25
25
|
toml
|
data/LICENSE.txt
CHANGED
data/civo_cli.gemspec
CHANGED
@@ -49,6 +49,6 @@ Gem::Specification.new do |spec|
|
|
49
49
|
spec.add_runtime_dependency 'thor'
|
50
50
|
spec.add_runtime_dependency 'colorize'
|
51
51
|
spec.add_runtime_dependency "bundler", "~> 1.17"
|
52
|
-
spec.add_runtime_dependency 'civo', ">= 1.2.
|
52
|
+
spec.add_runtime_dependency 'civo', ">= 1.2.7"
|
53
53
|
spec.add_runtime_dependency 'json'
|
54
54
|
end
|
data/lib/civo_cli/version.rb
CHANGED
data/lib/civo_cli.rb
CHANGED
@@ -38,7 +38,7 @@ module CivoCLI
|
|
38
38
|
|
39
39
|
desc "kubernetes", "manage kubernetess"
|
40
40
|
subcommand "kubernetes", CivoCLI::Kubernetes
|
41
|
-
map "k8s" => "kubernetes"
|
41
|
+
map "k8s" => "kubernetes", "k3s" => "kubernetes"
|
42
42
|
|
43
43
|
desc "loadbalancer", "manage load balancers"
|
44
44
|
subcommand "loadbalancer", CivoCLI::LoadBalancer
|
data/lib/instance.rb
CHANGED
@@ -8,15 +8,22 @@ module CivoCLI
|
|
8
8
|
DEFAULT_HOSTNAME = CivoCLI::NameGenerator.create
|
9
9
|
|
10
10
|
desc "list", "list all instances"
|
11
|
+
option :quiet, type: :boolean, aliases: '-q'
|
11
12
|
def list
|
12
13
|
CivoCLI::Config.set_api_auth
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
if options[:quiet]
|
15
|
+
Civo::Instance.all(per_page: 10_000_000).items.each do |instance|
|
16
|
+
puts instance.id
|
17
|
+
end
|
18
|
+
else
|
19
|
+
rows = []
|
20
|
+
sizes = Civo::Size.all.items
|
21
|
+
Civo::Instance.all(per_page: 10_000_000).items.each do |instance|
|
22
|
+
size_name = sizes.detect {|s| s.name == instance.size}&.nice_name
|
23
|
+
rows << [instance.id, instance.hostname, size_name, instance.region, instance.public_ip, instance.status]
|
24
|
+
end
|
25
|
+
puts Terminal::Table.new headings: ['ID', 'Hostname', 'Size', 'Region', 'Public IP', 'Status'], rows: rows
|
18
26
|
end
|
19
|
-
puts Terminal::Table.new headings: ['ID', 'Hostname', 'Size', 'Region', 'Public IP', 'Status'], rows: rows
|
20
27
|
end
|
21
28
|
map "ls" => "list", "all" => "list"
|
22
29
|
|
data/lib/kubernetes.rb
CHANGED
@@ -3,13 +3,20 @@ require 'tempfile'
|
|
3
3
|
module CivoCLI
|
4
4
|
class Kubernetes < Thor
|
5
5
|
desc "list", "list all kubernetes clusters"
|
6
|
+
option :quiet, type: :boolean, aliases: '-q'
|
6
7
|
def list
|
7
8
|
CivoCLI::Config.set_api_auth
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
if options[:quiet]
|
10
|
+
Civo::Kubernetes.all.items.each do |cluster|
|
11
|
+
puts cluster.id
|
12
|
+
end
|
13
|
+
else
|
14
|
+
rows = []
|
15
|
+
Civo::Kubernetes.all.items.each do |cluster|
|
16
|
+
rows << [cluster.id, cluster.name, cluster.num_target_nodes, cluster.target_nodes_size, cluster.status]
|
17
|
+
end
|
18
|
+
puts Terminal::Table.new headings: ['ID', 'Name', '# Nodes', 'Size', 'Status'], rows: rows
|
11
19
|
end
|
12
|
-
puts Terminal::Table.new headings: ['ID', 'Name', '# Nodes', 'Size', 'Status'], rows: rows
|
13
20
|
rescue Flexirest::HTTPForbiddenClientException
|
14
21
|
reject_user_access
|
15
22
|
end
|
@@ -75,8 +82,9 @@ module CivoCLI
|
|
75
82
|
desc "create [NAME] [...]", "create a new kubernetes cluster with the specified name and provided options"
|
76
83
|
option :size, default: 'g2.medium', banner: 'size'
|
77
84
|
option :nodes, default: '3', banner: 'node_count'
|
78
|
-
option :wait, type: :boolean
|
85
|
+
option :wait, type: :boolean, banner: 'wait until cluster is running'
|
79
86
|
option :save, type: :boolean
|
87
|
+
option :switch, type: :boolean
|
80
88
|
long_desc <<-LONGDESC
|
81
89
|
Create a new Kubernetes cluster with name (randomly assigned if blank), instance size (default: g2.medium),
|
82
90
|
\x5\x5Optional parameters are as follows:
|
@@ -84,6 +92,7 @@ module CivoCLI
|
|
84
92
|
\x5 --nodes=<count> - '3' if blank
|
85
93
|
\x5 --wait - wait for build to complete and show status. Off by default.
|
86
94
|
\x5 --save - save resulting configuration to ~/.kube/config (requires kubectl and the --wait option)
|
95
|
+
\x5 --switch - switch context to newly-created cluster (requires kubectl and the --wait and --save options, as well as existing kubeconfig file)
|
87
96
|
LONGDESC
|
88
97
|
def create(name = CivoCLI::NameGenerator.create, *args)
|
89
98
|
CivoCLI::Config.set_api_auth
|
@@ -197,10 +206,16 @@ module CivoCLI
|
|
197
206
|
begin
|
198
207
|
tempfile.write(cluster.kubeconfig)
|
199
208
|
tempfile.size
|
200
|
-
|
209
|
+
if options[:switch]
|
210
|
+
result = `KUBECONFIG=#{tempfile.path}:~/.kube/config kubectl config view --flatten`
|
211
|
+
else
|
212
|
+
result = `KUBECONFIG=~/.kube/config:#{tempfile.path} kubectl config view --flatten`
|
213
|
+
end
|
201
214
|
Dir.mkdir("#{ENV['HOME']}/.kube/") unless Dir.exist?("#{ENV["HOME"]}/.kube/")
|
202
215
|
File.write("#{ENV['HOME']}/.kube/config", result)
|
203
|
-
if config_file_exists
|
216
|
+
if config_file_exists && options[:switch]
|
217
|
+
puts "Merged".colorize(:green) + " config into ~/.kube/config and switched context to #{cluster.name}"
|
218
|
+
elsif config_file_exists && !options[:switch]
|
204
219
|
puts "Merged".colorize(:green) + " config into ~/.kube/config"
|
205
220
|
else
|
206
221
|
puts "Saved".colorize(:green) + " config to ~/.kube/config"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: civo_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Jeffries
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-08-
|
13
|
+
date: 2019-08-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -158,14 +158,14 @@ dependencies:
|
|
158
158
|
requirements:
|
159
159
|
- - ">="
|
160
160
|
- !ruby/object:Gem::Version
|
161
|
-
version: 1.2.
|
161
|
+
version: 1.2.7
|
162
162
|
type: :runtime
|
163
163
|
prerelease: false
|
164
164
|
version_requirements: !ruby/object:Gem::Requirement
|
165
165
|
requirements:
|
166
166
|
- - ">="
|
167
167
|
- !ruby/object:Gem::Version
|
168
|
-
version: 1.2.
|
168
|
+
version: 1.2.7
|
169
169
|
- !ruby/object:Gem::Dependency
|
170
170
|
name: json
|
171
171
|
requirement: !ruby/object:Gem::Requirement
|
@@ -249,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
249
249
|
- !ruby/object:Gem::Version
|
250
250
|
version: '0'
|
251
251
|
requirements: []
|
252
|
-
rubygems_version: 3.0.
|
252
|
+
rubygems_version: 3.0.1
|
253
253
|
signing_key:
|
254
254
|
specification_version: 4
|
255
255
|
summary: CLI for interacting with Civo.com
|