uffizzi-cli 2.2.2 → 2.3.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.
- checksums.yaml +4 -4
- data/lib/uffizzi/cli/cluster.rb +20 -85
- data/lib/uffizzi/cli/dev/ingress.rb +42 -0
- data/lib/uffizzi/cli/dev.rb +4 -0
- data/lib/uffizzi/clients/api/api_client.rb +7 -0
- data/lib/uffizzi/clients/api/api_routes.rb +6 -0
- data/lib/uffizzi/services/cluster/common_service.rb +25 -0
- data/lib/uffizzi/services/cluster/create_service.rb +29 -0
- data/lib/uffizzi/services/cluster/delete_service.rb +28 -0
- data/lib/uffizzi/services/cluster/list_service.rb +20 -0
- data/lib/uffizzi/services/cluster/update_kubeconfig_service.rb +22 -0
- data/lib/uffizzi/shell.rb +1 -1
- data/lib/uffizzi/version.rb +1 -1
- data/lib/uffizzi.rb +5 -0
- data/man/uffizzi-cluster-create +12 -3
- data/man/uffizzi-dev-ingress +27 -0
- data/man/uffizzi-dev-ingress-open +26 -0
- data/man/uffizzi-dev-ingress-open.ronn +18 -0
- data/man/uffizzi-dev-ingress.ronn +21 -0
- data/man/uffizzi-dev-start +5 -4
- data/man/uffizzi-dev-start.ronn +0 -13
- data/man/uffizzi-dev-stop.ronn +5 -17
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d389ef60e2a64b493a283d5ccd8186c6e3ba8bb57e2ef555af9badb7517052b2
|
4
|
+
data.tar.gz: 1f05c45de49a4f9c99796a4e1ff909a1a58b797f4e447037f3df60548d0f2e63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b7638e790d12afd1cea73a97889e1f37285fdb20ed2eeddd9fcdc047df08a6ff4c73c4c7b0489d973b6f860c30db0060a3eaf08420293637d278923313ccfdc
|
7
|
+
data.tar.gz: 995cb7bb64180dde674f11f85aff39f549db29d48ebeb890a84dbdbf7edb3b6bf2fa17b85702509947f2939150037fa3cb1568190360967082cde9e876c7cd4e
|
data/lib/uffizzi/cli/cluster.rb
CHANGED
@@ -7,6 +7,11 @@ require 'uffizzi/auth_helper'
|
|
7
7
|
require 'uffizzi/helpers/config_helper'
|
8
8
|
require 'uffizzi/services/preview_service'
|
9
9
|
require 'uffizzi/services/cluster_service'
|
10
|
+
require 'uffizzi/services/cluster/common_service'
|
11
|
+
require 'uffizzi/services/cluster/create_service'
|
12
|
+
require 'uffizzi/services/cluster/delete_service'
|
13
|
+
require 'uffizzi/services/cluster/list_service'
|
14
|
+
require 'uffizzi/services/cluster/update_kubeconfig_service'
|
10
15
|
require 'uffizzi/services/kubeconfig_service'
|
11
16
|
require 'uffizzi/services/cluster/disconnect_service'
|
12
17
|
|
@@ -164,31 +169,11 @@ module Uffizzi
|
|
164
169
|
|
165
170
|
return handle_delete_cluster(cluster_name) unless is_delete_kubeconfig
|
166
171
|
|
167
|
-
cluster_data = ClusterService.fetch_cluster_data(cluster_name, **cluster_api_connection_params)
|
168
|
-
kubeconfig = parse_kubeconfig(cluster_data[:kubeconfig])
|
172
|
+
cluster_data = ClusterService.fetch_cluster_data(command_args[:cluster_name], **cluster_api_connection_params)
|
173
|
+
kubeconfig = ClusterCommonService.parse_kubeconfig(cluster_data[:kubeconfig])
|
169
174
|
|
170
175
|
handle_delete_cluster(cluster_name)
|
171
|
-
exclude_kubeconfig(cluster_data[:id], kubeconfig) if kubeconfig.present?
|
172
|
-
end
|
173
|
-
|
174
|
-
def exclude_kubeconfig(cluster_id, kubeconfig)
|
175
|
-
cluster_config = Uffizzi::ConfigHelper.cluster_config_by_id(cluster_id)
|
176
|
-
return if cluster_config.nil?
|
177
|
-
|
178
|
-
kubeconfig_path = cluster_config[:kubeconfig_path]
|
179
|
-
ConfigFile.write_option(:clusters, Uffizzi::ConfigHelper.clusters_config_without(cluster_id))
|
180
|
-
|
181
|
-
KubeconfigService.save_to_filepath(kubeconfig_path, kubeconfig) do |kubeconfig_by_path|
|
182
|
-
if kubeconfig_by_path.nil?
|
183
|
-
msg = "Warning: kubeconfig at path #{kubeconfig_path} does not exist"
|
184
|
-
return Uffizzi.ui.say(msg)
|
185
|
-
end
|
186
|
-
|
187
|
-
new_kubeconfig = KubeconfigService.exclude(kubeconfig_by_path, kubeconfig)
|
188
|
-
first_context = KubeconfigService.get_first_context(new_kubeconfig)
|
189
|
-
new_current_context = first_context.present? ? first_context['name'] : nil
|
190
|
-
KubeconfigService.update_current_context(new_kubeconfig, new_current_context)
|
191
|
-
end
|
176
|
+
ClusterDeleteService.exclude_kubeconfig(cluster_data[:id], kubeconfig) if kubeconfig.present?
|
192
177
|
end
|
193
178
|
|
194
179
|
def handle_delete_cluster(cluster_name)
|
@@ -211,10 +196,10 @@ module Uffizzi
|
|
211
196
|
cluster_data = ClusterService.fetch_cluster_data(cluster_name, **cluster_api_connection_params)
|
212
197
|
|
213
198
|
unless cluster_data[:kubeconfig].present?
|
214
|
-
say_error_update_kubeconfig(cluster_data)
|
199
|
+
ClusterUpdateKubeconfigService.say_error_update_kubeconfig(cluster_data)
|
215
200
|
end
|
216
201
|
|
217
|
-
parsed_kubeconfig = parse_kubeconfig(cluster_data[:kubeconfig])
|
202
|
+
parsed_kubeconfig = ClusterCommonService.parse_kubeconfig(cluster_data[:kubeconfig])
|
218
203
|
|
219
204
|
return Uffizzi.ui.say(parsed_kubeconfig.to_yaml) if options[:print]
|
220
205
|
|
@@ -226,11 +211,11 @@ module Uffizzi
|
|
226
211
|
next new_kubeconfig if kubeconfig_by_path.nil?
|
227
212
|
|
228
213
|
previous_current_context = KubeconfigService.get_current_context(kubeconfig_by_path)
|
229
|
-
save_previous_current_context(kubeconfig_path, previous_current_context)
|
214
|
+
ClusterCommonService.save_previous_current_context(kubeconfig_path, previous_current_context)
|
230
215
|
new_kubeconfig
|
231
216
|
end
|
232
217
|
|
233
|
-
update_clusters_config(cluster_data[:id],
|
218
|
+
ClusterCommonService.update_clusters_config(cluster_data[:id], kubeconfig_path: kubeconfig_path)
|
234
219
|
|
235
220
|
return if options[:quiet]
|
236
221
|
|
@@ -287,10 +272,9 @@ module Uffizzi
|
|
287
272
|
end
|
288
273
|
|
289
274
|
def cluster_creation_params(cluster_name)
|
275
|
+
manifest_content = load_manifest_file(options[:manifest])
|
290
276
|
creation_source = options[:"creation-source"] || ClusterService::MANUAL_CREATION_SOURCE
|
291
|
-
manifest_file_path = options[:manifest]
|
292
277
|
k8s_version = options[:"k8s-version"]
|
293
|
-
manifest_content = load_manifest_file(manifest_file_path)
|
294
278
|
|
295
279
|
{
|
296
280
|
cluster: {
|
@@ -327,7 +311,7 @@ module Uffizzi
|
|
327
311
|
raise Uffizzi::Error.new('The project has no active clusters') if clusters.empty?
|
328
312
|
|
329
313
|
clusters_data = if Uffizzi.ui.output_format.nil?
|
330
|
-
|
314
|
+
ClusterListService.render_plain_clusters(clusters)
|
331
315
|
else
|
332
316
|
clusters.map { |c| c.slice(:name, :project) }
|
333
317
|
end
|
@@ -335,24 +319,11 @@ module Uffizzi
|
|
335
319
|
Uffizzi.ui.say(clusters_data)
|
336
320
|
end
|
337
321
|
|
338
|
-
def render_plain_cluster_list(clusters)
|
339
|
-
clusters.map do |cluster|
|
340
|
-
project_name = cluster.dig(:project, :name)
|
341
|
-
|
342
|
-
if project_name.present?
|
343
|
-
"- Cluster name: #{cluster[:name].strip} Project name: #{project_name.strip}"
|
344
|
-
else
|
345
|
-
"- #{cluster[:name]}"
|
346
|
-
end
|
347
|
-
end.join("\n")
|
348
|
-
end
|
349
|
-
|
350
322
|
def handle_succeed_create_response(cluster_data)
|
351
323
|
kubeconfig_path = options[:kubeconfig] || KubeconfigService.default_path
|
352
324
|
is_update_current_context = options[:'update-current-context']
|
353
|
-
parsed_kubeconfig = parse_kubeconfig(cluster_data[:kubeconfig])
|
354
|
-
rendered_cluster_data =
|
355
|
-
cluster_name = cluster_data[:name]
|
325
|
+
parsed_kubeconfig = ClusterCommonService.parse_kubeconfig(cluster_data[:kubeconfig])
|
326
|
+
rendered_cluster_data = build_render_cluster_data!(cluster_data)
|
356
327
|
|
357
328
|
Uffizzi.ui.enable_stdout
|
358
329
|
Uffizzi.ui.say("Cluster with name: #{rendered_cluster_data[:name]} was created.")
|
@@ -363,42 +334,13 @@ module Uffizzi
|
|
363
334
|
|
364
335
|
Uffizzi.ui.say(rendered_cluster_data) if Uffizzi.ui.output_format
|
365
336
|
|
366
|
-
save_kubeconfig(parsed_kubeconfig, kubeconfig_path)
|
367
|
-
update_clusters_config(cluster_data[:id], name:
|
337
|
+
ClusterCreateService.save_kubeconfig(parsed_kubeconfig, kubeconfig_path, is_update_current_context)
|
338
|
+
ClusterCommonService.update_clusters_config(cluster_data[:id], name: cluster_data[:name], kubeconfig_path: kubeconfig_path)
|
368
339
|
GithubService.write_to_github_env(rendered_cluster_data) if GithubService.github_actions_exists?
|
369
340
|
end
|
370
341
|
|
371
|
-
def
|
372
|
-
|
373
|
-
|
374
|
-
KubeconfigService.save_to_filepath(kubeconfig_path, kubeconfig) do |kubeconfig_by_path|
|
375
|
-
merged_kubeconfig = KubeconfigService.merge(kubeconfig_by_path, kubeconfig)
|
376
|
-
|
377
|
-
if is_update_current_context
|
378
|
-
new_current_context = KubeconfigService.get_current_context(kubeconfig)
|
379
|
-
new_kubeconfig = KubeconfigService.update_current_context(merged_kubeconfig, new_current_context)
|
380
|
-
|
381
|
-
next new_kubeconfig if kubeconfig_by_path.nil?
|
382
|
-
|
383
|
-
previous_current_context = KubeconfigService.get_current_context(kubeconfig_by_path)
|
384
|
-
save_previous_current_context(kubeconfig_path, previous_current_context)
|
385
|
-
new_kubeconfig
|
386
|
-
else
|
387
|
-
merged_kubeconfig
|
388
|
-
end
|
389
|
-
end
|
390
|
-
|
391
|
-
Uffizzi.ui.say("Kubeconfig was updated by the path: #{kubeconfig_path}") if is_update_current_context
|
392
|
-
end
|
393
|
-
|
394
|
-
def update_clusters_config(id, params)
|
395
|
-
clusters_config = Uffizzi::ConfigHelper.update_clusters_config_by_id(id, params)
|
396
|
-
ConfigFile.write_option(:clusters, clusters_config)
|
397
|
-
ConfigFile.write_option(:current_cluster, ConfigHelper.cluster_config_by_id(id))
|
398
|
-
end
|
399
|
-
|
400
|
-
def render_cluster_data(cluster_data)
|
401
|
-
kubeconfig = parse_kubeconfig(cluster_data[:kubeconfig])
|
342
|
+
def build_render_cluster_data!(cluster_data)
|
343
|
+
kubeconfig = ClusterCommonService.parse_kubeconfig(cluster_data[:kubeconfig])
|
402
344
|
raise Uffizzi::Error.new('The kubeconfig data is empty') unless kubeconfig
|
403
345
|
|
404
346
|
new_cluster_data = cluster_data.slice(:name)
|
@@ -413,13 +355,6 @@ module Uffizzi
|
|
413
355
|
Psych.safe_load(Base64.decode64(kubeconfig))
|
414
356
|
end
|
415
357
|
|
416
|
-
def save_previous_current_context(kubeconfig_path, current_context)
|
417
|
-
return if kubeconfig_path.nil? || ConfigHelper.previous_current_context_by_path(kubeconfig_path).present?
|
418
|
-
|
419
|
-
previous_current_contexts = Uffizzi::ConfigHelper.set_previous_current_context_by_path(kubeconfig_path, current_context)
|
420
|
-
ConfigFile.write_option(:previous_current_contexts, previous_current_contexts)
|
421
|
-
end
|
422
|
-
|
423
358
|
def handle_missing_cluster_name_error
|
424
359
|
Uffizzi.ui.say("No kubeconfig found at #{KubeconfigService.default_path}")
|
425
360
|
Uffizzi.ui.say('Please update the current context or provide a cluster name.')
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'uffizzi'
|
4
|
+
require 'uffizzi/auth_helper'
|
5
|
+
require 'uffizzi/response_helper'
|
6
|
+
|
7
|
+
module Uffizzi
|
8
|
+
class Cli::Dev::Ingress < Thor
|
9
|
+
include ApiClient
|
10
|
+
|
11
|
+
desc 'open', 'Open dev environment hosts'
|
12
|
+
def open
|
13
|
+
Uffizzi::AuthHelper.check_login
|
14
|
+
DevService.check_running_process!
|
15
|
+
|
16
|
+
if DevService.startup?
|
17
|
+
Uffizzi.ui.say_error_and_exit('Dev environment not started yet')
|
18
|
+
end
|
19
|
+
|
20
|
+
dev_environment = DevService.dev_environment
|
21
|
+
cluster_name = dev_environment[:cluster_name]
|
22
|
+
params = { cluster_name: cluster_name }
|
23
|
+
response = get_cluster_ingresses(server, project_slug, params)
|
24
|
+
|
25
|
+
return ResponseHelper.handle_failed_response(response) unless ResponseHelper.ok?(response)
|
26
|
+
|
27
|
+
ingress_hosts = response.dig(:body, :ingresses)
|
28
|
+
urls = ingress_hosts.map { |host| "https://#{host}" }
|
29
|
+
urls.each { |url| Uffizzi.launchy.open(url) { Uffizzi.ui.say(url) } }
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def server
|
35
|
+
@server ||= ConfigFile.read_option(:server)
|
36
|
+
end
|
37
|
+
|
38
|
+
def project_slug
|
39
|
+
@project_slug ||= ConfigFile.read_option(:project)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/uffizzi/cli/dev.rb
CHANGED
@@ -9,6 +9,10 @@ module Uffizzi
|
|
9
9
|
class Cli::Dev < Thor
|
10
10
|
include ApiClient
|
11
11
|
|
12
|
+
desc 'ingress', 'Show the compose dev environment ingress info'
|
13
|
+
require_relative 'dev/ingress'
|
14
|
+
subcommand 'ingress', Uffizzi::Cli::Dev::Ingress
|
15
|
+
|
12
16
|
desc 'start [CONFIG]', 'Start dev environment'
|
13
17
|
method_option :quiet, type: :boolean, aliases: :q
|
14
18
|
method_option :'default-repo', type: :string
|
@@ -293,6 +293,13 @@ module ApiClient
|
|
293
293
|
build_response(response)
|
294
294
|
end
|
295
295
|
|
296
|
+
def get_cluster_ingresses(server, project_slug, params)
|
297
|
+
uri = project_cluster_ingresses_uri(server, project_slug, cluster_name: params[:cluster_name], oidc_token: params[:oidc_token])
|
298
|
+
response = http_client.make_get_request(uri)
|
299
|
+
|
300
|
+
build_response(response)
|
301
|
+
end
|
302
|
+
|
296
303
|
def get_access_token(server, code)
|
297
304
|
uri = access_token_url(server, code)
|
298
305
|
response = http_client.make_get_request(uri)
|
@@ -104,6 +104,12 @@ module ApiRoutes
|
|
104
104
|
"#{server}/api/cli/v1/projects/#{project_slug}/clusters?token=#{oidc_token}"
|
105
105
|
end
|
106
106
|
|
107
|
+
def project_cluster_ingresses_uri(server, project_slug, cluster_name:, oidc_token:)
|
108
|
+
url = "#{server}/api/cli/v1/projects/#{project_slug}/clusters/#{cluster_name}/ingresses"
|
109
|
+
|
110
|
+
oidc_token.nil? ? url : url + "?token=#{oidc_token}"
|
111
|
+
end
|
112
|
+
|
107
113
|
def cluster_uri(server, project_slug, cluster_name:, oidc_token:)
|
108
114
|
return "#{server}/api/cli/v1/projects/#{project_slug}/clusters/#{cluster_name}" if oidc_token.nil?
|
109
115
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'uffizzi/helpers/config_helper'
|
4
|
+
|
5
|
+
class ClusterCommonService
|
6
|
+
class << self
|
7
|
+
def save_previous_current_context(kubeconfig_path, current_context)
|
8
|
+
return if kubeconfig_path.nil? || Uffizzi::ConfigHelper.previous_current_context_by_path(kubeconfig_path).present?
|
9
|
+
|
10
|
+
previous_current_contexts = Uffizzi::ConfigHelper.set_previous_current_context_by_path(kubeconfig_path, current_context)
|
11
|
+
Uffizzi::ConfigFile.write_option(:previous_current_contexts, previous_current_contexts)
|
12
|
+
end
|
13
|
+
|
14
|
+
def update_clusters_config(id, params)
|
15
|
+
clusters_config = Uffizzi::ConfigHelper.update_clusters_config_by_id(id, params)
|
16
|
+
Uffizzi::ConfigFile.write_option(:clusters, clusters_config)
|
17
|
+
end
|
18
|
+
|
19
|
+
def parse_kubeconfig(kubeconfig)
|
20
|
+
return if kubeconfig.nil?
|
21
|
+
|
22
|
+
Psych.safe_load(Base64.decode64(kubeconfig))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'uffizzi/helpers/config_helper'
|
4
|
+
require 'uffizzi/services/cluster/common_service'
|
5
|
+
require 'uffizzi/services/kubeconfig_service'
|
6
|
+
|
7
|
+
class ClusterCreateService
|
8
|
+
class << self
|
9
|
+
def save_kubeconfig(kubeconfig, kubeconfig_path, is_update_current_context)
|
10
|
+
kubeconfig_path = kubeconfig_path.nil? ? KubeconfigService.default_path : kubeconfig_path
|
11
|
+
KubeconfigService.save_to_filepath(kubeconfig_path, kubeconfig) do |kubeconfig_by_path|
|
12
|
+
merged_kubeconfig = KubeconfigService.merge(kubeconfig_by_path, kubeconfig)
|
13
|
+
|
14
|
+
if is_update_current_context
|
15
|
+
new_current_context = KubeconfigService.get_current_context(kubeconfig)
|
16
|
+
new_kubeconfig = KubeconfigService.update_current_context(merged_kubeconfig, new_current_context)
|
17
|
+
|
18
|
+
next new_kubeconfig if kubeconfig_by_path.nil?
|
19
|
+
|
20
|
+
previous_current_context = KubeconfigService.get_current_context(kubeconfig_by_path)
|
21
|
+
ClusterCommonService.save_previous_current_context(kubeconfig_path, previous_current_context)
|
22
|
+
new_kubeconfig
|
23
|
+
else
|
24
|
+
merged_kubeconfig
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'uffizzi/helpers/config_helper'
|
4
|
+
require 'uffizzi/services/kubeconfig_service'
|
5
|
+
|
6
|
+
class ClusterDeleteService
|
7
|
+
class << self
|
8
|
+
def exclude_kubeconfig(cluster_id, kubeconfig)
|
9
|
+
cluster_config = Uffizzi::ConfigHelper.cluster_config_by_id(cluster_id)
|
10
|
+
return if cluster_config.nil?
|
11
|
+
|
12
|
+
kubeconfig_path = cluster_config[:kubeconfig_path]
|
13
|
+
Uffizzi::ConfigFile.write_option(:clusters, Uffizzi::ConfigHelper.clusters_config_without(cluster_id))
|
14
|
+
|
15
|
+
KubeconfigService.save_to_filepath(kubeconfig_path, kubeconfig) do |kubeconfig_by_path|
|
16
|
+
if kubeconfig_by_path.nil?
|
17
|
+
msg = "Warning: kubeconfig at path #{kubeconfig_path} does not exist"
|
18
|
+
return Uffizzi.ui.say(msg)
|
19
|
+
end
|
20
|
+
|
21
|
+
new_kubeconfig = KubeconfigService.exclude(kubeconfig_by_path, kubeconfig)
|
22
|
+
first_context = KubeconfigService.get_first_context(new_kubeconfig)
|
23
|
+
new_current_context = first_context.present? ? first_context['name'] : nil
|
24
|
+
KubeconfigService.update_current_context(new_kubeconfig, new_current_context)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ClusterListService
|
4
|
+
class << self
|
5
|
+
# REFACTOR_ME:
|
6
|
+
# Uffizzi.ui.output_format = Uffizzi::UI::Shell::PRETTY_LIST
|
7
|
+
# Uffizzi.ui.say(data)
|
8
|
+
def render_plain_clusters(clusters)
|
9
|
+
clusters.map do |cluster|
|
10
|
+
project_name = cluster.dig(:project, :name)
|
11
|
+
|
12
|
+
if project_name.present?
|
13
|
+
"- Cluster name: #{cluster[:name].strip} Project name: #{project_name.strip}"
|
14
|
+
else
|
15
|
+
"- #{cluster[:name]}"
|
16
|
+
end
|
17
|
+
end.join("\n")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'uffizzi/helpers/config_helper'
|
4
|
+
require 'uffizzi/services/kubeconfig_service'
|
5
|
+
|
6
|
+
class ClusterUpdateKubeconfigService
|
7
|
+
class << self
|
8
|
+
def say_error_update_kubeconfig(cluster_data)
|
9
|
+
if ClusterService.failed?(cluster_data[:state])
|
10
|
+
Uffizzi.ui.say_error_and_exit('Kubeconfig is empty because cluster failed to be created.')
|
11
|
+
end
|
12
|
+
|
13
|
+
if ClusterService.deploying?(cluster_data[:state])
|
14
|
+
Uffizzi.ui.say_error_and_exit('Kubeconfig is empty because cluster is deploying.')
|
15
|
+
end
|
16
|
+
|
17
|
+
if ClusterService.deployed?(cluster_data[:state])
|
18
|
+
raise Error.new("Cluster with data: #{cluster_data.to_json} is deployed but kubeconfig does not exist.")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/uffizzi/shell.rb
CHANGED
@@ -83,7 +83,7 @@ module Uffizzi
|
|
83
83
|
when Array
|
84
84
|
data.map { |v| format_to_pretty_list(v) }.join("\n\n")
|
85
85
|
when Hash
|
86
|
-
data.map { |k, v| "- #{k.to_s.
|
86
|
+
data.map { |k, v| "- #{k.to_s.capitalize.gsub('_', ' ')}: #{v}" }.join("\n").strip
|
87
87
|
else
|
88
88
|
data
|
89
89
|
end
|
data/lib/uffizzi/version.rb
CHANGED
data/lib/uffizzi.rb
CHANGED
@@ -6,6 +6,7 @@ require 'sentry-ruby'
|
|
6
6
|
require 'active_support'
|
7
7
|
require 'active_support/core_ext/hash/indifferent_access'
|
8
8
|
require 'active_support/core_ext/object/blank'
|
9
|
+
require 'launchy'
|
9
10
|
|
10
11
|
require 'thor'
|
11
12
|
require 'uffizzi/error'
|
@@ -52,5 +53,9 @@ module Uffizzi
|
|
52
53
|
def at_exit(&block)
|
53
54
|
Kernel.at_exit(&block)
|
54
55
|
end
|
56
|
+
|
57
|
+
def launchy
|
58
|
+
Launchy
|
59
|
+
end
|
55
60
|
end
|
56
61
|
end
|
data/man/uffizzi-cluster-create
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
.\" generated with Ronn-NG/v0.9.1
|
2
2
|
.\" http://github.com/apjanke/ronn-ng/tree/0.9.1
|
3
|
-
.TH "UFFIZZI\-CLUSTER\-CREATE" "" "
|
3
|
+
.TH "UFFIZZI\-CLUSTER\-CREATE" "" "October 2023" ""
|
4
4
|
.SH "NAME"
|
5
|
-
\fBuffizzi\-cluster\-create\fR
|
5
|
+
\fBuffizzi\-cluster\-create\fR
|
6
|
+
.P
|
7
|
+
uffizzi cluster create \-h uffizzi\-cluster\-create \- create a cluster ================================================================
|
6
8
|
.SH "SYNOPSIS"
|
7
9
|
.nf
|
8
10
|
uffizzi cluster create [CLUSTER_NAME]
|
@@ -19,7 +21,14 @@ https://docs\.uffizzi\.com/references/cli/
|
|
19
21
|
.nf
|
20
22
|
\-\-name
|
21
23
|
Option is deprecated and will be removed in the newer versions\.
|
22
|
-
Please use a positional argument instead: uffizzi cluster create
|
24
|
+
Please use a positional argument instead: uffizzi cluster create
|
25
|
+
my\-awesome\-name\.
|
26
|
+
|
27
|
+
\-\-k8s\-version=<api\-version>
|
28
|
+
Specify which version of the Kubernetes API to use when creating
|
29
|
+
the cluster, formatted as [MAJOR]\.[MINOR]\. Defaults to 1\.27\.
|
30
|
+
Minor versions point to the latest release of the corresponding k3s
|
31
|
+
minor version\. See https://github\.com/k3s\-io/k3s/releases
|
23
32
|
|
24
33
|
\-\-kubeconfig="/path/to/your/kubeconfig"
|
25
34
|
Path to kubeconfig file
|
@@ -0,0 +1,27 @@
|
|
1
|
+
.\" generated with Ronn-NG/v0.9.1
|
2
|
+
.\" http://github.com/apjanke/ronn-ng/tree/0.9.1
|
3
|
+
.TH "UFFIZZI\-DEV\-INGRESS" "" "October 2023" ""
|
4
|
+
.SH "NAME"
|
5
|
+
\fBuffizzi\-dev\-ingress\fR
|
6
|
+
.P
|
7
|
+
$ uffizzi dev ingress \-h uffizzi\-dev\-ingress \- show the dev environment ingress ================================================================
|
8
|
+
.SH "SYNOPSIS"
|
9
|
+
.nf
|
10
|
+
uffizzi dev ingress COMMAND
|
11
|
+
.fi
|
12
|
+
.SH "DESCRIPTION"
|
13
|
+
.nf
|
14
|
+
Show the dev environment ingress
|
15
|
+
|
16
|
+
For more information on Uffizzi clusters, see:
|
17
|
+
https://docs\.uffizzi\.com/references/cli/
|
18
|
+
.fi
|
19
|
+
.SH "COMMANDS"
|
20
|
+
.nf
|
21
|
+
COMMAND is one of the following:
|
22
|
+
|
23
|
+
open
|
24
|
+
Open the dev environment ingress hosts in browser
|
25
|
+
.fi
|
26
|
+
.SH "Run \'uffizzi dev ingress COMMAND \-\-help\' for more information on a command\."
|
27
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
.\" generated with Ronn-NG/v0.9.1
|
2
|
+
.\" http://github.com/apjanke/ronn-ng/tree/0.9.1
|
3
|
+
.TH "UFFIZZI\-DEV\-INGRESS\-OPEN" "" "October 2023" ""
|
4
|
+
.SH "NAME"
|
5
|
+
\fBuffizzi\-dev\-ingress\-open\fR
|
6
|
+
.P
|
7
|
+
$ uffizzi dev ingress \-h uffizzi\-dev\-ingress\-open \- open the dev environment ingress hosts in browser ================================================================
|
8
|
+
.SH "SYNOPSIS"
|
9
|
+
.nf
|
10
|
+
uffizzi dev ingress open
|
11
|
+
.fi
|
12
|
+
.SH "DESCRIPTION"
|
13
|
+
.nf
|
14
|
+
Open the dev environment ingress hosts in browser
|
15
|
+
|
16
|
+
For more information on Uffizzi clusters, see:
|
17
|
+
https://docs\.uffizzi\.com/references/cli/
|
18
|
+
.fi
|
19
|
+
.SH "EXAMPLES"
|
20
|
+
.nf
|
21
|
+
The following command open the dev environment
|
22
|
+
ingress hosts in browser:
|
23
|
+
|
24
|
+
$ uffizzi dev ingress open
|
25
|
+
.fi
|
26
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
$ uffizzi dev ingress -h
|
2
|
+
uffizzi-dev-ingress-open - open the dev environment ingress hosts in browser
|
3
|
+
================================================================
|
4
|
+
|
5
|
+
## SYNOPSIS
|
6
|
+
uffizzi dev ingress open
|
7
|
+
|
8
|
+
## DESCRIPTION
|
9
|
+
Open the dev environment ingress hosts in browser
|
10
|
+
|
11
|
+
For more information on Uffizzi clusters, see:
|
12
|
+
https://docs.uffizzi.com/references/cli/
|
13
|
+
|
14
|
+
## EXAMPLES
|
15
|
+
The following command open the dev environment
|
16
|
+
ingress hosts in browser:
|
17
|
+
|
18
|
+
$ uffizzi dev ingress open
|
@@ -0,0 +1,21 @@
|
|
1
|
+
$ uffizzi dev ingress -h
|
2
|
+
uffizzi-dev-ingress - show the dev environment ingress
|
3
|
+
================================================================
|
4
|
+
|
5
|
+
## SYNOPSIS
|
6
|
+
uffizzi dev ingress COMMAND
|
7
|
+
|
8
|
+
## DESCRIPTION
|
9
|
+
Show the dev environment ingress
|
10
|
+
|
11
|
+
For more information on Uffizzi clusters, see:
|
12
|
+
https://docs.uffizzi.com/references/cli/
|
13
|
+
|
14
|
+
## COMMANDS
|
15
|
+
COMMAND is one of the following:
|
16
|
+
|
17
|
+
open
|
18
|
+
Open the dev environment ingress hosts in browser
|
19
|
+
|
20
|
+
##
|
21
|
+
Run 'uffizzi dev ingress COMMAND --help' for more information on a command.
|
data/man/uffizzi-dev-start
CHANGED
@@ -37,10 +37,11 @@ https://docs\.uffizzi\.com/references/cli/
|
|
37
37
|
.fi
|
38
38
|
.SH "FLAGS"
|
39
39
|
.nf
|
40
|
-
\-\-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
\-\-k8s\-version=<api\-version>
|
41
|
+
Specify which version of the Kubernetes API to use when creating
|
42
|
+
the cluster, formatted as [MAJOR]\.[MINOR]\. Defaults to 1\.27\.
|
43
|
+
Minor versions point to the latest release of the corresponding k3s
|
44
|
+
minor version\. See https://github\.com/k3s\-io/k3s/releases
|
44
45
|
|
45
46
|
\-\-default\-repo="<container\-registry\-domain>"
|
46
47
|
A public or private repo used to push/pull build
|
data/man/uffizzi-dev-start.ronn
CHANGED
@@ -20,8 +20,6 @@ uffizzi-dev-start - start a development environment
|
|
20
20
|
supported. For help creating a skaffold.yaml file, see:
|
21
21
|
https://skaffold.dev/docs/init/
|
22
22
|
|
23
|
-
If a kubeconfig exists
|
24
|
-
|
25
23
|
For more information on Uffizzi clusters, see:
|
26
24
|
https://docs.uffizzi.com/references/cli/
|
27
25
|
|
@@ -73,17 +71,6 @@ uffizzi-dev-start - start a development environment
|
|
73
71
|
|
74
72
|
$ uffizzi dev start --quiet
|
75
73
|
|
76
|
-
To push your build artifacts to a private Docker Hub repo
|
77
|
-
called 'acme/foo', first add your Docker Hub credentials:
|
78
|
-
|
79
|
-
$ uffizzi connect docker-hub
|
80
|
-
(See `uffizzi connect -h` for other registry options)
|
81
|
-
|
82
|
-
...then override the default repo:
|
83
|
-
|
84
|
-
$ uffizzi dev start \
|
85
|
-
--default-repo="hub.docker.com/acme/foo"
|
86
|
-
|
87
74
|
To start a dev environment using an alternate kubeconfig file,
|
88
75
|
run:
|
89
76
|
|
data/man/uffizzi-dev-stop.ronn
CHANGED
@@ -5,23 +5,11 @@ uffizzi-dev-stop - stop a development environment
|
|
5
5
|
uffizzi dev stop
|
6
6
|
|
7
7
|
## DESCRIPTION
|
8
|
-
Stops
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
This command watches for file changes in a given local
|
14
|
-
project directory, as specified in your configuration file.
|
15
|
-
It then serializes those changes and redeploys them onto
|
16
|
-
a Uffizzi cluster.
|
17
|
-
|
18
|
-
The command looks for a configuration at the specified
|
19
|
-
path CONFIG_FILE. Skaffold configurations are currently
|
20
|
-
supported. For help creating a skaffold.yaml file, see:
|
21
|
-
https://skaffold.dev/docs/init/
|
22
|
-
|
23
|
-
For more information on Uffizzi clusters, see:
|
24
|
-
https://docs.uffizzi.com/references/cli/
|
8
|
+
Stops the skaffold process for the dev environment.
|
9
|
+
This command does not delete the dev cluster or any
|
10
|
+
associated resources. You can restart the dev environment
|
11
|
+
with `uffizzi dev start`. To delete the dev cluster entirely, see
|
12
|
+
`uffizzi dev delete`.
|
25
13
|
|
26
14
|
## FLAGS
|
27
15
|
--help, -h
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uffizzi-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Thurman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-10-
|
12
|
+
date: 2023-10-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -424,6 +424,7 @@ files:
|
|
424
424
|
- lib/uffizzi/cli/config.rb
|
425
425
|
- lib/uffizzi/cli/connect.rb
|
426
426
|
- lib/uffizzi/cli/dev.rb
|
427
|
+
- lib/uffizzi/cli/dev/ingress.rb
|
427
428
|
- lib/uffizzi/cli/disconnect.rb
|
428
429
|
- lib/uffizzi/cli/login.rb
|
429
430
|
- lib/uffizzi/cli/login_by_identity_token.rb
|
@@ -446,7 +447,12 @@ files:
|
|
446
447
|
- lib/uffizzi/helpers/project_helper.rb
|
447
448
|
- lib/uffizzi/promt.rb
|
448
449
|
- lib/uffizzi/response_helper.rb
|
450
|
+
- lib/uffizzi/services/cluster/common_service.rb
|
451
|
+
- lib/uffizzi/services/cluster/create_service.rb
|
452
|
+
- lib/uffizzi/services/cluster/delete_service.rb
|
449
453
|
- lib/uffizzi/services/cluster/disconnect_service.rb
|
454
|
+
- lib/uffizzi/services/cluster/list_service.rb
|
455
|
+
- lib/uffizzi/services/cluster/update_kubeconfig_service.rb
|
450
456
|
- lib/uffizzi/services/cluster_service.rb
|
451
457
|
- lib/uffizzi/services/compose_file_service.rb
|
452
458
|
- lib/uffizzi/services/dev_service.rb
|
@@ -524,6 +530,10 @@ files:
|
|
524
530
|
- man/uffizzi-dev
|
525
531
|
- man/uffizzi-dev-describe
|
526
532
|
- man/uffizzi-dev-describe.ronn
|
533
|
+
- man/uffizzi-dev-ingress
|
534
|
+
- man/uffizzi-dev-ingress-open
|
535
|
+
- man/uffizzi-dev-ingress-open.ronn
|
536
|
+
- man/uffizzi-dev-ingress.ronn
|
527
537
|
- man/uffizzi-dev-start
|
528
538
|
- man/uffizzi-dev-start.ronn
|
529
539
|
- man/uffizzi-dev-stop
|