Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
lidiamokevnina committed Jun 26, 2024
2 parents da4e9db + fe5aae3 commit bca51b5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
14 changes: 9 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
uffizzi-cli (2.4.9)
uffizzi-cli (2.4.10)
activesupport
awesome_print
faker
Expand All @@ -26,8 +26,10 @@ GEM
public_suffix (>= 2.0.2, < 5.0)
ast (2.4.2)
awesome_print (1.9.2)
bigdecimal (3.1.8)
bump (0.10.0)
byebug (11.1.3)
childprocess (5.0.0)
coderay (1.1.3)
concurrent-ruby (1.1.9)
crack (0.4.5)
Expand All @@ -36,15 +38,16 @@ GEM
factory_bot (6.2.0)
activesupport (>= 5.0.0)
fakefs (1.8.0)
faker (3.2.2)
faker (3.4.1)
i18n (>= 1.8.11, < 2)
hashdiff (1.0.1)
i18n (1.8.11)
concurrent-ruby (~> 1.0)
kramdown (2.3.1)
rexml
launchy (2.5.2)
launchy (3.0.1)
addressable (~> 2.8)
childprocess (~> 5.0)
method_source (1.0.0)
minitar (0.9)
minitest (5.14.4)
Expand Down Expand Up @@ -100,9 +103,10 @@ GEM
rubocop (~> 1.0)
ruby-progressbar (1.11.0)
securerandom (0.3.1)
sentry-ruby (5.15.2)
sentry-ruby (5.18.0)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
thor (1.3.0)
thor (1.3.1)
tty-color (0.6.0)
tty-cursor (0.7.1)
tty-prompt (0.23.1)
Expand Down
14 changes: 7 additions & 7 deletions lib/uffizzi/cli/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ def build_installation_options(uri)
}
end

def wait_ip
def wait_endpoint
spinner = TTY::Spinner.new('[:spinner] Waiting on IP address...', format: :dots)
spinner.auto_spin

ip = nil
endpoint = nil
try = 0

loop do
ip = InstallService.get_controller_ip(namespace)
break if ip.present?
endpoint = InstallService.get_controller_endpoint(namespace)
break if endpoint.present?

if try == 90
spinner.error
Expand All @@ -94,7 +94,7 @@ def wait_ip

spinner.success

ip
endpoint
end

def build_helm_values(params)
Expand Down Expand Up @@ -196,10 +196,10 @@ def build_controller_setting_params(uri, installation_options)
end

def say_success(uri)
ip_address = wait_ip
endpoint = wait_endpoint

msg = 'Your Uffizzi controller is ready. To configure DNS,'\
" create a record for the hostname '*.#{uri.host}' pointing to '#{ip_address}'"
" create a record for the hostname '*.#{uri.host}' pointing to '#{endpoint}'"
Uffizzi.ui.say(msg)
end

Expand Down
7 changes: 5 additions & 2 deletions lib/uffizzi/services/install_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def kubeconfig_current_context
execute_command(cmd, say: false) { |stdout| stdout.present? && stdout.chop }
end

def get_controller_ip(namespace)
def get_controller_endpoint(namespace)
cmd = "kubectl get ingress -n #{namespace} -o json"
res = execute_command(cmd, say: false)
ingress = JSON.parse(res)['items'].detect { |i| i['metadata']['name'] = INGRESS_NAME }
Expand All @@ -95,7 +95,10 @@ def get_controller_ip(namespace)
load_balancers = ingress.dig('status', 'loadBalancer', 'ingress')
return if load_balancers.blank?

load_balancers.map { |i| i['ip'] }[0]
ip = load_balancers.map { |i| i['ip'] }[0]
return ip if ip.present?

load_balancers.map { |i| i['hostname'] }[0]
end

def build_controller_host(host)
Expand Down
2 changes: 1 addition & 1 deletion lib/uffizzi/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Uffizzi
VERSION = '2.4.9'
VERSION = '2.4.10'
end

0 comments on commit bca51b5

Please sign in to comment.