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

Redesign classes to allow split deployments #308

Merged
merged 1 commit into from
Dec 19, 2019
Merged

Conversation

ekohl
Copy link
Member

@ekohl ekohl commented Nov 30, 2019

Every class that provides an aspect of the deployment is now standalone. This means:

  • candlepin
  • pulp
  • qpid
  • application

They can just be included and work by themselves. All class parameters are tunables that users will commonly modify.

There's also shared parameters which are common among the standalone classes. These are meant to be changed via katello::params. Either via Hiera or by including them in a profile class before the instance classes themselves.

The katello::globals class has globals that a user via the installer might want to change. The katello::params class is not intended to be exposed via the installer.

Currently a draft because I want to do testing with rewriting the changes in the installer. Having this in a PR makes that easier.

Includes:

@ehelms
Copy link
Member

ehelms commented Dec 2, 2019

I'm trying to follow the over arching design goals of this change and I am having trouble. I think what I need to understand more is the larger goal that we're driving towards. I have for a while thought the end goals would be something akin to:

  1. Make Katello like any other plugin in puppet-foreman
  2. Center backend configuration into either puppet-foreman_proxy_content or the installer
  3. Ensure we don't break user workflows or over complicate orchestrated configuration

@ekohl
Copy link
Member Author

ekohl commented Dec 9, 2019

Rebased so it's easier to see. Also submitted #309 as something that can be merged beforehand.

This is not final yet because I think I can rewrite init.pp to keep backwards compatible while already delivering the new split classes. That should allow experimentation with split deployments while still doing a monolithic deployment in the installer.

@ekohl
Copy link
Member Author

ekohl commented Dec 10, 2019

This is not final yet because I think I can rewrite init.pp to keep backwards compatible while already delivering the new split classes. That should allow experimentation with split deployments while still doing a monolithic deployment in the installer.

This is done now. I've still added the monolithic change on top of it, but viewing the change should be easy now. It does drop some parameters, but I'd argue they didn't make sense for most users anyway.

@ekohl ekohl marked this pull request as ready for review December 10, 2019 15:57
@ekohl
Copy link
Member Author

ekohl commented Dec 10, 2019

I think this is now ready for review. It is backwards incompatible because it drops 6 parameters from init.pp:

  • $user
  • $group
  • $user_groups
  • $qpid_interface
  • $qpid_hostname
  • $package_names

I believe these shouldn't be configurable anyway so there's no loss of functionality here for most users.

@ehelms please have a look. Ideally we'd merge this soon so it has some time to stablize. It should also
@laugmanuel please also have a look. While it doesn't fully solve your use case yet, I'd like to get to a point where we provide suitable profiles (according to the roles/profiles pattern) that can be deployed standalone.

Copy link
Member

@laugmanuel laugmanuel left a comment

Choose a reason for hiding this comment

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

@ekohl thanks for the rework of the module.
We are currently reworking our internal module to use split deployment for pulp, qpid, candlepin, etc. For that we are using the code from this PR and will test it in our release environment.

In general I like the changes but stumbled across some small things as seen by the comments. If these changes are included, I will run the code against our env and report back.

@dgoetz FYI

Stdlib::Httpsurl $candlepin_url = "https://${facts['fqdn']}:8443/candlepin",
Stdlib::Httpsurl $pulp_url = "https://${facts['fqdn']}/pulp/api/v2/",
Stdlib::Httpsurl $crane_url = "https://${facts['fqdn']}:5000",
String $qpid_url = "amqp:ssl:${katello::globals::qpid_hostname}:5671",
Copy link
Member

Choose a reason for hiding this comment

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

It would be necessary to expose qpid_hostname as well. This is needed if Candlepin and QPID are running on different machines. At the moment katello::candlepin and katello::qpid use the default from globals which is localhost.
Given the qpid_url is only used in one template we could remove this variable completely and construct the URL in application.pp.

Another way would be to use the qpid_url in the candlepin.pp / qpid.pp directly but this would require rework of the ::candlepin class and the URL seems to be in a different format.

I think the first way would be much easier.

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 was also considering this. Given it was a parameter in init.pp before, it makes sense to keep it. Will have a look.

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've pushed a separate commit to make review easier but should be squashed on merge. Please have a look.

Copy link
Member

Choose a reason for hiding this comment

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

Change looks good to me.

# The Apache options to use on the `/pub` resource
#
# @param repo_export_dir
# Create a repository export directory for Katello to use
class katello::pulp (
Copy link
Member

Choose a reason for hiding this comment

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

I would appreciate if we could add the following parameters to support split deployments (as mentioned in #304):

  • manage_httpd (boolean)
  • https_cert
  • https_key
  • ca_cert

These values can default to undef / false but should be passed to pulp 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.

My goal would for this PR is to just refactor without adding new params. Hopefully merge it quickly and then iterate on this in a separate PR.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good to me. If I can support you on getting the PR ready for merge just let me know.

@@ -40,6 +40,10 @@
#
# $qpid_wcache_page_size:: The size (in KB) of the pages in the write page cache
#
# $qpid_interface:: The interface qpidd listens to.
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: listens on

@laugmanuel
Copy link
Member

@ekohl now we have some good news for you!

We have successfully upgraded our test environment as far as we can get it using the code in this PR.
What we cannot test at the moment is the upgrade of Pulp and Candlepin because we need the followup PR regarding Certs and manage_httpd (Candlepin is also affected by a different Cert locations / setup).

Next week I will configure a client to talk to the upgraded environment and test some things.

In my perspective this PR is ready.


class { 'katello::params':
Copy link
Member

Choose a reason for hiding this comment

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

Never seen calling params and configuring it as a design convention.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's unconventional and I might clean this up a bit more later as I gain more experience with splitting up into cleaner roles and profiles.

@ehelms
Copy link
Member

ehelms commented Dec 13, 2019

What if any effect will this have on the installer currently? Just dropping a few parameters?

@ekohl
Copy link
Member Author

ekohl commented Dec 13, 2019

What if any effect will this have on the installer currently? Just dropping a few parameters?

It should only drop a few parameters. Any other change would be considered a regression.

@ehelms
Copy link
Member

ehelms commented Dec 18, 2019

Will need a rebase, after that I think I am good with this change.

@laugmanuel
Copy link
Member

laugmanuel commented Dec 18, 2019

@ekohl I have one more thing regarding the Pulp configuration:
We do include ::foreman here: https://github.com/theforeman/puppet-katello/blob/master/manifests/pulp.pp#L37
This basically results in the installation/configuration of a complete stack which does not make any sense if the components are split to different servers.

The only reason for including this class is to be able to access $foreman::servername. This variable is mapped to $::fqdn anyway, which is basicly the same as the default for $pulp::server_name.
And to be able to use foreman::config::passenger::fragment of course.

What are your thoughts?

@ekohl
Copy link
Member Author

ekohl commented Dec 18, 2019

That's the hard part about our vhost handling. I'd say we need some handling that's roughly:

if $manage_vhost {
  include foreman
  $servername = $foreman::servername
  foreman::config::apache::fragment { 'pulp':
    # ...
  }
} else {
  $servername = undef
}

class { 'pulp':
  servername   => $servername,
  manage_httpd => manage_vhost,
  # ...
}

Every class that provides an aspect of the deployment is now standalone.
This means:

* candlepin
* pulp
* qpid
* application

They can just be included and work by themselves. All class parameters
are tunables that users will commonly modify.

There's also shared parameters which are common among the standalone
classes. These are meant to be changed via katello::params. Either via
Hiera or by including them in a profile class before the instance
classes themselves.

The katello::globals class has globals that a user via the installer
might want to change. The katello::params class is not intended to be
exposed via the installer.

The main katello class remains as a compatibility class. In the future
this should probably be converted into a role but perhaps it is no
needed at all.
@ekohl
Copy link
Member Author

ekohl commented Dec 18, 2019

Rebased to resolve the conflict. I've also moved $katello::params::qpid_interface to $katello::qpid::interface since it's only used in that class.

@ekohl ekohl merged commit ac38043 into theforeman:master Dec 19, 2019
@ekohl ekohl deleted the globals branch December 19, 2019 12:41
@ekohl
Copy link
Member Author

ekohl commented Dec 19, 2019

Thanks for the reviews. Merged now and I'm looking forward to iterating on this.

@laugmanuel
Copy link
Member

Thanks @ekohl !
I did already prepare the follow up and will open a PR as soon as I've tested everything.

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