class Kubes::Auth::Gcr

Public Instance Methods

authorize!() click to toggle source
# File lib/kubes/auth/gcr.rb, line 7
def authorize!
  command = "gcloud auth configure-docker"
  logger.debug "Authorizing GCR with: #{command}"
  success = system(command)
  unless success
    logger.error "ERROR: running #{command}".color(:red)
    exit $?.exitstatus if exit_on_fail
  end
  success
end
authorized?() click to toggle source
# File lib/kubes/auth/gcr.rb, line 18
def authorized?
  return false unless File.exist?(docker_config)
  data = JSON.load(IO.read(docker_config))
  !!data.dig('credHelpers', 'gcr.io')
end
run() click to toggle source
# File lib/kubes/auth/gcr.rb, line 3
def run
  authorize! unless authorized?
end