class G5deploy::KubernetesHelper
Public Instance Methods
deploy(environment)
click to toggle source
# File lib/g5deploy/cli.rb, line 8 def deploy(environment) if environment == "production" && options[:with_migration] cmd = "kubectl config use-context g5-prod && kubectl \ apply -f k8s/sidekiq-workers.yaml -f k8s/rails-servers.yaml \ -f k8s/db-migrate.yaml" run_command(cmd) elsif environment == "production" cmd = "kubectl config use-context g5-prod && kubectl \ apply -f k8s/sidekiq-workers.yaml -f k8s/rails-servers.yaml" run_command(cmd) elsif environment == "staging" && options[:with_migration] cmd = "kubectl config use-context integrations-staging && kubectl \ apply -f k8s/sidekiq-workers.yaml -f k8s/rails-servers.yaml \ -f k8s/db-migrate.yaml" run_command(cmd) elsif environment == "staging" cmd = "kubectl config use-context integrations-staging && kubectl \ apply -f k8s/sidekiq-workers.yaml -f k8s/rails-servers.yaml" run_command(cmd) else puts "Command not found!".upcase end end
logs(pod_name)
click to toggle source
# File lib/g5deploy/cli.rb, line 46 def logs(pod_name) cmd = "kubectl exec -it #{pod_name} -- /bin/bash -f" run_command(cmd) end
pods(environment)
click to toggle source
# File lib/g5deploy/cli.rb, line 33 def pods(environment) if environment == "production" cmd = "kubectl config use-context g5-prod && kubectl get pods" run_command(cmd) elsif environment == "staging" cmd = "kubectl config use-context integrations-staging && kubectl get pods" run_command(cmd) else puts "Command not found!".upcase end end
Private Instance Methods
run_command(cmd)
click to toggle source
# File lib/g5deploy/cli.rb, line 53 def run_command(cmd) IO.popen(cmd) do |io| io.each { |s| print s } end end