Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
lidiamokevnina committed Feb 13, 2024
2 parents e64d371 + d699eaa commit bf5b408
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
uffizzi-cli (2.4.4)
uffizzi-cli (2.4.5)
activesupport
awesome_print
faker
Expand Down
40 changes: 26 additions & 14 deletions lib/uffizzi/cli/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Cli::Install < Thor

default_task :controller

desc 'controller [HOSTNMAE]', 'Install uffizzi controller to cluster'
desc 'controller [HOSTNAME]', 'Install uffizzi controller to cluster'
method_option :namespace, type: :string
method_option :email, type: :string, required: true
method_option :context, type: :string
Expand All @@ -20,14 +20,14 @@ class Cli::Install < Thor
def controller(hostname)
Uffizzi::AuthHelper.check_login

InstallService.kubectl_exists?
InstallService.helm_exists?
# InstallService.kubectl_exists?
# InstallService.helm_exists?

if options[:context].present? && options[:context] != InstallService.kubeconfig_current_context
InstallService.set_current_context(options[:context])
end

ask_confirmation
ask_confirmation(options[:namespace])

uri = parse_hostname(hostname)
installation_options = build_installation_options(uri)
Expand Down Expand Up @@ -159,16 +159,8 @@ def check_existence_controller_settings(uri, installation_options)
update_controller_settings(existing_controller_setting[:id], controller_setting_params)
end

def ask_confirmation
msg = "\r\n"\
'This command will install Uffizzi into the default namespace of'\
" the '#{InstallService.kubeconfig_current_context}' context."\
"\r\n"\
"To install in a different place, use options '--namespace' and/or '--context'."\
"\r\n\r\n"\
"After installation, new environments created for account '#{account_name}' will be deployed to this host cluster."\
"\r\n\r\n"

def ask_confirmation(namespace)
msg = namespace.present? ? custom_namespace_installation_message(namespace) : default_installation_message
Uffizzi.ui.say(msg)

question = 'Okay to proceed?'
Expand Down Expand Up @@ -263,5 +255,25 @@ def account_name
def existing_controller_setting
@existing_controller_setting ||= fetch_controller_settings[0]
end

def default_installation_message
"\r\n"\
"This command will install Uffizzi into the 'default' namespace of"\
" the '#{InstallService.kubeconfig_current_context}' context."\
"\r\n"\
"To install in a different place, use options '--namespace' and/or '--context'."\
"\r\n\r\n"\
"After installation, new environments created for account '#{account_name}' will be deployed to this host cluster."\
"\r\n\r\n"
end

def custom_namespace_installation_message(namespace)
"\r\n"\
"This command will install Uffizzi into the '#{namespace}' namespace of"\
" the '#{InstallService.kubeconfig_current_context}' context."\
"\r\n\r\n"\
"After installation, new environments created for account '#{account_name}' will be deployed to this host cluster."\
"\r\n\r\n"
end
end
end
2 changes: 1 addition & 1 deletion lib/uffizzi/cli/uninstall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Cli::Uninstall < Thor

default_task :controller

desc 'controller [HOSTNMAE]', 'Install uffizzi controller to cluster'
desc 'controller [HOSTNAME]', 'Install uffizzi controller to cluster'
method_option :namespace, type: :string
method_option :context, type: :string
def controller
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.4'
VERSION = '2.4.5'
end

0 comments on commit bf5b408

Please sign in to comment.