Skip to content

Commit 3410f46

Browse files
committed
Add client_endpoint support to container_gateway plugin
Signed-off-by: Eric D. Helms <[email protected]>
1 parent af23995 commit 3410f46

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

manifests/plugin/container_gateway.pp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
# $version:: plugin package version, it's passed to ensure parameter of package resource
3232
# can be set to specific version number, 'latest', 'present' etc.
3333
#
34+
# $client_endpoint:: Endpoint for clients to receive container content when it differs from the
35+
# Pulp endpoint such as a load balancer setup.
36+
#
3437
class foreman_proxy::plugin::container_gateway (
3538
Optional[String] $version = undef,
3639
Boolean $enabled = true,
@@ -44,7 +47,8 @@
4447
Optional[Stdlib::Port] $postgresql_port = undef,
4548
String $postgresql_database = 'container_gateway',
4649
Optional[String[1]] $postgresql_user = undef,
47-
Optional[String] $postgresql_password = undef
50+
Optional[String] $postgresql_password = undef,
51+
Optional[Stdlib::HTTPUrl] $client_endpoint = undef,
4852
) {
4953
foreman_proxy::plugin::module { 'container_gateway':
5054
version => $version,

spec/classes/foreman_proxy__plugin__container_gateway_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,23 @@
9090
it { is_expected.to contain_foreman_proxy__plugin__module('container_gateway').with_version('absent') }
9191
it { is_expected.not_to contain_class('postgresql::server') }
9292
end
93+
94+
describe 'with client_endpoint' do
95+
let :params do {
96+
:client_endpoint => 'https://loadbalancer.example.com',
97+
} end
98+
99+
it 'container_gateway.yml should contain configuration with client_endpoint' do
100+
verify_exact_contents(catalogue, '/etc/foreman-proxy/settings.d/container_gateway.yml', [
101+
'---',
102+
':enabled: https',
103+
":pulp_endpoint: https://#{facts[:networking]['fqdn']}",
104+
':client_endpoint: https://loadbalancer.example.com',
105+
':sqlite_db_path: /var/lib/foreman-proxy/smart_proxy_container_gateway.db',
106+
':db_connection_string: postgres:///container_gateway'
107+
])
108+
end
109+
end
93110
end
94111
end
95112
end

templates/plugin/container_gateway.yml.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# Container Gateway for Katello
33
:enabled: <%= @module_enabled %>
44
:pulp_endpoint: <%= scope.lookupvar("foreman_proxy::plugin::container_gateway::pulp_endpoint") %>
5+
<% if scope.lookupvar("foreman_proxy::plugin::container_gateway::client_endpoint") -%>
6+
:client_endpoint: <%= scope.lookupvar("foreman_proxy::plugin::container_gateway::client_endpoint") %>
7+
<% end -%>
58
:sqlite_db_path: <%= scope.lookupvar("foreman_proxy::plugin::container_gateway::sqlite_db_path") %>
69
<% if scope.lookupvar("foreman_proxy::plugin::container_gateway::sqlite_timeout") -%>
710
:sqlite_timeout: <%= scope.lookupvar("foreman_proxy::plugin::container_gateway::sqlite_timeout") %>

0 commit comments

Comments
 (0)