civo_cli 0.3.11 → 0.3.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3363116c1b2b7de8c58c5c01924973acf7afc59ac458a64f0544ec5260d063cd
4
- data.tar.gz: 07e510a81a639f95ca12b7f73efb3132157a1fefb8ed2e88f566518798c37c61
3
+ metadata.gz: 5ce4a126792b8b4ac0aab10f94c62a04c2dbf3a161c41e824f5bed5b8df3ce25
4
+ data.tar.gz: 93f53e2c44d58df69aa5b5bf8f660d79cb3c7f0ffb117cbf50c28017cda92662
5
5
  SHA512:
6
- metadata.gz: 4b4a417bc9fd45c00965cd53bc06bf683c3b56e6ad8e7489bcc659b0569ea38ae42aa4bdd98bbd9d0f69ffe84dc3d5980772ffe938cc3198d684aaee75d89616
7
- data.tar.gz: 5a7c083587dfabca7e0625070c226b491bb16622aa092f6271c94fd7ac31f8e4e37a9395ca042be10da8e26a16f12c85fd3f49ca7edb608e90dba93c82b49e82
6
+ metadata.gz: 869a5732dc585cf5133c571b1966bfc8842435dbd6cb47980413c6787376022604c22e0e107e2d7180850587d87804ccf8793f5059f0251d8ae78f0ca4993cf2
7
+ data.tar.gz: '0993d994f2c1d0feb1e956b35fc0eebd001d00bf769ade9dfac886dbfb2fa13ec57734cfd780dc074c6e4bedabb885dcd32d99d677e8b8a04f3dcb8df76ad5e5'
data/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@ 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.12] - 2019-08-28
7
+ ### Added
8
+ - Support for Kubernetes marketplace applications
9
+
6
10
  ## [0.3.11] - 2019-08-19
7
11
  ### Changed
8
12
  - Updated `civo` gem dependency for correct Kubernetes endpoints.
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- civo_cli (0.3.11)
4
+ civo_cli (0.3.12)
5
5
  bundler (~> 1.17)
6
- civo (>= 1.2.7)
6
+ civo (>= 1.2.8)
7
7
  colorize
8
8
  json
9
9
  terminal-table
@@ -12,14 +12,15 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activesupport (5.2.3)
15
+ activesupport (6.0.0)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
17
  i18n (>= 0.7, < 2)
18
18
  minitest (~> 5.1)
19
19
  tzinfo (~> 1.1)
20
+ zeitwerk (~> 2.1, >= 2.1.8)
20
21
  addressable (2.6.0)
21
22
  public_suffix (>= 2.0.2, < 4.0)
22
- civo (1.2.7)
23
+ civo (1.2.8)
23
24
  commander
24
25
  flexirest (>= 1.4.6)
25
26
  toml
@@ -111,6 +112,7 @@ GEM
111
112
  addressable (>= 2.3.6)
112
113
  crack (>= 0.3.2)
113
114
  hashdiff
115
+ zeitwerk (2.1.9)
114
116
 
115
117
  PLATFORMS
116
118
  ruby
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.7"
52
+ spec.add_runtime_dependency 'civo', ">= 1.2.8"
53
53
  spec.add_runtime_dependency 'json'
54
54
  end
@@ -1,3 +1,3 @@
1
1
  module CivoCLI
2
- VERSION = "0.3.11"
2
+ VERSION = "0.3.12"
3
3
  end
data/lib/civo_cli.rb CHANGED
@@ -36,10 +36,17 @@ module CivoCLI
36
36
  subcommand "instance", CivoCLI::Instance
37
37
  map "instances" => "instance"
38
38
 
39
- desc "kubernetes", "manage kubernetess"
39
+ desc "kubernetes", "manage Kubernetes"
40
40
  subcommand "kubernetes", CivoCLI::Kubernetes
41
41
  map "k8s" => "kubernetes", "k3s" => "kubernetes"
42
42
 
43
+ desc "applications", "list and add marketplace applications to Kubernetes clusters"
44
+ subcommand "applications", CivoCLI::KubernetesApplications
45
+ map "apps" => "applications", "app" => "applications", "application" => "applications",
46
+ "addon" => "applications", "addons" => "applications", "marketplace" => "applications",
47
+ "k8s-apps" => "applications", "k8s-app" => "applications",
48
+ "k3s-apps" => "applications", "k3s-app" => "applications"
49
+
43
50
  desc "loadbalancer", "manage load balancers"
44
51
  subcommand "loadbalancer", CivoCLI::LoadBalancer
45
52
  map "loadbalancers" => "loadbalancer"
@@ -48,7 +55,7 @@ module CivoCLI
48
55
  subcommand "network", CivoCLI::Network
49
56
  map "networks" => "network"
50
57
 
51
- desc "quota", "view the quota"
58
+ desc "quota", "view the quota for the active account"
52
59
  subcommand "quota", CivoCLI::Quota
53
60
  map "quotas" => "quota"
54
61
 
data/lib/kubernetes.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'tempfile'
2
-
3
2
  module CivoCLI
4
3
  class Kubernetes < Thor
5
4
  desc "list", "list all kubernetes clusters"
@@ -22,12 +21,12 @@ module CivoCLI
22
21
  end
23
22
  map "ls" => "list", "all" => "list"
24
23
 
25
-
26
24
  desc "show ID/NAME", "show a Kubernetes cluster by ID or name"
27
25
  def show(id)
28
26
  CivoCLI::Config.set_api_auth
29
27
  rows = []
30
- cluster = detect_cluster(id)
28
+ cluster = Finder.detect_cluster(id)
29
+ puts cluster.inspect
31
30
 
32
31
  puts " ID : #{cluster.id}"
33
32
  puts " Name : #{cluster.name}"
@@ -45,11 +44,22 @@ module CivoCLI
45
44
  puts " API Endpoint : #{cluster.api_endpoint}"
46
45
 
47
46
  puts ""
47
+ puts "Nodes:"
48
48
  rows = []
49
49
  cluster.instances.each do |instance|
50
50
  rows << [instance.hostname, instance.public_ip, instance.status]
51
51
  end
52
52
  puts Terminal::Table.new headings: ['Name', 'IP', 'Status'], rows: rows
53
+
54
+ if cluster.installed_applications.any?
55
+ puts ""
56
+ puts "Installed marketplace applications:"
57
+ rows = []
58
+ cluster.installed_applications.each do |application|
59
+ rows << [application.application, application.version, application.installed, application.category]
60
+ end
61
+ puts Terminal::Table.new headings: ['Name', 'Version', 'Installed', 'Category'], rows: rows
62
+ end
53
63
  rescue Flexirest::HTTPException => e
54
64
  puts e.result.reason.colorize(:red)
55
65
  exit 1
@@ -67,7 +77,7 @@ module CivoCLI
67
77
  LONGDESC
68
78
  def config(id)
69
79
  CivoCLI::Config.set_api_auth
70
- cluster = detect_cluster(id)
80
+ cluster = Finder.detect_cluster(id)
71
81
 
72
82
  if options[:save]
73
83
  save_config(cluster)
@@ -90,13 +100,14 @@ module CivoCLI
90
100
  \x5\x5Optional parameters are as follows:
91
101
  \x5 --size=<instance_size> - 'g2.medium' if blank. List of sizes and codes to use can be found through `civo sizes`
92
102
  \x5 --nodes=<count> - '3' if blank
103
+ \x5 --applications=name1,name2 - optional, use names from civo applications
93
104
  \x5 --wait - wait for build to complete and show status. Off by default.
94
105
  \x5 --save - save resulting configuration to ~/.kube/config (requires kubectl and the --wait option)
95
106
  \x5 --switch - switch context to newly-created cluster (requires kubectl and the --wait and --save options, as well as existing kubeconfig file)
96
107
  LONGDESC
97
108
  def create(name = CivoCLI::NameGenerator.create, *args)
98
109
  CivoCLI::Config.set_api_auth
99
- @cluster = Civo::Kubernetes.create(name: name, target_nodes_size: options[:size], num_target_nodes: options[:nodes])
110
+ @cluster = Civo::Kubernetes.create(name: name, target_nodes_size: options[:size], num_target_nodes: options[:nodes], applications: options[:applications])
100
111
 
101
112
  if options[:wait]
102
113
  timer = CivoCLI::Timer.new
@@ -135,7 +146,7 @@ module CivoCLI
135
146
  LONGDESC
136
147
  def rename(id)
137
148
  CivoCLI::Config.set_api_auth
138
- cluster = detect_cluster(id)
149
+ cluster = Finder.detect_cluster(id)
139
150
 
140
151
  if options[:name]
141
152
  Civo::Kubernetes.update(id: cluster.id, name: options[:name])
@@ -153,7 +164,7 @@ module CivoCLI
153
164
  LONGDESC
154
165
  def scale(id)
155
166
  CivoCLI::Config.set_api_auth
156
- cluster = detect_cluster(id)
167
+ cluster = Finder.detect_cluster(id)
157
168
 
158
169
  if options[:nodes]
159
170
  Civo::Kubernetes.update(id: cluster.id, num_target_nodes: options[:nodes])
@@ -168,7 +179,7 @@ module CivoCLI
168
179
  desc "remove ID/NAME", "removes an entire Kubernetes cluster with ID/name entered (use with caution!)"
169
180
  def remove(id)
170
181
  CivoCLI::Config.set_api_auth
171
- cluster = detect_cluster(id)
182
+ cluster = Finder.detect_cluster(id)
172
183
 
173
184
  puts "Removing Kubernetes cluster #{cluster.name.colorize(:red)}"
174
185
  cluster.remove
@@ -182,24 +193,6 @@ module CivoCLI
182
193
 
183
194
  private
184
195
 
185
- def detect_cluster(id)
186
- result = []
187
- Civo::Kubernetes.all.items.each do |cluster|
188
- result << cluster
189
- end
190
- result.select! { |cluster| cluster.name.include?(id) || cluster.id.include?(id) }
191
-
192
- if result.count.zero?
193
- puts "No Kubernetes clusters found for '#{id}'. Please check your query."
194
- exit 1
195
- elsif result.count > 1
196
- puts "Multiple possible Kubernetes clusters found for '#{id}'. Please try with a more specific query."
197
- exit 1
198
- else
199
- result[0]
200
- end
201
- end
202
-
203
196
  def save_config(cluster)
204
197
  config_file_exists = File.exist?("#{ENV["HOME"]}/.kube/config")
205
198
  tempfile = Tempfile.new('import_kubeconfig')
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.11
4
+ version: 0.3.12
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-21 00:00:00.000000000 Z
13
+ date: 2019-08-28 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.7
161
+ version: 1.2.8
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.7
168
+ version: 1.2.8
169
169
  - !ruby/object:Gem::Dependency
170
170
  name: json
171
171
  requirement: !ruby/object:Gem::Requirement