Class: Neptuno::K8s::Attach
- Includes:
- TTY::Config
- Defined in:
- lib/neptuno/k8s/attach.rb
Constant Summary
Constants included from TTY::Config
TTY::Config::ABORT_MESSAGE, TTY::Config::TTY
Constants included from TTY::File
TTY::File::ABORT_MESSAGE, TTY::File::TTY
Constants inherited from CLI::Base
Constants included from TTY::Command
TTY::Command::TTY, TTY::Command::TTYP
Constants included from TTY::Prompt
Instance Method Summary collapse
Methods included from TTY::Config
#auto_restart_procs, #config, #configured_services, #docker_compose_hash, #docker_compose_services, #get_dependants, #healthy_services, #json_services_status, #running_services, #services, #services_with_procs, #starting_services
Methods included from TTY::File
#file, #in_service?, #make_service_files, #neptuno_path, #project, #service
Methods inherited from CLI::Base
#command_service_to, #command_services_to, #initialize
Methods included from TTY::Command
#command, #command_p, #neptuno_command
Methods included from TTY::Prompt
Constructor Details
This class inherits a constructor from Neptuno::CLI::Base
Instance Method Details
#call(**options) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/neptuno/k8s/attach.rb', line 14 def call(**) command_service_to("attach with k8s", service_as_args: [:args]&.first) do |service, _project| deployment = "deploy/#{[:dependent] || service}" deployment += "-#{service}-#{[:pr]}" unless [:pr].nil? context = [:context] context = "qa" unless [:pr].nil? system("kubectl config use-context #{context} > /dev/null 2>&1") puts "Attaching to #{deployment} in the #{[:namespace]} namespace using the #{context} context" system("kubectl exec #{deployment} -n #{[:namespace]} --stdin --tty -- /bin/sh") end end |