Skip to content

Commit

Permalink
Refs #27418 - Smart Proxy Pulp based registry URL
Browse files Browse the repository at this point in the history
This patch uses the Smart Proxy Pulp setting registry_url to determine
where it can find the container registry. It assumes the same CA is used
as the Smart Proxy itself rather than relying on the hard coded config.

If there's a need for a different value, this could also be stored as a
config and learned dynamically via a trusted channel that is the Proxy
Registration.
  • Loading branch information
ekohl committed Aug 9, 2019
1 parent 8226770 commit 3367309
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions app/lib/katello/resources/registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,24 @@ class << self
def load_class
container_config = SETTINGS.dig(:katello, :container_image_registry)
registry_url = nil

if container_config
crane_url = container_config[:crane_url]
pulp_registry_url = container_config[:pulp_registry_url]
registry_url = crane_url if crane_url
# pulp 3 acts as its own registry
if pulp_registry_url && content_pulp3_support?(::Katello::DockerBlob::CONTENT_TYPE)
registry_url = pulp_registry_url
end
ca_cert_file = nil

if content_pulp3_support?(::Katello::DockerBlob::CONTENT_TYPE)
registry_url = self.setting('Pulp3', 'registry_url')

This comment has been minimized.

Copy link
@ekohl

ekohl Aug 20, 2019

Author Owner

theforeman/smart_proxy_pulp@1c8e953 changed this to content_app_url

# Assume the registry uses the same CA as the Smart Proxy
ca_cert_file = Setting[:ssl_ca_file]
elsif container_config
registry_url = container_config[:crane_url]
ca_cert_file = container_config[:crane_ca_cert_file]
end

logger.send(:error, "No container registry url specified") unless registry_url
logger.send(:warning, "No container ca cert file specified") unless ca_cert_file

uri = URI.parse(registry_url)
self.prefix = uri.path
self.site = "#{uri.scheme}://#{uri.host}:#{uri.port}"
self.ca_cert_file = container_config[:registry_ca_cert_file]
self.ca_cert_file = ca_cert_file
self
end

Expand Down

0 comments on commit 3367309

Please sign in to comment.