Skip to content

Enable Watcher storage collector by default #190

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cescgina
Copy link
Contributor

Enable both the compute and storage model collector by default in the
watcher-operator.

@openshift-ci openshift-ci bot requested review from dprince and raukadah June 20, 2025 10:09
Copy link

openshift-ci bot commented Jun 20, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign abays for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cescgina
Copy link
Contributor Author

/hold

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/d952966d65dd4bee82bbe02725da9808

openstack-meta-content-provider-master FAILURE in 9m 07s
⚠️ watcher-operator-validation-master SKIPPED Skipped due to failed job openstack-meta-content-provider-master (non-voting)
✔️ openstack-meta-content-provider-epoxy SUCCESS in 2h 09m 51s
✔️ watcher-operator-validation-epoxy SUCCESS in 1h 38m 19s
watcher-operator-validation-epoxy-ocp4-16 RETRY_LIMIT in 8m 41s
✔️ noop SUCCESS in 0s
⚠️ watcher-operator-kuttl SKIPPED Skipped due to failed job openstack-meta-content-provider-master

Copy link
Contributor

@amoralej amoralej left a comment

Choose a reason for hiding this comment

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

General comment, although I think this approach of dynamically configuring storage backend is doable, I'd consider a better approach to manage that in watcher, so that it simply skips storage model collection if there is no cinder service in the cluster.

Actually, I'd say it already does it pretty well as it will just skip running it unless a storage scope is included in an audit

https://github.com/openstack/watcher/blob/93366df2641b64b7bc345ed91bfbef7ae17de25a/watcher/decision_engine/model/collector/cinder.py#L150-L155

and, in that case, even if the storage plugin is not enable by default, the strategy itself will trigger a storage model collection iirc, so this parameter will be irrelevant

https://github.com/openstack/watcher/blob/master/watcher/decision_engine/strategy/strategies/base.py#L309-L315

I'd be more inclined to enable storage by default in the watcher-operator and make sure watcher has an acceptable behavior if cinder is not enabled (maybe reporting a warning message) from watcher code.

Said that, this is doable, but I consider adds unneeded complexity. I'm leaving some comments in case we want to follow the dynamic configuration approach.


isCinderEnabled := isCinderEnabled(ctx, helper, instance.Namespace)
// store whether cinder is enabled so that it can trigger a restart if it changes
(*envVars)["CinderEnabled"] = env.SetValue(strconv.FormatBool(isCinderEnabled))
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this envVar anywhere?

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 is passed later to createHashOfInputHashes to create a hash to check if we need to trigger a reconcile

Comment on lines 409 to 412
Watches(&keystonev1.KeystoneEndpoint{},
handler.EnqueueRequestsFromMapFunc(r.findObjectsWithAppSelectorLabelInNamespace),
builder.WithPredicates(keystonev1.KeystoneEndpointStatusChangedPredicate),
).
Copy link
Contributor

Choose a reason for hiding this comment

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

If i understand properly, the logic implemented in EnqueueRequestsFromMapFunc, this will trigger reconcile loop on any change in any of the keystone endpoints.

I think this may be refined to trigger the reconcile only if the changed endpoint is a cinder one. An example:

https://github.com/openstack-k8s-operators/horizon-operator/pull/403/files#diff-9120f3782346960d1be3a926dabf7e19310507fe32b122f5119ae3c0112ab906

@cescgina
Copy link
Contributor Author

cescgina commented Jul 2, 2025

General comment, although I think this approach of dynamically configuring storage backend is doable, I'd consider a better approach to manage that in watcher, so that it simply skips storage model collection if there is no cinder service in the cluster.

Actually, I'd say it already does it pretty well as it will just skip running it unless a storage scope is included in an audit

https://github.com/openstack/watcher/blob/93366df2641b64b7bc345ed91bfbef7ae17de25a/watcher/decision_engine/model/collector/cinder.py#L150-L155

and, in that case, even if the storage plugin is not enable by default, the strategy itself will trigger a storage model collection iirc, so this parameter will be irrelevant

https://github.com/openstack/watcher/blob/master/watcher/decision_engine/strategy/strategies/base.py#L309-L315

I'd be more inclined to enable storage by default in the watcher-operator and make sure watcher has an acceptable behavior if cinder is not enabled (maybe reporting a warning message) from watcher code.

Said that, this is doable, but I consider adds unneeded complexity. I'm leaving some comments in case we want to follow the dynamic configuration approach.

as discussed somewhere else, I'll revert back to the original commit and enable both the storage and compute models since as @amoralej points out, enabling the storage model without cinder should be safe as long as the user does not create any audit that involves storage migration

@cescgina cescgina force-pushed the enable_storage_collector branch from 7021758 to a519975 Compare July 2, 2025 13:23
Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/5709c5a8aa05454b90accc59158f8092

✔️ openstack-meta-content-provider-master SUCCESS in 3h 09m 55s
watcher-operator-validation-master FAILURE in 2h 11m 53s (non-voting)
✔️ openstack-meta-content-provider-epoxy SUCCESS in 2h 18m 50s
watcher-operator-validation-epoxy FAILURE in 1h 41m 31s
✔️ watcher-operator-validation-epoxy-ocp4-16 SUCCESS in 1h 50m 11s
✔️ noop SUCCESS in 0s
✔️ watcher-operator-kuttl SUCCESS in 40m 27s

Enable both the compute and storage model collector by default in the
watcher-operator.
@cescgina cescgina force-pushed the enable_storage_collector branch from a519975 to 58921c6 Compare July 3, 2025 09:35
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.

2 participants