uffizzi-cli 2.0.37 → 2.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2764a609f5446a2b7f1a11ac9ec37619b14f441278dd220142edbab2b106876
4
- data.tar.gz: 5f7196a3c7ef61b8d67685d14ce806b7651c9141de0795cb09248455602fed48
3
+ metadata.gz: 53375ab753d707ea69a899c201838dcc0874a185185532b64f3a3cb8b07720fa
4
+ data.tar.gz: 177486674f4ba6f11935536cd538ddc6e587ba5a330b738196f082b8fff96c3a
5
5
  SHA512:
6
- metadata.gz: 741e72b2f9c8c20c6a1bd7631af35f55b321b785b5defb052ea98cd273df80edc31223527bf30bffd59f5f0f3c0269f771ca6473be61292e8b8e985414bd0a44
7
- data.tar.gz: f3f0f3ab58fcda3b73d8ab178a79d79591f8a86e63ae7e5d78b70eb3e6188732fb7e65a3e664bb0ada2cb7d04a0cb4c51281857b2165a833d2baf193fcbf5ca2
6
+ metadata.gz: 7278e21c0ce0a61da3403a874d7ce1e1d9771fd9f45867e4fdf126840fb4ddbc0e86c037be58a3bd9d0311631a819081361c4626c78cf11fdab3e6c89380fee6
7
+ data.tar.gz: 3d09264798892e9c97074d073940922bb2e7703941496bc5a77c6ba555ba6de3e275c3151b7dbd480d9e7b6be6f350ea1e939898c33b2bcfc8e64b8f562d6193
@@ -11,8 +11,6 @@ require 'uffizzi/services/cluster_service'
11
11
  require 'uffizzi/services/kubeconfig_service'
12
12
  require 'uffizzi/services/cluster/disconnect_service'
13
13
 
14
- MANUAL = 'manual'
15
-
16
14
  module Uffizzi
17
15
  class Cli::Cluster < Thor
18
16
  class Error < StandardError; end
@@ -115,7 +113,7 @@ module Uffizzi
115
113
  end
116
114
 
117
115
  cluster_name = command_args[:name] || options[:name] || ClusterService.generate_name
118
- creation_source = options[:"creation-source"] || MANUAL
116
+ creation_source = options[:"creation-source"] || ClusterService::MANUAL_CREATION_SOURCE
119
117
 
120
118
  unless ClusterService.valid_name?(cluster_name)
121
119
  Uffizzi.ui.say_error_and_exit("Cluster name: #{cluster_name} is not valid.")
@@ -0,0 +1,198 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'uffizzi/services/command_service'
4
+ require 'uffizzi/services/cluster_service'
5
+ require 'uffizzi/services/dev_service'
6
+ require 'uffizzi/services/kubeconfig_service'
7
+
8
+ module Uffizzi
9
+ class Cli::Dev < Thor
10
+ include ApiClient
11
+
12
+ desc 'start [CONFIG]', 'Start dev environment'
13
+ method_option :quiet, type: :boolean, aliases: :q
14
+ method_option :'default-repo', type: :string
15
+ method_option :kubeconfig, type: :string
16
+ def start(config_path = 'skaffold.yaml')
17
+ DevService.check_skaffold_existence
18
+ DevService.check_running_daemon if options[:quiet]
19
+ DevService.check_skaffold_config_existence(config_path)
20
+ check_login
21
+ cluster_id, cluster_name = start_create_cluster
22
+ kubeconfig = wait_cluster_creation(cluster_name)
23
+
24
+ if options[:quiet]
25
+ launch_demonise_skaffold(config_path)
26
+ else
27
+ DevService.start_basic_skaffold(config_path, options)
28
+ end
29
+ ensure
30
+ if defined?(cluster_name).present? && defined?(cluster_id).present?
31
+ kubeconfig = defined?(kubeconfig).present? ? kubeconfig : nil
32
+ handle_delete_cluster(cluster_id, cluster_name, kubeconfig)
33
+ end
34
+ end
35
+
36
+ desc 'stop', 'Stop dev environment'
37
+ def stop
38
+ return Uffizzi.ui.say('Uffizzi dev is not running') unless File.exist?(DevService.pid_path)
39
+
40
+ pid = File.read(DevService.pid_path).to_i
41
+ File.delete(DevService.pid_path)
42
+
43
+ Uffizzi.process.kill('QUIT', pid)
44
+ Uffizzi.ui.say('Uffizzi dev was stopped')
45
+ rescue Errno::ESRCH
46
+ Uffizzi.ui.say('Uffizzi dev is not running')
47
+ File.delete(DevService.pid_path)
48
+ end
49
+
50
+ private
51
+
52
+ def check_login
53
+ raise Uffizzi::Error.new('You are not logged in.') unless Uffizzi::AuthHelper.signed_in?
54
+ raise Uffizzi::Error.new('This command needs project to be set in config file') unless CommandService.project_set?(options)
55
+ end
56
+
57
+ def start_create_cluster
58
+ cluster_name = ClusterService.generate_name
59
+ creation_source = ClusterService::MANUAL_CREATION_SOURCE
60
+ params = cluster_creation_params(cluster_name, creation_source)
61
+ Uffizzi.ui.say('Start creating a cluster')
62
+ response = create_cluster(ConfigFile.read_option(:server), project_slug, params)
63
+ return ResponseHelper.handle_failed_response(response) unless ResponseHelper.created?(response)
64
+
65
+ cluster_id = response.dig(:body, :cluster, :id)
66
+ cluster_name = response.dig(:body, :cluster, :name)
67
+
68
+ [cluster_id, cluster_name]
69
+ end
70
+
71
+ def wait_cluster_creation(cluster_name)
72
+ Uffizzi.ui.say('Checking the cluster status...')
73
+ cluster_data = ClusterService.wait_cluster_deploy(project_slug, cluster_name, ConfigFile.read_option(:oidc_token))
74
+
75
+ if ClusterService.failed?(cluster_data[:state])
76
+ Uffizzi.ui.say_error_and_exit("Cluster with name: #{cluster_name} failed to be created.")
77
+ end
78
+
79
+ handle_succeed_cluster_creation(cluster_data)
80
+ parse_kubeconfig(cluster_data[:kubeconfig])
81
+ end
82
+
83
+ def handle_succeed_cluster_creation(cluster_data)
84
+ kubeconfig_path = options[:kubeconfig] || KubeconfigService.default_path
85
+ parsed_kubeconfig = parse_kubeconfig(cluster_data[:kubeconfig])
86
+
87
+ Uffizzi.ui.say("Cluster with name: #{cluster_data[:name]} was created.")
88
+
89
+ save_kubeconfig(parsed_kubeconfig, kubeconfig_path)
90
+ update_clusters_config(cluster_data[:id], kubeconfig_path: kubeconfig_path)
91
+ end
92
+
93
+ def save_kubeconfig(kubeconfig, kubeconfig_path)
94
+ KubeconfigService.save_to_filepath(kubeconfig_path, kubeconfig) do |kubeconfig_by_path|
95
+ merged_kubeconfig = KubeconfigService.merge(kubeconfig_by_path, kubeconfig)
96
+
97
+ new_current_context = KubeconfigService.get_current_context(kubeconfig)
98
+ new_kubeconfig = KubeconfigService.update_current_context(merged_kubeconfig, new_current_context)
99
+
100
+ next new_kubeconfig if kubeconfig_by_path.nil?
101
+
102
+ previous_current_context = KubeconfigService.get_current_context(kubeconfig_by_path)
103
+ save_previous_current_context(kubeconfig_path, previous_current_context)
104
+ new_kubeconfig
105
+ end
106
+ end
107
+
108
+ def update_clusters_config(id, params)
109
+ clusters_config = Uffizzi::ConfigHelper.update_clusters_config_by_id(id, params)
110
+ ConfigFile.write_option(:clusters, clusters_config)
111
+ end
112
+
113
+ def cluster_creation_params(name, creation_source)
114
+ oidc_token = Uffizzi::ConfigFile.read_option(:oidc_token)
115
+
116
+ {
117
+ cluster: {
118
+ name: name,
119
+ manifest: nil,
120
+ creation_source: creation_source,
121
+ },
122
+ token: oidc_token,
123
+ }
124
+ end
125
+
126
+ def handle_delete_cluster(cluster_id, cluster_name, kubeconfig)
127
+ return if cluster_id.nil? || cluster_name.nil?
128
+
129
+ exclude_kubeconfig(cluster_id, kubeconfig) if kubeconfig.present?
130
+
131
+ params = {
132
+ cluster_name: cluster_name,
133
+ oidc_token: ConfigFile.read_option(:oidc_token),
134
+ }
135
+ response = delete_cluster(ConfigFile.read_option(:server), project_slug, params)
136
+
137
+ if ResponseHelper.no_content?(response)
138
+ Uffizzi.ui.say("Cluster #{cluster_name} deleted")
139
+ else
140
+ ResponseHelper.handle_failed_response(response)
141
+ end
142
+ end
143
+
144
+ def exclude_kubeconfig(cluster_id, kubeconfig)
145
+ cluster_config = Uffizzi::ConfigHelper.cluster_config_by_id(cluster_id)
146
+ return if cluster_config.nil?
147
+
148
+ kubeconfig_path = cluster_config[:kubeconfig_path]
149
+ ConfigFile.write_option(:clusters, Uffizzi::ConfigHelper.clusters_config_without(cluster_id))
150
+
151
+ KubeconfigService.save_to_filepath(kubeconfig_path, kubeconfig) do |kubeconfig_by_path|
152
+ return if kubeconfig_by_path.nil?
153
+
154
+ new_kubeconfig = KubeconfigService.exclude(kubeconfig_by_path, kubeconfig)
155
+ new_current_context = find_previous_current_context(new_kubeconfig, kubeconfig_path)
156
+ KubeconfigService.update_current_context(new_kubeconfig, new_current_context)
157
+ end
158
+ end
159
+
160
+ def find_previous_current_context(kubeconfig, kubeconfig_path)
161
+ prev_current_context = Uffizzi::ConfigHelper.previous_current_context_by_path(kubeconfig_path)&.fetch(:current_context, nil)
162
+
163
+ if KubeconfigService.find_cluster_contexts_by_name(kubeconfig, prev_current_context).present?
164
+ prev_current_context
165
+ end
166
+ end
167
+
168
+ def save_previous_current_context(kubeconfig_path, current_context)
169
+ previous_current_contexts = Uffizzi::ConfigHelper.set_previous_current_context_by_path(kubeconfig_path, current_context)
170
+ ConfigFile.write_option(:previous_current_contexts, previous_current_contexts)
171
+ end
172
+
173
+ def parse_kubeconfig(kubeconfig)
174
+ return if kubeconfig.nil?
175
+
176
+ Psych.safe_load(Base64.decode64(kubeconfig))
177
+ end
178
+
179
+ def launch_demonise_skaffold(config_path)
180
+ Uffizzi.process.daemon(true)
181
+
182
+ at_exit do
183
+ File.delete(DevService.pid_path) if File.exist?(DevService.pid_path)
184
+ end
185
+
186
+ File.delete(DevService.logs_path) if File.exist?(DevService.logs_path)
187
+ File.write(DevService.pid_path, Uffizzi.process.pid)
188
+ DevService.start_check_pid_file_existence
189
+ DevService.start_demonised_skaffold(config_path, options)
190
+ rescue StandardError => e
191
+ File.open(DevService.logs_path, 'a') { |f| f.puts(e.message) }
192
+ end
193
+
194
+ def project_slug
195
+ @project_slug ||= ConfigFile.read_option(:project)
196
+ end
197
+ end
198
+ end
data/lib/uffizzi/cli.rb CHANGED
@@ -71,6 +71,10 @@ module Uffizzi
71
71
  Disconnect.new.run(credential_type)
72
72
  end
73
73
 
74
+ desc 'dev', 'dev'
75
+ require_relative 'cli/dev'
76
+ subcommand 'dev', Cli::Dev
77
+
74
78
  map preview: :compose
75
79
 
76
80
  class << self
@@ -5,6 +5,7 @@ require 'uffizzi/helpers/file_helper'
5
5
 
6
6
  module Uffizzi
7
7
  class ConfigFile
8
+ CONFIG_DIR = "#{Dir.home}/.config/uffizzi"
8
9
  CONFIG_PATH = "#{Dir.home}/.config/uffizzi/config_default.json"
9
10
 
10
11
  class << self
@@ -9,8 +9,6 @@ class ClusterDisconnectService
9
9
  def handle(options)
10
10
  kubeconfig_path = options[:kubeconfig] || KubeconfigService.default_path
11
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
12
  kubeconfig = KubeconfigService.read_kubeconfig(kubeconfig_path)
15
13
 
16
14
  if kubeconfig.nil?
@@ -18,12 +16,14 @@ class ClusterDisconnectService
18
16
  end
19
17
 
20
18
  contexts = KubeconfigService.get_cluster_contexts(kubeconfig)
21
- current_context = KubeconfigService.get_current_context(kubeconfig)
22
19
 
23
20
  if contexts.empty?
24
21
  return Uffizzi.ui.say("No contexts by kubeconfig path #{kubeconfig_path}")
25
22
  end
26
23
 
24
+ prev_current_context = Uffizzi::ConfigHelper.previous_current_context_by_path(kubeconfig_path)&.fetch(:current_context, nil)
25
+ current_context = KubeconfigService.get_current_context(kubeconfig)
26
+
27
27
  if KubeconfigService.find_cluster_contexts_by_name(kubeconfig, prev_current_context).present? &&
28
28
  prev_current_context != current_context &&
29
29
  !is_ask_origin_current_context
@@ -9,6 +9,7 @@ class ClusterService
9
9
  CLUSTER_STATE_FAILED_DEPLOY_NAMESPACE = 'failed_deploy_namespace'
10
10
  CLUSTER_STATE_FAILED = 'failed'
11
11
  CLUSTER_NAME_MAX_LENGTH = 15
12
+ MANUAL_CREATION_SOURCE = 'manual'
12
13
 
13
14
  class << self
14
15
  include ApiClient
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'uffizzi/clients/api/api_client'
4
+
5
+ class DevService
6
+ class << self
7
+ include ApiClient
8
+
9
+ DEFAULT_REGISTRY_REPO = 'registry.uffizzi.com'
10
+
11
+ def check_running_daemon
12
+ return unless File.exist?(pid_path)
13
+
14
+ pid = File.read(pid_path)
15
+ File.delete(pid_path) if pid.blank?
16
+ Uffizzi.process.kill(0, pid.to_i)
17
+
18
+ Uffizzi.ui.say_error_and_exit("You have already started uffizzi dev as daemon. To stop the process do 'uffizzi dev stop'")
19
+ rescue Errno::ESRCH
20
+ File.delete(pid_path)
21
+ end
22
+
23
+ def start_check_pid_file_existence
24
+ Thread.new do
25
+ loop do
26
+ Uffizzi.process.kill('QUIT', Uffizzi.process.pid) unless File.exist?(pid_path)
27
+ sleep(1)
28
+ end
29
+ end
30
+ end
31
+
32
+ def start_basic_skaffold(config_path, options)
33
+ Uffizzi.ui.say('Start skaffold')
34
+ cmd = build_skaffold_dev_command(config_path, options)
35
+
36
+ Uffizzi.ui.popen2e(cmd) do |_stdin, stdout_and_stderr, wait_thr|
37
+ stdout_and_stderr.each { |l| Uffizzi.ui.say(l) }
38
+ wait_thr.value
39
+ end
40
+ end
41
+
42
+ def start_demonised_skaffold(config_path, options)
43
+ File.write(logs_path, "Start skaffold\n")
44
+ cmd = build_skaffold_dev_command(config_path, options)
45
+
46
+ Uffizzi.ui.popen2e(cmd) do |_stdin, stdout_and_stderr, wait_thr|
47
+ File.open(logs_path, 'a') do |f|
48
+ stdout_and_stderr.each do |line|
49
+ f.puts(line)
50
+ f.flush
51
+ end
52
+ end
53
+
54
+ wait_thr.value
55
+ end
56
+ end
57
+
58
+ def check_skaffold_existence
59
+ cmd = 'skaffold version'
60
+ stdout_str, stderr_str = Uffizzi.ui.capture3(cmd)
61
+
62
+ return if stdout_str.present? && stderr_str.blank?
63
+
64
+ Uffizzi.ui.say_error_and_exit(stderr_str)
65
+ rescue StandardError => e
66
+ Uffizzi.ui.say_error_and_exit(e.message)
67
+ end
68
+
69
+ def check_skaffold_config_existence(config_path)
70
+ msg = 'A valid dev environment configuration is required. Please provide a valid config,'\
71
+ "\r\n"\
72
+ 'or run `skaffold init` to generate a skaffold.yaml configuration.'\
73
+ "\r\n"\
74
+ 'See the `uffizzi dev start --help` page for supported configs and usage details.'
75
+
76
+ Uffizzi.ui.say_error_and_exit(msg) unless File.exist?(config_path)
77
+ end
78
+
79
+ def pid_path
80
+ File.join(Uffizzi::ConfigFile::CONFIG_DIR, 'uffizzi_dev.pid')
81
+ end
82
+
83
+ def logs_path
84
+ File.join(Uffizzi::ConfigFile::CONFIG_DIR, 'uffizzi_dev.log')
85
+ end
86
+
87
+ def build_skaffold_dev_command(config_path, options)
88
+ cmd = [
89
+ 'skaffold dev',
90
+ "--filename='#{config_path}'",
91
+ "--default-repo='#{default_registry_repo(options[:'default-repo'])}'",
92
+ "--kubeconfig='#{default_kubeconfig_path(options[:kubeconfig])}'",
93
+ ]
94
+
95
+ cmd.join(' ')
96
+ end
97
+
98
+ def default_registry_repo(repo)
99
+ repo || DEFAULT_REGISTRY_REPO
100
+ end
101
+
102
+ def default_kubeconfig_path(kubeconfig_path)
103
+ path = kubeconfig_path || KubeconfigService.default_path
104
+
105
+ File.expand_path(path)
106
+ end
107
+ end
108
+ end
@@ -81,7 +81,9 @@ class KubeconfigService
81
81
  end
82
82
 
83
83
  def default_path
84
- kubeconfig_env_path || Uffizzi.configuration.default_kubeconfig_path
84
+ path = kubeconfig_env_path || Uffizzi.configuration.default_kubeconfig_path
85
+
86
+ File.expand_path(path)
85
87
  end
86
88
 
87
89
  def read_kubeconfig(filepath)
data/lib/uffizzi/shell.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'awesome_print'
4
+ require 'open3'
4
5
 
5
6
  module Uffizzi
6
7
  module UI
@@ -54,6 +55,14 @@ module Uffizzi
54
55
  $stdout.stat.pipe?
55
56
  end
56
57
 
58
+ def popen2e(command, &block)
59
+ Open3.popen2e(command, &block)
60
+ end
61
+
62
+ def capture3(command)
63
+ Open3.capture3(command)
64
+ end
65
+
57
66
  private
58
67
 
59
68
  def format_to_json(data)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uffizzi
4
- VERSION = '2.0.37'
4
+ VERSION = '2.1.2'
5
5
  end
data/lib/uffizzi.rb CHANGED
@@ -36,5 +36,9 @@ module Uffizzi
36
36
  def root
37
37
  @root ||= Pathname.new(File.expand_path('..', __dir__))
38
38
  end
39
+
40
+ def process
41
+ @process ||= Process
42
+ end
39
43
  end
40
44
  end
@@ -17,7 +17,7 @@ https://docs\.uffizzi\.com/references/cli/
17
17
  .fi
18
18
  .SH "FLAGS"
19
19
  .nf
20
- \-\- name
20
+ \-\-name
21
21
  Option is deprecated and will be removed in the newer versions\.
22
22
  Please use a positional argument instead: uffizzi cluster create my\-awesome\-name\.
23
23
 
@@ -0,0 +1,99 @@
1
+ .\" generated with Ronn-NG/v0.9.1
2
+ .\" http://github.com/apjanke/ronn-ng/tree/0.9.1
3
+ .TH "UFFIZZI\-DEV\-START" "" "October 2023" ""
4
+ .SH "NAME"
5
+ \fBuffizzi\-dev\-start\fR \- start a development environment
6
+ .SH "SYNOPSIS"
7
+ .nf
8
+ uffizzi dev start [CONFIG_FILE] [FLAGS]
9
+ .fi
10
+ .SH "DESCRIPTION"
11
+ .nf
12
+ Creates a Uffizzi cluster preconfigured for development
13
+ workflows, including building, pushing, and deploying
14
+ your changes every time project files are saved\.
15
+ current\-context is updated in kubeconfig file\.
16
+
17
+ This command watches for file changes in a given local
18
+ project directory, as specified in your configuration file\.
19
+ It then serializes those changes and redeploys them onto
20
+ a Uffizzi cluster\.
21
+
22
+ The command looks for a configuration at the specified
23
+ path CONFIG_FILE\. Skaffold configurations are currently
24
+ supported\. For help creating a skaffold\.yaml file, see:
25
+ https://skaffold\.dev/docs/init/
26
+
27
+ If a kubeconfig exists
28
+
29
+ For more information on Uffizzi clusters, see:
30
+ https://docs\.uffizzi\.com/references/cli/
31
+ .fi
32
+ .SH "POSITIONAL ARGUMENTS"
33
+ .nf
34
+ [CONFIG_FILE]
35
+ Path to the development environment configuration file\.
36
+ Currently supports skaffold\.yaml files\.
37
+ .fi
38
+ .SH "FLAGS"
39
+ .nf
40
+ \-\-build="<local\-or\-remote>"
41
+ This option specifies whether to build images on the
42
+ local environment or on the remote Uffizzi cluster\.
43
+ Possible values are "local" or "remote"\.
44
+
45
+ \-\-default\-repo="<container\-registry\-domain>"
46
+ A public or private repo used to push/pull build
47
+ artifacts\. Overrides the global default image registry:
48
+ "registry\.uffizzi\.com"\. See `uffizzi connect \-h` for
49
+ adding private registry credentials\.
50
+
51
+ \-\-quiet, \-q
52
+ Run the development process in detached mode (i\.e\., in
53
+ the background)\. Without this option, logs are streamed
54
+ to the terminal in the foreground\. Run \'uffizzi dev stop`
55
+ to stop the detached process\.
56
+
57
+ \-\-help, \-h
58
+ Show this message and exit\.
59
+
60
+ \-\-kubeconfig="/path/to/your/kubeconfig"
61
+ Path to kubeconfig file\. If this option is not specified,
62
+ this command looks for the file at ~/\.kube/config\.
63
+ .fi
64
+ .SH "EXAMPLES"
65
+ .nf
66
+ If your configuration file is in the current working
67
+ directory and you want to use an auto\-generated name,
68
+ run:
69
+
70
+ $ uffizzi dev start
71
+
72
+ To start a dev environment using a skaffold\.yaml config
73
+ file in directory \'~/foo\', run:
74
+
75
+ $ uffizzi dev start ~/foo/skaffold\.yaml
76
+
77
+ To start a dev environment in quiet mode,
78
+ run:
79
+
80
+ $ uffizzi dev start \-\-quiet
81
+
82
+ To push your build artifacts to a private Docker Hub repo
83
+ called \'acme/foo\', first add your Docker Hub credentials:
84
+
85
+ $ uffizzi connect docker\-hub
86
+ (See `uffizzi connect \-h` for other registry options)
87
+
88
+ \|\.\|\.\|\.then override the default repo:
89
+
90
+ $ uffizzi dev start \e
91
+ \-\-default\-repo="hub\.docker\.com/acme/foo"
92
+
93
+ To start a dev environment using an alternate kubeconfig file,
94
+ run:
95
+
96
+ $ uffizzi dev start \e
97
+ \-\-kubeconfig="/path/to/alternate/kubeconfig"
98
+ .fi
99
+
@@ -0,0 +1,90 @@
1
+ uffizzi-dev-start - start a development environment
2
+ ================================================================
3
+
4
+ ## SYNOPSIS
5
+ uffizzi dev start [CONFIG_FILE] [FLAGS]
6
+
7
+ ## DESCRIPTION
8
+ Creates a Uffizzi cluster preconfigured for development
9
+ workflows, including building, pushing, and deploying
10
+ your changes every time project files are saved.
11
+ current-context is updated in kubeconfig file.
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
+ If a kubeconfig exists
24
+
25
+ For more information on Uffizzi clusters, see:
26
+ https://docs.uffizzi.com/references/cli/
27
+
28
+ ## POSITIONAL ARGUMENTS
29
+ [CONFIG_FILE]
30
+ Path to the development environment configuration file.
31
+ Currently supports skaffold.yaml files.
32
+
33
+ ## FLAGS
34
+ --build="<local-or-remote>"
35
+ This option specifies whether to build images on the
36
+ local environment or on the remote Uffizzi cluster.
37
+ Possible values are "local" or "remote".
38
+
39
+ --default-repo="<container-registry-domain>"
40
+ A public or private repo used to push/pull build
41
+ artifacts. Overrides the global default image registry:
42
+ "registry.uffizzi.com". See `uffizzi connect -h` for
43
+ adding private registry credentials.
44
+
45
+ --quiet, -q
46
+ Run the development process in detached mode (i.e., in
47
+ the background). Without this option, logs are streamed
48
+ to the terminal in the foreground. Run 'uffizzi dev stop`
49
+ to stop the detached process.
50
+
51
+ --help, -h
52
+ Show this message and exit.
53
+
54
+ --kubeconfig="/path/to/your/kubeconfig"
55
+ Path to kubeconfig file. If this option is not specified,
56
+ this command looks for the file at ~/.kube/config.
57
+
58
+ ## EXAMPLES
59
+ If your configuration file is in the current working
60
+ directory and you want to use an auto-generated name,
61
+ run:
62
+
63
+ $ uffizzi dev start
64
+
65
+ To start a dev environment using a skaffold.yaml config
66
+ file in directory '~/foo', run:
67
+
68
+ $ uffizzi dev start ~/foo/skaffold.yaml
69
+
70
+ To start a dev environment in quiet mode,
71
+ run:
72
+
73
+ $ uffizzi dev start --quiet
74
+
75
+ To push your build artifacts to a private Docker Hub repo
76
+ called 'acme/foo', first add your Docker Hub credentials:
77
+
78
+ $ uffizzi connect docker-hub
79
+ (See `uffizzi connect -h` for other registry options)
80
+
81
+ ...then override the default repo:
82
+
83
+ $ uffizzi dev start \
84
+ --default-repo="hub.docker.com/acme/foo"
85
+
86
+ To start a dev environment using an alternate kubeconfig file,
87
+ run:
88
+
89
+ $ uffizzi dev start \
90
+ --kubeconfig="/path/to/alternate/kubeconfig"
@@ -0,0 +1,41 @@
1
+ .\" generated with Ronn-NG/v0.9.1
2
+ .\" http://github.com/apjanke/ronn-ng/tree/0.9.1
3
+ .TH "UFFIZZI\-DEV\-STOP" "" "October 2023" ""
4
+ .SH "NAME"
5
+ \fBuffizzi\-dev\-stop\fR \- stop a development environment
6
+ .SH "SYNOPSIS"
7
+ .nf
8
+ uffizzi dev stop
9
+ .fi
10
+ .SH "DESCRIPTION"
11
+ .nf
12
+ Stops a dev environment and deletes the backing
13
+ Uffizzi cluster resources, including any persistent
14
+ volumes, and the namespace itself\. The Uffizzi
15
+ cluster config is deleted from the kubeconfig file\.
16
+
17
+ This command watches for file changes in a given local
18
+ project directory, as specified in your configuration file\.
19
+ It then serializes those changes and redeploys them onto
20
+ a Uffizzi cluster\.
21
+
22
+ The command looks for a configuration at the specified
23
+ path CONFIG_FILE\. Skaffold configurations are currently
24
+ supported\. For help creating a skaffold\.yaml file, see:
25
+ https://skaffold\.dev/docs/init/
26
+
27
+ For more information on Uffizzi clusters, see:
28
+ https://docs\.uffizzi\.com/references/cli/
29
+ .fi
30
+ .SH "FLAGS"
31
+ .nf
32
+ \-\-help, \-h
33
+ Show this message and exit\.
34
+ .fi
35
+ .SH "EXAMPLES"
36
+ .nf
37
+ To stop a dev environment, run:
38
+
39
+ $ uffizzi dev stop
40
+ .fi
41
+
@@ -0,0 +1,33 @@
1
+ uffizzi-dev-stop - stop a development environment
2
+ ================================================================
3
+
4
+ ## SYNOPSIS
5
+ uffizzi dev stop
6
+
7
+ ## DESCRIPTION
8
+ Stops a dev environment and deletes the backing
9
+ Uffizzi cluster resources, including any persistent
10
+ volumes, and the namespace itself. The Uffizzi
11
+ cluster config is deleted from the kubeconfig file.
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/
25
+
26
+ ## FLAGS
27
+ --help, -h
28
+ Show this message and exit.
29
+
30
+ ## EXAMPLES
31
+ To stop a dev environment, run:
32
+
33
+ $ uffizzi dev stop
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.37
4
+ version: 2.1.2
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-19 00:00:00.000000000 Z
12
+ date: 2023-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -423,6 +423,7 @@ files:
423
423
  - lib/uffizzi/cli/common.rb
424
424
  - lib/uffizzi/cli/config.rb
425
425
  - lib/uffizzi/cli/connect.rb
426
+ - lib/uffizzi/cli/dev.rb
426
427
  - lib/uffizzi/cli/disconnect.rb
427
428
  - lib/uffizzi/cli/login.rb
428
429
  - lib/uffizzi/cli/login_by_identity_token.rb
@@ -449,6 +450,7 @@ files:
449
450
  - lib/uffizzi/services/cluster_service.rb
450
451
  - lib/uffizzi/services/command_service.rb
451
452
  - lib/uffizzi/services/compose_file_service.rb
453
+ - lib/uffizzi/services/dev_service.rb
452
454
  - lib/uffizzi/services/env_variables_service.rb
453
455
  - lib/uffizzi/services/github_service.rb
454
456
  - lib/uffizzi/services/kubeconfig_service.rb
@@ -518,6 +520,10 @@ files:
518
520
  - man/uffizzi-connect-ghcr
519
521
  - man/uffizzi-connect-ghcr.ronn
520
522
  - man/uffizzi-connect.ronn
523
+ - man/uffizzi-dev-start
524
+ - man/uffizzi-dev-start.ronn
525
+ - man/uffizzi-dev-stop
526
+ - man/uffizzi-dev-stop.ronn
521
527
  - man/uffizzi-disconnect
522
528
  - man/uffizzi-disconnect.ronn
523
529
  - man/uffizzi-login