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

[master] Add onlyifrunning option for Service Beacon #66809

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

Conversation

scornelissen85
Copy link
Contributor

@scornelissen85 scornelissen85 commented Aug 15, 2024

With this option it's able to only fire events that match the running state

What does this PR do?

I added this change because I don't want my Salt master being overloaded with events I'm not interested in. In my case I only would receive an event when the service is stopped. Without this change the event bus is, for all connected minions, overloaded with events about the running services which I will ignore. This will filter these events from the beacon directly.

What issues does this PR fix or reference?

Previous Behavior

Without this option it will fire the event without filtering the running state

New Behavior

It allows the user to configure that an event should only be fired when the running state is matched with what's configured per service.

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes

Please review Salt's Contributing Guide for best practices, including the
PR Guidelines.

See GitHub's page on GPG signing for more information about signing commits with GPG.

@scornelissen85 scornelissen85 requested a review from a team as a code owner August 15, 2024 09:52
@salt-project-bot-prod-environment salt-project-bot-prod-environment bot changed the title Add onlyifrunning option for Service Beacon [master] Add onlyifrunning option for Service Beacon Aug 15, 2024
@scornelissen85 scornelissen85 force-pushed the feature/beacon-service-add-matching-state branch 2 times, most recently from d55137e to fd955f8 Compare August 15, 2024 10:16
@scornelissen85 scornelissen85 force-pushed the feature/beacon-service-add-matching-state branch from fd955f8 to 38a5731 Compare August 15, 2024 11:32
@Sxderp
Copy link

Sxderp commented Aug 15, 2024

I think the name of this should change.

onlyifrunning: True
Implies, to me, that the item will only trigger if running (matches PR).

onlyifrunning: False
Implies, to me, that the item will trigger regardless of running state (does not match the PR).

Perhaps something like on_running_state: (True|False|None) or is_running_state: (True|False|None) ?

@scornelissen85
Copy link
Contributor Author

Ah, yes. I was a bit lost in naming the parameter. Maybe filter should be added, as it will filter out only the matched state? Something like is_running_state_filter?

@scornelissen85
Copy link
Contributor Author

@Sxderp I have renamed the parameter to is_running_state.

salt/beacons/service.py Outdated Show resolved Hide resolved
With this option it's able to only fire events that match the running state
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.

4 participants