12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/kuber_kit/kubernetes/resource_selector.rb', line 12
def call(action_name, include_ingresses: false, include_pods: false)
deployments = resources_fetcher.call("deployments")
options = deployments.map{|d| "deploy/#{d}" }
options << "ingresses" if include_ingresses
options << "pods" if include_pods
option = ui.prompt("Please select resource to #{action_name}", options)
if option == "ingresses" && include_ingresses
ingresses = resources_fetcher.call("ingresses")
options = ingresses.map{|d| "ingresses/#{d}" }
return ui.prompt("Please select ingress to #{action_name}", options)
end
if option == "pods" && include_pods
ingresses = resources_fetcher.call("pods")
options = ingresses.map{|d| "pods/#{d}" }
return ui.prompt("Please select pod to #{action_name}", options)
end
option
end
|