Class: Seira::Helpers

Inherits:
Object
  • Object
show all
Defined in:
lib/helpers.rb

Class Method Summary collapse

Class Method Details

.fetch_pods(filters:, app:) ⇒ Object



12
13
14
15
# File 'lib/helpers.rb', line 12

def fetch_pods(filters:, app:)
  filter_string = { app: app }.merge(filters).map { |k, v| "#{k}=#{v}" }.join(',')
  JSON.parse(`kubectl get pods --namespace=#{app} -o json --selector=#{filter_string}`)['items']
end

.rails_env(context:) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/helpers.rb', line 4

def rails_env(context:)
  if context[:cluster] == 'internal'
    'production'
  else
    context[:cluster]
  end
end