class Kubes::Auth
Normally, you must authorized to AWS ECR to push to their registry with:
eval $(aws ecr get-login --no-include-email)
If you haven't ever ran the ecr get-login command before then you'll get this error:
no basic auth credentials
If you have ran it before but the auto token has expired you'll get this message:
denied: Your Authorization Token has expired. Please run 'aws ecr get-login' to fetch a new one.
This class updates the ~/.docker/config.json file which is an internal docker file to automatically update the auto token for you. If that format changes, the update will need to be updated.
Public Class Methods
new(image)
click to toggle source
# File lib/kubes/auth.rb, line 3 def initialize(image) @image = image end
Public Instance Methods
auth?()
click to toggle source
# File lib/kubes/auth.rb, line 25 def auth? if ENV['KUBES_REPO_AUTO_AUTH'].nil? Kubes.config.repo_auto_auth else %w[1 true].include?(ENV['KUBES_REPO_AUTO_AUTH']) end end
run()
click to toggle source
# File lib/kubes/auth.rb, line 7 def run klass = strategy_class return unless klass klass.new(@image).run end
strategy_class()
click to toggle source
Currently only support ECR and GCR TODO: consider moving this to plugin gems
# File lib/kubes/auth.rb, line 15 def strategy_class return unless auth? case @image when /\.amazonaws\.com/ # IE: 112233445566.dkr.ecr.us-west-2.amazonaws.com/demo/sinatra Ecr when /gcr\.io/ Gcr end end