uffizzi-cli 2.0.35 → 2.0.37

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: 2ce4e169f833a82e239af7385a2ad4c46f01d1150d19f85f3feedff4a98e4279
4
- data.tar.gz: a4e435c280b9b5658c1b0048f73f78c5b245e8e37a4d5709d15eea8862d99ca9
3
+ metadata.gz: f2764a609f5446a2b7f1a11ac9ec37619b14f441278dd220142edbab2b106876
4
+ data.tar.gz: 5f7196a3c7ef61b8d67685d14ce806b7651c9141de0795cb09248455602fed48
5
5
  SHA512:
6
- metadata.gz: 9dbbf25f1500a9ad99a4a4ec27a9524d7a7c2ead0ca0231af6949f0dd67663cf687da3ff98336d5473f332d90abd8d55e4c11a0e92358e508e6943c5eefc097a
7
- data.tar.gz: b38e45251cb074ed709e0fb169108e23f758af7ba9e3473f01e2db7d67e0964181a8c3a4a2a3093cbd52e2ade39c0d3610da71ec1d42cddaa648075040955286
6
+ metadata.gz: 741e72b2f9c8c20c6a1bd7631af35f55b321b785b5defb052ea98cd273df80edc31223527bf30bffd59f5f0f3c0269f771ca6473be61292e8b8e985414bd0a44
7
+ data.tar.gz: f3f0f3ab58fcda3b73d8ab178a79d79591f8a86e63ae7e5d78b70eb3e6188732fb7e65a3e664bb0ada2cb7d04a0cb4c51281857b2165a833d2baf193fcbf5ca2
@@ -8,6 +8,8 @@ module Uffizzi
8
8
  end
9
9
 
10
10
  def sign_out
11
+ return unless Uffizzi::ConfigFile.exists?
12
+
11
13
  Uffizzi::ConfigFile.unset_option(:cookie)
12
14
  Uffizzi::ConfigFile.unset_option(:account)
13
15
  Uffizzi::ConfigFile.unset_option(:project)
@@ -9,6 +9,7 @@ require 'uffizzi/services/preview_service'
9
9
  require 'uffizzi/services/command_service'
10
10
  require 'uffizzi/services/cluster_service'
11
11
  require 'uffizzi/services/kubeconfig_service'
12
+ require 'uffizzi/services/cluster/disconnect_service'
12
13
 
13
14
  MANUAL = 'manual'
14
15
 
@@ -24,15 +25,15 @@ module Uffizzi
24
25
  run('list')
25
26
  end
26
27
 
27
- desc 'create', 'Create a cluster'
28
+ desc 'create [NAME]', 'Create a cluster'
28
29
  method_option :name, type: :string, required: false, aliases: '-n'
29
30
  method_option :kubeconfig, type: :string, required: false, aliases: '-k'
30
31
  method_option :manifest, type: :string, required: false, aliases: '-m'
31
- method_option :'update-current-context', type: :boolean, required: false
32
+ method_option :'update-current-context', type: :boolean, required: false, default: true
32
33
  method_option :output, required: false, type: :string, aliases: '-o', enum: ['json', 'pretty-json']
33
34
  method_option :'creation-source', required: false, type: :string
34
- def create
35
- run('create')
35
+ def create(name = nil)
36
+ run('create', { name: name })
36
37
  end
37
38
 
38
39
  desc 'describe [NAME]', 'Describe a cluster'
@@ -42,7 +43,7 @@ module Uffizzi
42
43
  end
43
44
 
44
45
  desc 'delete [NAME]', 'Delete a cluster'
45
- method_option :'delete-config', required: false, type: :boolean, aliases: '-dc'
46
+ method_option :'delete-config', required: false, type: :boolean, default: true
46
47
  def delete(name)
47
48
  run('delete', cluster_name: name)
48
49
  end
@@ -55,6 +56,13 @@ module Uffizzi
55
56
  run('update-kubeconfig', cluster_name: name)
56
57
  end
57
58
 
59
+ method_option :kubeconfig, type: :string, aliases: '-k'
60
+ method_option :ask, type: :boolean
61
+ desc 'disconnect', 'Switch back to original kubeconfig current context'
62
+ def disconnect
63
+ run('disconnect')
64
+ end
65
+
58
66
  private
59
67
 
60
68
  def run(command, command_args = {})
@@ -68,13 +76,15 @@ module Uffizzi
68
76
  when 'list'
69
77
  handle_list_command(project_slug)
70
78
  when 'create'
71
- handle_create_command(project_slug)
79
+ handle_create_command(project_slug, command_args)
72
80
  when 'describe'
73
81
  handle_describe_command(project_slug, command_args)
74
82
  when 'delete'
75
83
  handle_delete_command(project_slug, command_args)
76
84
  when 'update-kubeconfig'
77
85
  handle_update_kubeconfig_command(project_slug, command_args)
86
+ when 'disconnect'
87
+ ClusterDisconnectService.handle(options)
78
88
  end
79
89
  end
80
90
 
@@ -94,9 +104,17 @@ module Uffizzi
94
104
  end
95
105
  end
96
106
 
97
- def handle_create_command(project_slug)
107
+ # rubocop:disable Metrics/PerceivedComplexity
108
+ def handle_create_command(project_slug, command_args)
98
109
  Uffizzi.ui.disable_stdout if Uffizzi.ui.output_format
99
- cluster_name = options[:name] || ClusterService.generate_name
110
+
111
+ if options[:name]
112
+ msg = 'DEPRECATION WARNING: The --name option is deprecated and will be removed in the newer versions.' \
113
+ ' Please use a positional argument instead: uffizzi cluster create my-awesome-name'
114
+ Uffizzi.ui.say(msg)
115
+ end
116
+
117
+ cluster_name = command_args[:name] || options[:name] || ClusterService.generate_name
100
118
  creation_source = options[:"creation-source"] || MANUAL
101
119
 
102
120
  unless ClusterService.valid_name?(cluster_name)
@@ -123,6 +141,7 @@ module Uffizzi
123
141
  rescue SystemExit, Interrupt, SocketError
124
142
  handle_interrupt_creation(cluster_name, ConfigFile.read_option(:server), project_slug)
125
143
  end
144
+ # rubocop:enable Metrics/PerceivedComplexity
126
145
 
127
146
  def handle_describe_command(project_slug, command_args)
128
147
  cluster_data = fetch_cluster_data(project_slug, command_args[:cluster_name])
@@ -140,7 +159,7 @@ module Uffizzi
140
159
  kubeconfig = parse_kubeconfig(cluster_data[:kubeconfig])
141
160
 
142
161
  handle_delete_cluster(project_slug, cluster_name)
143
- exclude_kubeconfig(cluster_data[:id], kubeconfig)
162
+ exclude_kubeconfig(cluster_data[:id], kubeconfig) if kubeconfig.present?
144
163
  end
145
164
 
146
165
  def exclude_kubeconfig(cluster_id, kubeconfig)
@@ -191,8 +210,14 @@ module Uffizzi
191
210
 
192
211
  KubeconfigService.save_to_filepath(kubeconfig_path, parsed_kubeconfig) do |kubeconfig_by_path|
193
212
  merged_kubeconfig = KubeconfigService.merge(kubeconfig_by_path, parsed_kubeconfig)
194
- current_context = KubeconfigService.get_current_context(parsed_kubeconfig)
195
- KubeconfigService.update_current_context(merged_kubeconfig, current_context)
213
+ new_current_context = KubeconfigService.get_current_context(parsed_kubeconfig)
214
+ new_kubeconfig = KubeconfigService.update_current_context(merged_kubeconfig, new_current_context)
215
+
216
+ next new_kubeconfig if kubeconfig_by_path.nil?
217
+
218
+ previous_current_context = KubeconfigService.get_current_context(kubeconfig_by_path)
219
+ save_previous_current_context(kubeconfig_path, previous_current_context)
220
+ new_kubeconfig
196
221
  end
197
222
 
198
223
  update_clusters_config(cluster_data[:id], kubeconfig_path: kubeconfig_path)
@@ -292,7 +317,7 @@ module Uffizzi
292
317
  end
293
318
 
294
319
  def handle_succeed_create_response(cluster_data)
295
- kubeconfig_path = options[:kubeconfig]
320
+ kubeconfig_path = options[:kubeconfig] || KubeconfigService.default_path
296
321
  is_update_current_context = options[:'update-current-context']
297
322
  parsed_kubeconfig = parse_kubeconfig(cluster_data[:kubeconfig])
298
323
  rendered_cluster_data = render_cluster_data(cluster_data)
@@ -319,8 +344,14 @@ module Uffizzi
319
344
  merged_kubeconfig = KubeconfigService.merge(kubeconfig_by_path, kubeconfig)
320
345
 
321
346
  if is_update_current_context
322
- current_context = KubeconfigService.get_current_context(kubeconfig)
323
- KubeconfigService.update_current_context(merged_kubeconfig, current_context)
347
+ new_current_context = KubeconfigService.get_current_context(kubeconfig)
348
+ new_kubeconfig = KubeconfigService.update_current_context(merged_kubeconfig, new_current_context)
349
+
350
+ next new_kubeconfig if kubeconfig_by_path.nil?
351
+
352
+ previous_current_context = KubeconfigService.get_current_context(kubeconfig_by_path)
353
+ save_previous_current_context(kubeconfig_path, previous_current_context)
354
+ new_kubeconfig
324
355
  else
325
356
  merged_kubeconfig
326
357
  end
@@ -343,6 +374,8 @@ module Uffizzi
343
374
  end
344
375
 
345
376
  def parse_kubeconfig(kubeconfig)
377
+ return if kubeconfig.nil?
378
+
346
379
  Psych.safe_load(Base64.decode64(kubeconfig))
347
380
  end
348
381
 
@@ -359,5 +392,12 @@ module Uffizzi
359
392
  ResponseHelper.handle_failed_response(response)
360
393
  end
361
394
  end
395
+
396
+ def save_previous_current_context(kubeconfig_path, current_context)
397
+ return if kubeconfig_path.nil? || ConfigHelper.previous_current_context_by_path(kubeconfig_path).present?
398
+
399
+ previous_current_contexts = Uffizzi::ConfigHelper.set_previous_current_context_by_path(kubeconfig_path, current_context)
400
+ ConfigFile.write_option(:previous_current_contexts, previous_current_contexts)
401
+ end
362
402
  end
363
403
  end
@@ -21,7 +21,7 @@ module Uffizzi
21
21
 
22
22
  def run
23
23
  AuthHelper.sign_out if AuthHelper.signed_in?
24
- return perform_email_login if @options[:email]
24
+ return perform_email_login unless @options[:email].nil?
25
25
 
26
26
  perform_browser_login
27
27
  end
@@ -45,7 +45,7 @@ module Uffizzi
45
45
  def perform_browser_login
46
46
  session_id = SecureRandom.uuid
47
47
  response = create_access_token(@server, session_id)
48
- return handle_failed_response(response) unless ResponseHelper.created?(response)
48
+ return ResponseHelper.handle_failed_response(response) unless ResponseHelper.created?(response)
49
49
 
50
50
  url = browser_sign_in_url(@server, session_id)
51
51
  open_browser(url)
@@ -68,7 +68,7 @@ module Uffizzi
68
68
  token = response[:body][:access_token]
69
69
  Uffizzi::Token.delete
70
70
  Uffizzi::Token.write(token)
71
- Uffizzi.ui.say('Login successfull')
71
+ Uffizzi.ui.say('Login successful')
72
72
 
73
73
  set_current_account_and_project
74
74
  end
@@ -84,7 +84,7 @@ module Uffizzi
84
84
  ConfigFile.write_option(:server, @server)
85
85
  ConfigFile.write_option(:username, username)
86
86
  ConfigFile.write_option(:cookie, response[:headers])
87
- Uffizzi.ui.say('Login successfull')
87
+ Uffizzi.ui.say('Login successful')
88
88
 
89
89
  if ENV.fetch('CI_PIPELINE_RUN', false)
90
90
  account = response[:body][:user][:default_account]
@@ -79,6 +79,8 @@ module Uffizzi
79
79
  else
80
80
  ResponseHelper.handle_invalid_compose_response(response)
81
81
  end
82
+ elsif ResponseHelper.not_found?(response)
83
+ Uffizzi.ui.say('The project does not have a compose file set.')
82
84
  else
83
85
  ResponseHelper.handle_failed_response(response)
84
86
  end
data/lib/uffizzi/cli.rb CHANGED
@@ -19,7 +19,7 @@ module Uffizzi
19
19
  desc 'login [OPTIONS]', 'Login to Uffizzi to view and manage your previews'
20
20
  method_option :server, required: false, aliases: '-s'
21
21
  method_option :username, required: false, aliases: '-u'
22
- method_option :email, required: false, aliases: '-e'
22
+ method_option :email, required: false, aliases: '-e', lazy_default: ''
23
23
  def login
24
24
  require_relative 'cli/login'
25
25
  Login.new(options).run
@@ -121,7 +121,7 @@ module Uffizzi
121
121
  when Thor::Error
122
122
  raise exception
123
123
  when Interrupt
124
- raise Uffizzi::CliError.new('The command was interrupted')
124
+ nil
125
125
  when StandardError
126
126
  raise Uffizzi::CliError.new(exception.message)
127
127
  else
@@ -39,11 +39,28 @@ module Uffizzi
39
39
  clusters.detect { |c| c[:id] == id }
40
40
  end
41
41
 
42
+ def set_previous_current_context_by_path(path, current_context)
43
+ current_contexts = previous_current_contexts_without(path)
44
+ current_contexts << { current_context: current_context, kubeconfig_path: path }
45
+ end
46
+
47
+ def previous_current_contexts_without(path)
48
+ cluster_previous_current_contexts.reject { |c| c[:kubeconfig_path] == path }
49
+ end
50
+
51
+ def previous_current_context_by_path(path)
52
+ cluster_previous_current_contexts.detect { |c| c[:kubeconfig_path] == path }
53
+ end
54
+
42
55
  private
43
56
 
44
57
  def clusters
45
58
  read_option_from_config(:clusters) || []
46
59
  end
60
+
61
+ def cluster_previous_current_contexts
62
+ read_option_from_config(:previous_current_contexts) || []
63
+ end
47
64
  end
48
65
  end
49
66
  end
@@ -16,13 +16,14 @@ module Uffizzi
16
16
 
17
17
  def set_server(options)
18
18
  config_server = ConfigFile.exists? ? Uffizzi::ConfigHelper.read_option_from_config(:server) : nil
19
- server_address = (options[:server] || config_server || Uffizzi.ui.ask('Server:')).sub(/\/+$/, '')
19
+ server_address = options[:server] || config_server || Uffizzi.configuration.default_server.to_s
20
20
  server_address.start_with?('http:', 'https:') ? server_address : "https://#{server_address}"
21
21
  end
22
22
 
23
23
  def set_username(options)
24
24
  config_username = ConfigFile.exists? ? Uffizzi::ConfigHelper.read_option_from_config(:username) : nil
25
- options[:username] || config_username || Uffizzi.ui.ask('Username:')
25
+ options_username = options[:email].present? ? options[:email] : nil
26
+ options_username || config_username || Uffizzi.ui.ask('Username:')
26
27
  end
27
28
 
28
29
  def set_password
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'uffizzi/helpers/config_helper'
4
+ require 'uffizzi/services/cluster_service'
5
+ require 'uffizzi/services/kubeconfig_service'
6
+
7
+ class ClusterDisconnectService
8
+ class << self
9
+ def handle(options)
10
+ kubeconfig_path = options[:kubeconfig] || KubeconfigService.default_path
11
+ is_ask_origin_current_context = options[:ask]
12
+
13
+ prev_current_context = Uffizzi::ConfigHelper.previous_current_context_by_path(kubeconfig_path)&.fetch(:current_context, nil)
14
+ kubeconfig = KubeconfigService.read_kubeconfig(kubeconfig_path)
15
+
16
+ if kubeconfig.nil?
17
+ return Uffizzi.ui.say("Kubeconfig does not exist by path #{kubeconfig_path}")
18
+ end
19
+
20
+ contexts = KubeconfigService.get_cluster_contexts(kubeconfig)
21
+ current_context = KubeconfigService.get_current_context(kubeconfig)
22
+
23
+ if contexts.empty?
24
+ return Uffizzi.ui.say("No contexts by kubeconfig path #{kubeconfig_path}")
25
+ end
26
+
27
+ if KubeconfigService.find_cluster_contexts_by_name(kubeconfig, prev_current_context).present? &&
28
+ prev_current_context != current_context &&
29
+ !is_ask_origin_current_context
30
+ update_current_context_by_filepath(kubeconfig_path, prev_current_context)
31
+ say_success(prev_current_context, kubeconfig_path)
32
+ return
33
+ end
34
+
35
+ new_current_context = ask_context(contexts, current_context)
36
+ update_current_context_by_filepath(kubeconfig_path, new_current_context)
37
+ set_previous_current_context_to_config(kubeconfig_path, new_current_context)
38
+ say_success(new_current_context, kubeconfig_path)
39
+ end
40
+
41
+ private
42
+
43
+ def say_success(current_context, kubeconfig_path)
44
+ Uffizzi.ui.say("Now your current context is '#{current_context}' for kubeconfig path '#{kubeconfig_path}'")
45
+ end
46
+
47
+ def update_current_context_by_filepath(filepath, current_context)
48
+ KubeconfigService.save_to_filepath(filepath) do |kubeconfig|
49
+ KubeconfigService.update_current_context(kubeconfig, current_context)
50
+ end
51
+ end
52
+
53
+ def set_previous_current_context_to_config(kubeconfig_path, current_context)
54
+ previous_current_contexts = Uffizzi::ConfigHelper.set_previous_current_context_by_path(kubeconfig_path, current_context)
55
+ Uffizzi::ConfigFile.write_option(:previous_current_contexts, previous_current_contexts)
56
+ end
57
+
58
+ def ask_context(contexts, current_context)
59
+ context_names = contexts
60
+ .map { |c| { name: c['name'], value: c['name'] } }
61
+ .reject { |c| c[:value] == current_context }
62
+
63
+ if context_names.empty?
64
+ return Uffizzi.ui.say_error_and_exit('No other contexts')
65
+ end
66
+
67
+ question = 'Select origin context to switch on:'
68
+ Uffizzi.prompt.select(question, context_names)
69
+ end
70
+ end
71
+ end
@@ -8,6 +8,7 @@ class ClusterService
8
8
  CLUSTER_STATE_DEPLOYED = 'deployed'
9
9
  CLUSTER_STATE_FAILED_DEPLOY_NAMESPACE = 'failed_deploy_namespace'
10
10
  CLUSTER_STATE_FAILED = 'failed'
11
+ CLUSTER_NAME_MAX_LENGTH = 15
11
12
 
12
13
  class << self
13
14
  include ApiClient
@@ -42,7 +43,7 @@ class ClusterService
42
43
  end
43
44
 
44
45
  def generate_name
45
- name = [Faker::Name.first_name, Faker::Name.last_name].map(&:downcase).join('-')
46
+ name = Faker::Internet.domain_word[0..CLUSTER_NAME_MAX_LENGTH]
46
47
 
47
48
  return name if valid_name?(name)
48
49
 
@@ -41,15 +41,25 @@ class KubeconfigService
41
41
  end
42
42
 
43
43
  def get_first_context(kubeconfig)
44
- kubeconfig.fetch('contexts', [])[0]
44
+ get_cluster_contexts(kubeconfig)[0]
45
45
  end
46
46
 
47
47
  def get_current_cluster_name(kubeconfig)
48
- kubeconfig['contexts']
48
+ get_cluster_contexts(kubeconfig)
49
49
  .detect { |c| c['name'] == get_current_context(kubeconfig) }
50
50
  .dig('context', 'cluster')
51
51
  end
52
52
 
53
+ def get_cluster_contexts(kubeconfig)
54
+ kubeconfig.fetch('contexts', [])
55
+ end
56
+
57
+ def find_cluster_contexts_by_name(kubeconfig, context_name)
58
+ return if context_name.nil?
59
+
60
+ get_cluster_contexts(kubeconfig).detect { |c| c['name'] == context_name }
61
+ end
62
+
53
63
  def update_current_context(kubeconfig, current_context)
54
64
  new_kubeconfig = kubeconfig.deep_dup
55
65
  new_kubeconfig['current-context'] = current_context
@@ -57,9 +67,8 @@ class KubeconfigService
57
67
  new_kubeconfig
58
68
  end
59
69
 
60
- def save_to_filepath(filepath, kubeconfig)
61
- real_file_path = File.expand_path(filepath)
62
- target_kubeconfig = File.exist?(real_file_path) ? Psych.safe_load(File.read(real_file_path)) : nil
70
+ def save_to_filepath(filepath, kubeconfig = nil)
71
+ target_kubeconfig = read_kubeconfig(filepath)
63
72
 
64
73
  if target_kubeconfig.present? && !valid_kubeconfig?(target_kubeconfig)
65
74
  raise InvalidKubeconfigError.new(filepath)
@@ -68,15 +77,31 @@ class KubeconfigService
68
77
  new_kubeconfig = block_given? ? yield(target_kubeconfig) : kubeconfig
69
78
  return if new_kubeconfig.nil?
70
79
 
71
- dir_path = File.dirname(real_file_path)
72
- FileUtils.mkdir_p(dir_path) unless File.directory?(dir_path)
73
- File.write(real_file_path, new_kubeconfig.to_yaml)
80
+ write_kubeconfig(filepath, new_kubeconfig)
74
81
  end
75
82
 
76
83
  def default_path
77
84
  kubeconfig_env_path || Uffizzi.configuration.default_kubeconfig_path
78
85
  end
79
86
 
87
+ def read_kubeconfig(filepath)
88
+ real_file_path = File.expand_path(filepath)
89
+ kubeconfig = File.exist?(real_file_path) ? Psych.safe_load(File.read(real_file_path)) : nil
90
+
91
+ if kubeconfig.present? && !valid_kubeconfig?(kubeconfig)
92
+ raise InvalidKubeconfigError.new(filepath)
93
+ end
94
+
95
+ kubeconfig
96
+ end
97
+
98
+ def write_kubeconfig(filepath, kubeconfig)
99
+ real_file_path = File.expand_path(filepath)
100
+ dir_path = File.dirname(real_file_path)
101
+ FileUtils.mkdir_p(dir_path) unless File.directory?(dir_path)
102
+ File.write(real_file_path, kubeconfig.to_yaml)
103
+ end
104
+
80
105
  private
81
106
 
82
107
  def cluster_exists_in_kubeconfig?(kubeconfig, cluster_name)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uffizzi
4
- VERSION = '2.0.35'
4
+ VERSION = '2.0.37'
5
5
  end
@@ -5,19 +5,21 @@
5
5
  \fBuffizzi\-cluster\-create\fR \- create a cluster
6
6
  .SH "SYNOPSIS"
7
7
  .nf
8
- uffizzi cluster create
8
+ uffizzi cluster create [CLUSTER_NAME]
9
9
  .fi
10
10
  .SH "DESCRIPTION"
11
11
  .nf
12
- Creates a new cluster\.
12
+ Creates a new cluster\. If no CLUSTER_NAME is specified,
13
+ the cluster is created with the auto generated name\.
13
14
 
14
15
  For more information on Uffizzi clusters, see:
15
16
  https://docs\.uffizzi\.com/references/cli/
16
17
  .fi
17
18
  .SH "FLAGS"
18
19
  .nf
19
- \-\-name=CLUSTER\-NAME
20
- Set cluster name
20
+ \-\- name
21
+ Option is deprecated and will be removed in the newer versions\.
22
+ Please use a positional argument instead: uffizzi cluster create my\-awesome\-name\.
21
23
 
22
24
  \-\-kubeconfig="/path/to/your/kubeconfig"
23
25
  Path to kubeconfig file
@@ -27,6 +29,7 @@ https://docs\.uffizzi\.com/references/cli/
27
29
 
28
30
  \-\-update\-current\-context
29
31
  Update current\-context in kubeconfig file
32
+ Default is true
30
33
 
31
34
  \-\-output=pretty\-json
32
35
  \-\-output=json
@@ -40,10 +43,10 @@ To create a cluster with the auto generated name, run:
40
43
 
41
44
  To create a cluster with name, run:
42
45
 
43
- $ uffizzi cluster create \-\-name="my\-cluster"
46
+ $ uffizzi cluster create my\-cluster
44
47
 
45
48
  To create a cluster from a manifests directory, run:
46
49
 
47
- $ uffizzi cluster create \-\-name="my\-cluster" \-\-manifest=manifests/
50
+ $ uffizzi cluster create my\-cluster \-\-manifest=manifests/
48
51
  .fi
49
52
 
@@ -2,17 +2,19 @@ uffizzi-cluster-create - create a cluster
2
2
  ================================================================
3
3
 
4
4
  ## SYNOPSIS
5
- uffizzi cluster create
5
+ uffizzi cluster create [CLUSTER_NAME]
6
6
 
7
7
  ## DESCRIPTION
8
- Creates a new cluster.
8
+ Creates a new cluster. If no CLUSTER_NAME is specified,
9
+ the cluster is created with the auto generated name.
9
10
 
10
11
  For more information on Uffizzi clusters, see:
11
12
  https://docs.uffizzi.com/references/cli/
12
13
 
13
14
  ## FLAGS
14
- --name=CLUSTER-NAME
15
- Set cluster name
15
+ --name
16
+ Option is deprecated and will be removed in the newer versions.
17
+ Please use a positional argument instead: uffizzi cluster create my-awesome-name.
16
18
 
17
19
  --kubeconfig="/path/to/your/kubeconfig"
18
20
  Path to kubeconfig file
@@ -22,6 +24,7 @@ uffizzi-cluster-create - create a cluster
22
24
 
23
25
  --update-current-context
24
26
  Update current-context in kubeconfig file
27
+ Default is true
25
28
 
26
29
  --output=pretty-json
27
30
  --output=json
@@ -34,8 +37,8 @@ uffizzi-cluster-create - create a cluster
34
37
 
35
38
  To create a cluster with name, run:
36
39
 
37
- $ uffizzi cluster create --name="my-cluster"
40
+ $ uffizzi cluster create my-cluster
38
41
 
39
42
  To create a cluster from a manifests directory, run:
40
43
 
41
- $ uffizzi cluster create --name="my-cluster" --manifest=manifests/
44
+ $ uffizzi cluster create my-cluster --manifest=manifests/
@@ -1,6 +1,6 @@
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\-DELETE" "" "August 2023" ""
3
+ .TH "UFFIZZI\-CLUSTER\-DELETE" "" "September 2023" ""
4
4
  .SH "NAME"
5
5
  \fBuffizzi\-cluster\-delete\fR \- delete a cluster
6
6
  .SH "SYNOPSIS"
@@ -23,6 +23,12 @@ https://docs\.uffizzi\.com/references/cli/
23
23
  [CLUSTER_NAME]
24
24
  Name for the cluster you want to delete\.
25
25
  .fi
26
+ .SH "FLAGS"
27
+ .nf
28
+ \-\-delete\-config=false
29
+ Delete cluster from kubeconfig\.
30
+ Default is true\.
31
+ .fi
26
32
  .SH "EXAMPLES"
27
33
  .nf
28
34
  The following command deletes the cluster with CLUSTER_NAME my\-cluster:
@@ -18,6 +18,11 @@ uffizzi-cluster-delete - delete a cluster
18
18
  [CLUSTER_NAME]
19
19
  Name for the cluster you want to delete.
20
20
 
21
+ ## FLAGS
22
+ --delete-config=false
23
+ Delete cluster from kubeconfig.
24
+ Default is true.
25
+
21
26
  ## EXAMPLES
22
27
  The following command deletes the cluster with CLUSTER_NAME my-cluster:
23
28
 
@@ -0,0 +1,40 @@
1
+ .\" generated with Ronn-NG/v0.9.1
2
+ .\" http://github.com/apjanke/ronn-ng/tree/0.9.1
3
+ .TH "UFFIZZI\-CLUSTER\-DISCONNECT" "" "September 2023" ""
4
+ .SH "NAME"
5
+ \fBuffizzi\-cluster\-disconnect\fR \- disconnect from current cluster context
6
+ .SH "SYNOPSIS"
7
+ .nf
8
+ uffizzi cluster disconnect
9
+ .fi
10
+ .SH "DESCRIPTION"
11
+ .nf
12
+ Switch current context to origin\.
13
+
14
+ For more information on Uffizzi clusters, see:
15
+ https://docs\.uffizzi\.com/references/cli/
16
+ .fi
17
+ .SH "FLAGS"
18
+ .nf
19
+ \-\-ask
20
+ Show list available contexts for kubeconfig and set new origin current context
21
+
22
+ \-\-kubeconfig="/path/to/your/kubeconfig"
23
+ Path to kubeconfig file
24
+ .fi
25
+ .SH "EXAMPLES"
26
+ .nf
27
+ To disconnect from current cluster context to origin context, run:
28
+
29
+ $ uffizzi cluster disconnect
30
+
31
+ To disconnect from current cluster context to origin context
32
+ and set new origin current context, run:
33
+
34
+ $ uffizzi cluster disconnect \-\-ask
35
+
36
+ To disconnect from current cluster context to origin context for current kubeconfig, run:
37
+
38
+ $ uffizzi cluster disconnect \-\-kubeconfig="/path/to/your/kubeconfig"
39
+ .fi
40
+
@@ -0,0 +1,32 @@
1
+ uffizzi-cluster-disconnect - disconnect from current cluster context
2
+ ====================================================================
3
+
4
+ ## SYNOPSIS
5
+ uffizzi cluster disconnect
6
+
7
+ ## DESCRIPTION
8
+ Switch current context to origin.
9
+
10
+ For more information on Uffizzi clusters, see:
11
+ https://docs.uffizzi.com/references/cli/
12
+
13
+ ## FLAGS
14
+ --ask
15
+ Show list available contexts for kubeconfig and set new origin current context
16
+
17
+ --kubeconfig="/path/to/your/kubeconfig"
18
+ Path to kubeconfig file
19
+
20
+ ## EXAMPLES
21
+ To disconnect from current cluster context to origin context, run:
22
+
23
+ $ uffizzi cluster disconnect
24
+
25
+ To disconnect from current cluster context to origin context
26
+ and set new origin current context, run:
27
+
28
+ $ uffizzi cluster disconnect --ask
29
+
30
+ To disconnect from current cluster context to origin context for current kubeconfig, run:
31
+
32
+ $ uffizzi cluster disconnect --kubeconfig="/path/to/your/kubeconfig"
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.0.35
4
+ version: 2.0.37
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-09-08 00:00:00.000000000 Z
12
+ date: 2023-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -445,6 +445,7 @@ files:
445
445
  - lib/uffizzi/helpers/project_helper.rb
446
446
  - lib/uffizzi/promt.rb
447
447
  - lib/uffizzi/response_helper.rb
448
+ - lib/uffizzi/services/cluster/disconnect_service.rb
448
449
  - lib/uffizzi/services/cluster_service.rb
449
450
  - lib/uffizzi/services/command_service.rb
450
451
  - lib/uffizzi/services/compose_file_service.rb
@@ -474,6 +475,8 @@ files:
474
475
  - man/uffizzi-cluster-delete.ronn
475
476
  - man/uffizzi-cluster-describe
476
477
  - man/uffizzi-cluster-describe.ronn
478
+ - man/uffizzi-cluster-disconnect
479
+ - man/uffizzi-cluster-disconnect.ronn
477
480
  - man/uffizzi-cluster-list
478
481
  - man/uffizzi-cluster-list.ronn
479
482
  - man/uffizzi-cluster-update-kubeconfig