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

Add parameter to enable iop-advisor-engine to rh_cloud plugin #1204

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ehelms
Copy link
Member

@ehelms ehelms commented Jan 16, 2025

No description provided.

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.

Can we add an acceptance test?

manifests/plugin/rh_cloud.pp Outdated Show resolved Hide resolved
class foreman::plugin::rh_cloud {
class foreman::plugin::rh_cloud (
Boolean $enable_iop_advisor_engine = false,
) {
foreman::plugin { 'rh_cloud':
Copy link
Member

Choose a reason for hiding this comment

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

theforeman/foreman_rh_cloud#932 introduces settings. IMHO this should create a /etc/foreman/settings.plugins.d/${plugin}.yaml file with that which can be done easily with the existing config parameter. The following keeps it simple and avoids a template by using stdlib::to_yaml:

Suggested change
foreman::plugin { 'rh_cloud':
$config = {
':foreman_rh_cloud' => {
':use_local_advisor_engine' => $enable_iop_advisor_engine,
},
}
foreman::plugin { 'rh_cloud':
config => stdlib::to_yaml($config),

I'm not 100% sure on the use of symbols vs strings though. That could break.

Copy link
Member

@evgeni evgeni Jan 24, 2025

Choose a reason for hiding this comment

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

# cat /etc/foreman/plugins/foreman_rh_cloud.yaml 
---
":foreman_rh_cloud":
  ":use_local_advisor_engine": true

# foreman-rake console
Loading production environment (Rails 7.0.8.7)
irb(main):001:0> SETTINGS.dig(:foreman_rh_cloud, :use_local_advisor_engine)
=> nil

😡

Why are we using symbols again?

Copy link
Member

Choose a reason for hiding this comment

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

Because it makes life interesting? I wonder if we should enhance https://github.com/theforeman/foreman/blob/9e5da95e3194f37b71f013794835fd1d0f9a4a30/config/settings.rb#L40 to symbolize keys.

Copy link
Member

Choose a reason for hiding this comment

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

maybe… but I am not shooting at that can of worms today.

@evgeni
Copy link
Member

evgeni commented Jan 17, 2025

Can we add an acceptance test?

rh_cloud needs Katello, so an acceptance test seems complicated to me?

@ekohl
Copy link
Member

ekohl commented Jan 22, 2025

rh_cloud needs Katello, so an acceptance test seems complicated to me?

If it's only about installing the package, it may be OK?+ I'd think we can still do a DB migration and start the service without candlepin present since that sounds similar to what we do in CI.

We already have some code to set up the repo:

yumrepo { 'katello':
baseurl => "http://yum.theforeman.org/katello/nightly/katello/el${facts['os']['release']['major']}/x86_64/",
gpgcheck => 0,
}

@evgeni evgeni force-pushed the add-enable-iop-advisor-engine branch from e9387e2 to 1fd20a1 Compare January 23, 2025 08:03
.fixtures.yml Outdated Show resolved Hide resolved
@evgeni evgeni force-pushed the add-enable-iop-advisor-engine branch 3 times, most recently from c391f6e to 2934855 Compare January 24, 2025 06:10
.fixtures.yml Show resolved Hide resolved
Comment on lines +9 to +17
file { '/etc/foreman-proxy':
ensure => directory,
}

group { 'foreman-proxy':
ensure => present,
}
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need a foreman-proxy in puppet-foreman? That feels like a horrible violation of principles where Foreman should never read files from foreman-proxy. Is this because of certs?

Copy link
Member

Choose a reason for hiding this comment

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

Yepp, advisor-engine uses the proxy cert to auth against Foreman, and that lives in /etc/foreman-proxy (and gets read from there into a podman secret).
We probably can make puppet-certs deploy a second copy into /etc/iop-advisor-engine to avoid that, but today it's not happening.

Copy link
Member

Choose a reason for hiding this comment

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

I already mentioned before that I feel advisor engine belongs closer to a Smart Proxy because that's where all our external integration lives. We really need to figure out external services in a consistent way, especially if we expect more services to be added. Perhaps our Smart Proxy model isn't scalable, but I've made a mental note we need to discuss this. For now a note above it in the acceptance test is a "good enough" to allow us to proceed?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, we're abusing a bit of the SP architecture, even tho I still think it's not actually a SP thing (e.g. you can't have multiple of it, which breaks the SP paradigm).

I'll add a note to the test, yes.

@evgeni evgeni force-pushed the add-enable-iop-advisor-engine branch from 2934855 to c595e86 Compare January 24, 2025 11:03
ehelms and others added 2 commits January 24, 2025 12:23
@evgeni evgeni force-pushed the add-enable-iop-advisor-engine branch from c595e86 to fa3d0f4 Compare January 24, 2025 11:25
@evgeni
Copy link
Member

evgeni commented Jan 24, 2025

Not beautiful, but 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.

I don't kind merging this. IMHO the 2 issues are structural and not limited to this PR.

I'm hopeful that if we fix the service discovery issue properly we don't even need the config file and the symbols in YAML issue disappears

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants