Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable FLATPAK_INDEX for pulp registry #363

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions manifests/plugin/container.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@
# @param location_prefix
# In the Apache configuration a location with this prefix is exposed. The
# version (currently v2) will be appended.
# @param registry_version_path
# The path beneath the location prefix to forward. This is also appended to
# the content base url.
class pulpcore::plugin::container (
String $location_prefix = '/pulpcore_registry',
String $registry_version_path = '/v2/',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the driver for dropping the /v2/ in the path? I think that's the only part that isn't clear.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that flatpak needs a different path, so instead of having two locations to proxy, it was decided to proxy the whole /pulpcore_registry.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. #363 (review) tells me it needs to retrieve /pulpcore_registry/index/static though the spec says there's also /pulpcore_registry/index/dynamic. Prior to #363 (comment) there were both, but that looks redundant to me.

) {
$context = {
'directories' => [
{
'provider' => 'location',
'path' => "${location_prefix}${registry_version_path}",
'path' => $location_prefix,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this replace the previous definition instead? I don't see why you would specify both. Then we can also drop the $registry_version_path variable altogether.

The one reason I could see is if you want to make it depend on FLATPAK_INDEX behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both registries are needed here. Right? @sjha4

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My reasoning is that if you have ${location_prefix} mapping to ${pulpcore::apache::api_base_url} then ${location_prefix}${registry_version_path} mapping to ${pulpcore::apache::api_base_url}${registry_version_path} is already implied.

'proxy_pass' => [
{
'url' => "${pulpcore::apache::api_base_url}${registry_version_path}",
'url' => $pulpcore::apache::api_base_url,
},
],
'request_headers' => $pulpcore::apache::api_default_request_headers + $pulpcore::apache::api_additional_request_headers,
Expand All @@ -31,7 +27,7 @@
}

pulpcore::plugin { 'container':
config => 'TOKEN_AUTH_DISABLED=True',
config => "TOKEN_AUTH_DISABLED=True\nFLATPAK_INDEX=True",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason someone might want to set this to False? Should it be a parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This setting is required by Pulp to manage Flatpak images.

https_content => epp('pulpcore/apache-fragment.epp', $context),
}
}
15 changes: 8 additions & 7 deletions spec/classes/plugin_container_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@
.that_subscribes_to('Class[Pulpcore::Install]')
.that_notifies(['Class[Pulpcore::Database]', 'Class[Pulpcore::Service]'])
is_expected.to contain_package('pulpcore-plugin(container)')
is_expected.to contain_concat__fragment('plugin-container').with_content("\n# container plugin settings\nTOKEN_AUTH_DISABLED=True")
is_expected.to contain_concat__fragment('plugin-container')
.with_content("\n# container plugin settings\nTOKEN_AUTH_DISABLED=True\nFLATPAK_INDEX=True")
is_expected.to contain_pulpcore__apache__fragment('plugin-container')
is_expected.not_to contain_apache__vhost__fragment('pulpcore-http-plugin-container')
is_expected.to contain_apache__vhost__fragment('pulpcore-https-plugin-container')
.with_vhost('pulpcore-https')
.with_priority('10')
.with_content(<<APACHE_CONFIG)

<Location "/pulpcore_registry/v2/">
<Location "/pulpcore_registry">
RequestHeader unset REMOTE-USER
RequestHeader unset REMOTE_USER
ProxyPass unix:///run/pulpcore-api.sock|http://pulpcore-api/v2/
ProxyPassReverse unix:///run/pulpcore-api.sock|http://pulpcore-api/v2/
ProxyPass unix:///run/pulpcore-api.sock|http://pulpcore-api
ProxyPassReverse unix:///run/pulpcore-api.sock|http://pulpcore-api
</Location>

ProxyPass /pulp/container/ unix:///run/pulpcore-content.sock|http://pulpcore-content/pulp/container/
Expand All @@ -49,12 +50,12 @@ class {'pulpcore':
.with_priority('10')
.with_content(<<APACHE_CONFIG)

<Location "/pulpcore_registry/v2/">
<Location "/pulpcore_registry">
RequestHeader unset REMOTE-USER
RequestHeader unset REMOTE_USER
RequestHeader set REMOTE-USER "admin" "expr=%{SSL_CLIENT_S_DN_CN} == 'foreman.example.com'"
ProxyPass unix:///run/pulpcore-api.sock|http://pulpcore-api/v2/
ProxyPassReverse unix:///run/pulpcore-api.sock|http://pulpcore-api/v2/
ProxyPass unix:///run/pulpcore-api.sock|http://pulpcore-api
ProxyPassReverse unix:///run/pulpcore-api.sock|http://pulpcore-api
</Location>

ProxyPass /pulp/container/ unix:///run/pulpcore-content.sock|http://pulpcore-content/pulp/container/
Expand Down
Loading