class Krane::CLI::DeployCommand
Constants
- DEFAULT_DEPLOY_TIMEOUT
- OPTIONS
- PROTECTED_NAMESPACES
Public Class Methods
from_options(namespace, context, options)
click to toggle source
# File lib/krane/cli/deploy_command.rb, line 38 def self.from_options(namespace, context, options) require 'krane/deploy_task' require 'krane/options_helper' require 'krane/bindings_parser' require 'krane/label_selector' bindings_parser = ::Krane::BindingsParser.new options[:bindings]&.each { |binding_pair| bindings_parser.add(binding_pair) } selector = ::Krane::LabelSelector.parse(options[:selector]) if options[:selector] logger = ::Krane::FormattedLogger.build(namespace, context, verbose_prefix: options['verbose-log-prefix']) protected_namespaces = options['protected-namespaces'] if options['protected-namespaces'].size == 1 && %w('' "").include?(options['protected-namespaces'][0]) protected_namespaces = [] end ::Krane::OptionsHelper.with_processed_template_paths(options[:filenames], require_explicit_path: true) do |paths| deploy = ::Krane::DeployTask.new( namespace: namespace, context: context, current_sha: options['current-sha'], template_paths: paths, bindings: bindings_parser.parse, logger: logger, max_watch_seconds: ::Krane::DurationParser.new(options["global-timeout"]).parse!.to_i, selector: selector, protected_namespaces: protected_namespaces, ) deploy.run!( verify_result: options["verify-result"], allow_protected_ns: !protected_namespaces.empty?, prune: options[:prune] ) end end