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

Refs #28922: Communicate via localhost to Candlepin #321

Merged
merged 1 commit into from
Mar 4, 2020

Conversation

ehelms
Copy link
Member

@ehelms ehelms commented Feb 4, 2020

No description provided.

@ehelms
Copy link
Member Author

ehelms commented Feb 24, 2020

I added a candlepin_host parameter and used that as the driver for configuration as it seemed more natural than going through a certs option

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Overall this looks like it's heading in the right direction

@@ -55,7 +55,7 @@
$enable_deb = $katello::params::enable_deb
$pulp_url = $katello::params::pulp_url
$pulp_ca_cert = $certs::katello_server_ca_cert # TODO: certs::apache::...
$candlepin_url = $katello::params::candlepin_url
$candlepin_url = "https://${katello::candlepin_host}:8443/candlepin"
Copy link
Member

Choose a reason for hiding this comment

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

The katello::application should not assume the katello class exists. I should write a PR, but after 2.1 I want to deprecate it altogether. Anything that's shared between katello::application and katello::candlepin should go through katello::params (as the URL was previously). You can then remove the parameter from init.pp

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I follow what you are suggesting. So check out this line and change now... and let me know if I got there or not.

@ekohl
Copy link
Member

ekohl commented Feb 26, 2020

This is a valid way, but if you look at theforeman/foreman-installer#421 there's a few layers:

  • katello::global - all parameters on this class are exposed to installer users as --global-*
  • katello::params - these are shared parameters between multiple components but not exposed to installer users. They are intended for advanced users (directly using the Puppet modules or via custom-hiera.yaml).
  • application layer - all parameters are exposed to installer users
    • katello::candlepin maps to --candlepin-*
    • katello::pulp maps to --pulp-*
    • katello::application maps to --application-*

Now for the installer we don't want to make this configurable while still allowing advanced users to change it. That means it's a parameter on katello::params. It would be confusing to have the parameters to that again at the application layer so on katello::candlepin there would not be a $host parameter but rather inside the body it'd have $body = $katello::params::candlepin_host. And the same for katello::application.

This way we avoid having installer parameters that the user is not supposed to touch while still providing all the power to advanced users who want to do custom things.

Right now I feel this design is still rather experimental and we're inventing a new pattern. This means we may find out it doesn't work or doesn't scale, but I'd like to try it because I feel it has the potential to strike the balance well.

@jturel
Copy link
Contributor

jturel commented Feb 26, 2020

I tested the trio of PRs and it works nicely. Thanks!

@ehelms
Copy link
Member Author

ehelms commented Feb 27, 2020

OK... I think I get the gist of the idea now. Let's see what you think. The tests here won't pass until I merge the corresponding Candlepin and Certs changes.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Other than the 1 line, this is indeed what I suggested.

Stdlib::Httpsurl $pulp_url = "https://${facts['fqdn']}/pulp/api/v2/",
Stdlib::Httpsurl $crane_url = "https://${facts['fqdn']}:5000",
Stdlib::Host $qpid_hostname = 'localhost',
String[1] $candlepin_oauth_key = $katello::globals::candlepin_oauth_key,
String[1] $candlepin_oauth_secret = $katello::globals::candlepin_oauth_secret,
Stdlib::Host $candlepin_host = 'localhost',
Stdlib::Httpsurl $candlepin_url = "https://${candlepin_host}:8443/candlepin"
Copy link
Member

Choose a reason for hiding this comment

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

I don't know if this works. I've seen people use it, but never trusted it. Given this is the only way to deploy candlepin, I'd move the $candlepin_url part to the body of this class.

Copy link
Member Author

Choose a reason for hiding this comment

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

This worked in my testing running these changes live with the installer. If its defined in the body, will other modules be able to access it?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that still works.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

This also means increasing the minimum required version of the candlepin module. Perhaps the candlepin PR should bump the major version and this should update metadata.json.

.fixtures.yml Outdated
@@ -24,6 +24,7 @@ fixtures:
puppet_version: '>= 6.0.0'
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
systemd: "https://github.com/camptocamp/puppet-systemd.git"
transition: "https://github.com/puppetlabs/puppetlabs-transition.git"
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I'd do this as a separate commit. Fine to do it in the same PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Split out

@ehelms
Copy link
Member Author

ehelms commented Mar 1, 2020 via email

@ekohl
Copy link
Member

ekohl commented Mar 3, 2020

This also means increasing the minimum required version of the candlepin module. Perhaps the candlepin PR should bump the major version and this should update metadata.json.

The exact candlepin version doesn't matter that much, but the lower bound should set a version that's actually compatible:

"version_requirement": ">= 4.0.0 < 9.0.0"

Right now puppet-candlepin's master branch has version 8.0.0 which equals the already released version. In the past we just merged these things and worked it out around branching but I'd like to get in the habit of fixing it while we're making changes so I'm not stuck with a bunch of work around branching. theforeman/puppet-candlepin#146 & #325 work towards that.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

I was too soon. Please increase the minimum version in metadata.json to require at least candlepin 9.0.0.

@ehelms ehelms merged commit dae20b5 into theforeman:master Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants