Class: KuberKit::CLI
Constant Summary collapse
- APP_CONFIG_FILENAME =
"config.rb".freeze
Class Method Summary collapse
Instance Method Summary collapse
- #apply(file_path) ⇒ Object
- #attach(pod_name = nil) ⇒ Object
- #check ⇒ Object
- #compile(image_names_str) ⇒ Object
- #console(pod_name = nil) ⇒ Object
- #deploy ⇒ Object
- #describe(pod_name = nil) ⇒ Object
- #env ⇒ Object
- #envfile(env_file_name) ⇒ Object
- #get(pod_name = nil) ⇒ Object
- #logs(pod_name = nil) ⇒ Object
- #service(service_name) ⇒ Object
- #template(template_name) ⇒ Object
- #version ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
176 177 178 |
# File 'lib/kuber_kit/cli.rb', line 176 def self.exit_on_failure? true end |
Instance Method Details
#apply(file_path) ⇒ Object
108 109 110 111 112 113 114 |
# File 'lib/kuber_kit/cli.rb', line 108 def apply(file_path) setup() if KuberKit::Container['actions.configuration_loader'].call() KuberKit::Container['actions.kubectl_applier'].call(File.(file_path), ) end end |
#attach(pod_name = nil) ⇒ Object
117 118 119 120 121 122 123 |
# File 'lib/kuber_kit/cli.rb', line 117 def attach(pod_name = nil) setup() if KuberKit::Container['actions.configuration_loader'].call() KuberKit::Container['actions.kubectl_attacher'].call(pod_name, ) end end |
#check ⇒ Object
99 100 101 102 103 104 105 |
# File 'lib/kuber_kit/cli.rb', line 99 def check() setup() if KuberKit::Container['actions.configuration_loader'].call() KuberKit::Container['actions.service_checker'].call() end end |
#compile(image_names_str) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/kuber_kit/cli.rb', line 16 def compile(image_names_str) setup() started_at = Time.now.to_i image_names = image_names_str.split(",").map(&:strip).map(&:to_sym) if KuberKit::Container['actions.configuration_loader'].call() action_result = KuberKit::Container['actions.image_compiler'].call(image_names, ) end if action_result && action_result.succeeded? time = (Time.now.to_i - started_at) print_result("Image compilation finished! (#{time}s)", result: { images: action_result.finished_tasks, compilation: action_result.all_results }) else exit 1 end end |
#console(pod_name = nil) ⇒ Object
126 127 128 129 130 131 132 |
# File 'lib/kuber_kit/cli.rb', line 126 def console(pod_name = nil) setup() if KuberKit::Container['actions.configuration_loader'].call(.merge(load_inventory: false)) KuberKit::Container['actions.kubectl_console'].call(pod_name, ) end end |
#deploy ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/kuber_kit/cli.rb', line 43 def deploy setup() if KuberKit::Container['actions.configuration_loader'].call() require_confirmation = [:require_confirmation] || KuberKit.current_configuration.deployer_require_confirmation || false started_at = Time.now.to_i action_result = KuberKit::Container['actions.service_deployer'].call( services: ([:services] || []).flatten.uniq, tags: ([:tags] || []).flatten.uniq, skip_services: ([:skip_services] || []).flatten.uniq, skip_compile: [:skip_compile] || false, require_confirmation: require_confirmation ) end if action_result && action_result.succeeded? time = (Time.now.to_i - started_at) print_result("Service deployment finished! (#{time}s)", result: { services: action_result.finished_tasks, deployment: action_result.all_results }) else exit 1 end end |
#describe(pod_name = nil) ⇒ Object
145 146 147 148 149 150 151 |
# File 'lib/kuber_kit/cli.rb', line 145 def describe(pod_name = nil) setup() if KuberKit::Container['actions.configuration_loader'].call(.merge(load_inventory: false)) KuberKit::Container['actions.kubectl_describe'].call(pod_name, ) end end |
#env ⇒ Object
154 155 156 157 158 159 160 |
# File 'lib/kuber_kit/cli.rb', line 154 def env() setup() if KuberKit::Container['actions.configuration_loader'].call(.merge(load_inventory: false)) KuberKit::Container['actions.kubectl_env'].call() end end |
#envfile(env_file_name) ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/kuber_kit/cli.rb', line 72 def envfile(env_file_name) setup() if KuberKit::Container['actions.configuration_loader'].call() KuberKit::Container['actions.env_file_reader'].call(env_file_name.to_sym, ) end end |
#get(pod_name = nil) ⇒ Object
163 164 165 166 167 168 169 |
# File 'lib/kuber_kit/cli.rb', line 163 def get(pod_name = nil) setup() if KuberKit::Container['actions.configuration_loader'].call(.merge(load_inventory: false)) KuberKit::Container['actions.kubectl_get'].call(pod_name, ) end end |
#logs(pod_name = nil) ⇒ Object
136 137 138 139 140 141 142 |
# File 'lib/kuber_kit/cli.rb', line 136 def logs(pod_name = nil) setup() if KuberKit::Container['actions.configuration_loader'].call(.merge(load_inventory: false)) KuberKit::Container['actions.kubectl_logs'].call(pod_name, ) end end |
#service(service_name) ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/kuber_kit/cli.rb', line 90 def service(service_name) setup() if KuberKit::Container['actions.configuration_loader'].call() KuberKit::Container['actions.service_reader'].call(service_name.to_sym, ) end end |
#template(template_name) ⇒ Object
81 82 83 84 85 86 87 |
# File 'lib/kuber_kit/cli.rb', line 81 def template(template_name) setup() if KuberKit::Container['actions.configuration_loader'].call() KuberKit::Container['actions.template_reader'].call(template_name.to_sym, ) end end |
#version ⇒ Object
172 173 174 |
# File 'lib/kuber_kit/cli.rb', line 172 def version puts KuberKit::VERSION end |