uffizzi-cli 2.4.8 → 2.4.9
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 744480393ee81d335802bcb1008333c1e6c9b6f9870d7710dfff294698a1eb7a
|
4
|
+
data.tar.gz: cf43c7519e0621f9be3fbb18d9fd89fd0cf2a6ea0dc56d0b41662428e6d4b46c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef39ee4ce26c553068d279f3960ba924b7458fbf439a4ffd0abbed363fa359cbf9707df59e8ee439ff06f091894836f67d7bcdb8f2c78879caa7b52120e2dfb2
|
7
|
+
data.tar.gz: 6c0471f16b076c5c8dedd2b714416c6514e03f9ee96b6d6aead5d5fca19556ac6f09e73b44a050ef07f7cdcfd3a72d9bb2b14902eda9931b5251830389aacc57
|
data/lib/uffizzi/cli/install.rb
CHANGED
@@ -72,7 +72,7 @@ module Uffizzi
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def wait_ip
|
75
|
-
spinner = TTY::Spinner.new('[:spinner] Waiting IP
|
75
|
+
spinner = TTY::Spinner.new('[:spinner] Waiting on IP address...', format: :dots)
|
76
76
|
spinner.auto_spin
|
77
77
|
|
78
78
|
ip = nil
|
@@ -82,7 +82,7 @@ module Uffizzi
|
|
82
82
|
ip = InstallService.get_controller_ip(namespace)
|
83
83
|
break if ip.present?
|
84
84
|
|
85
|
-
if try ==
|
85
|
+
if try == 90
|
86
86
|
spinner.error
|
87
87
|
|
88
88
|
return 'unknown'
|
@@ -97,29 +97,6 @@ module Uffizzi
|
|
97
97
|
ip
|
98
98
|
end
|
99
99
|
|
100
|
-
def wait_certificate_request_ready(uri)
|
101
|
-
spinner = TTY::Spinner.new('[:spinner] Waiting create certificate for controller host...', format: :dots)
|
102
|
-
spinner.auto_spin
|
103
|
-
|
104
|
-
try = 0
|
105
|
-
|
106
|
-
loop do
|
107
|
-
requests = InstallService.get_certificate_request(namespace, uri)
|
108
|
-
break if requests.all? { |r| r['status'].downcase == 'true' }
|
109
|
-
|
110
|
-
if try == 60
|
111
|
-
spinner.error
|
112
|
-
|
113
|
-
return Uffizzi.ui.say('Stop waiting creation certificate')
|
114
|
-
end
|
115
|
-
|
116
|
-
try += 1
|
117
|
-
sleep(2)
|
118
|
-
end
|
119
|
-
|
120
|
-
spinner.success
|
121
|
-
end
|
122
|
-
|
123
100
|
def build_helm_values(params)
|
124
101
|
{
|
125
102
|
global: {
|
@@ -220,7 +197,6 @@ module Uffizzi
|
|
220
197
|
|
221
198
|
def say_success(uri)
|
222
199
|
ip_address = wait_ip
|
223
|
-
wait_certificate_request_ready(uri)
|
224
200
|
|
225
201
|
msg = 'Your Uffizzi controller is ready. To configure DNS,'\
|
226
202
|
" create a record for the hostname '*.#{uri.host}' pointing to '#{ip_address}'"
|
@@ -12,7 +12,7 @@ module Uffizzi
|
|
12
12
|
default_task :controller
|
13
13
|
|
14
14
|
desc 'controller [HOSTNAME]', 'Install uffizzi controller to cluster'
|
15
|
-
method_option :namespace, type: :string
|
15
|
+
method_option :namespace, type: :string, aliases: '-n'
|
16
16
|
method_option :context, type: :string
|
17
17
|
def controller
|
18
18
|
Uffizzi::AuthHelper.check_login
|
@@ -86,7 +86,7 @@ module Uffizzi
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def namespace
|
89
|
-
options[:namespace] || InstallService
|
89
|
+
options[:namespace] || InstallService.current_namespace
|
90
90
|
end
|
91
91
|
|
92
92
|
def server
|
@@ -98,17 +98,6 @@ class InstallService
|
|
98
98
|
load_balancers.map { |i| i['ip'] }[0]
|
99
99
|
end
|
100
100
|
|
101
|
-
def get_certificate_request(namespace, uri)
|
102
|
-
cmd = "kubectl get certificaterequests -n #{namespace} -o json"
|
103
|
-
res = execute_command(cmd, say: false)
|
104
|
-
certificate_request = JSON.parse(res)['items'].detect { |i| i['metadata']['name'].include?(uri.host) }
|
105
|
-
|
106
|
-
return [] if certificate_request.nil?
|
107
|
-
|
108
|
-
conditions = certificate_request.dig('status', 'conditions') || []
|
109
|
-
conditions.map { |c| c.slice('type', 'status') }
|
110
|
-
end
|
111
|
-
|
112
101
|
def build_controller_host(host)
|
113
102
|
[DEFAULT_CONTROLLER_DOMAIN_PREFIX, host].join('.')
|
114
103
|
end
|
@@ -130,6 +119,14 @@ class InstallService
|
|
130
119
|
File.dirname(Uffizzi::ConfigFile.config_path)
|
131
120
|
end
|
132
121
|
|
122
|
+
def current_namespace
|
123
|
+
path = KubeconfigService.default_path
|
124
|
+
kubeconfig = KubeconfigService.read_kubeconfig(path)
|
125
|
+
return if kubeconfig.nil?
|
126
|
+
|
127
|
+
KubeconfigService.get_current_namespace(kubeconfig) || DEFAULT_NAMESPACE
|
128
|
+
end
|
129
|
+
|
133
130
|
private
|
134
131
|
|
135
132
|
def execute_command(command, say: true, skip_error: false)
|
@@ -50,6 +50,12 @@ class KubeconfigService
|
|
50
50
|
.dig('context', 'cluster')
|
51
51
|
end
|
52
52
|
|
53
|
+
def get_current_namespace(kubeconfig)
|
54
|
+
get_cluster_contexts(kubeconfig)
|
55
|
+
.detect { |c| c['name'] == get_current_context(kubeconfig) }
|
56
|
+
.dig('context', 'namespace')
|
57
|
+
end
|
58
|
+
|
53
59
|
def get_cluster_contexts(kubeconfig)
|
54
60
|
kubeconfig.fetch('contexts', [])
|
55
61
|
end
|
data/lib/uffizzi/version.rb
CHANGED
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.
|
4
|
+
version: 2.4.9
|
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: 2024-
|
12
|
+
date: 2024-04-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|