Class: G5deploy::KubernetesHelper

Inherits:
Thor
  • Object
show all
Defined in:
lib/g5deploy/cli.rb

Instance Method Summary collapse

Instance Method Details

#deploy(environment) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/g5deploy/cli.rb', line 8

def deploy(environment)
  if environment == "production" && options[:with_migration]
    `kubectl config use-context g5-prod && kubectl \
    apply -f k8s/sidekiq-workers.yaml -f k8s/rails-servers.yaml \
    -f k8s/db-migrate.yaml`
  elsif environment == "production"
    `kubectl config use-context g5-prod && kubectl \
    apply -f k8s/sidekiq-workers.yaml -f k8s/rails-servers.yaml`
  elsif environment == "staging" && options[:with_migration]
    `kubectl config use-context integrations-staging && kubectl \
    apply -f k8s/sidekiq-workers.yaml -f k8s/rails-servers.yaml \
    -f k8s/db-migrate.yaml`
  elsif environment == "staging"
    `kubectl config use-context integrations-staging && kubectl \
    apply -f k8s/sidekiq-workers.yaml -f k8s/rails-servers.yaml`
  else
    puts "Command not found!".upcase
  end
end

#pods(environment) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/g5deploy/cli.rb', line 29

def pods(environment)
  if environment == "production"
    `kubectl config use-context g5-prod && kubectl get pods`
  elsif environment == "staging"
    `kubectl config use-context integrations-staging && kubectl get pods`
  else
    puts "Command not found!".upcase
  end
end