Sha256: f41e71e00aaaff821976512cd664fcbde79d058ffca18c7dddd0a4327b276958
Contents?: true
Size: 959 Bytes
Versions: 2
Compression:
Stored size: 959 Bytes
Contents
module Seira class Helpers include Seira::Commands class << self def rails_env(context:) if context[:cluster] == 'internal' 'production' else context[:cluster] end end def fetch_pods(filters:, app:) filter_string = { app: app }.merge(filters).map { |k, v| "#{k}=#{v}" }.join(',') output = Seira::Commands.kubectl("get pods -o json --selector=#{filter_string}", context: { app: app }, return_output: true) JSON.parse(output)['items'] end def log_link(context:, app:, query:) link = context[:settings].log_link_format return nil if link.nil? link.gsub! 'APP', app link.gsub! 'CLUSTER', context[:cluster] link.gsub! 'QUERY', query link end def get_secret(app:, key:, context: {}) Secrets.new(app: app, action: 'get', args: [], context: context).get(key) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
seira-0.3.7 | lib/helpers.rb |
seira-0.3.6 | lib/helpers.rb |