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

Randomize requests to acme-c.sunet.se #202

Merged
merged 6 commits into from
Oct 18, 2024

Conversation

mariahaider
Copy link
Contributor

Randomize the minute for sending request to acme-c.sunet.se by servers which run the puppet class with single_domain: false

mickenordin and others added 4 commits October 9, 2024 14:31
puppet lint - on everything
Use a non pinned setup-ruby as per their instructions.
@mariahaider mariahaider changed the title Maria randomize request acme c Randomize requests to acme-c.sunet.se Oct 11, 2024
@eest
Copy link
Contributor

eest commented Oct 11, 2024

I am not sure this works as expected. If fqdn_rand() returns "1" this will lead to the minute entry */1 which means "run every minute". I am not sure how the rest of the cron entry looks but if all other fields are *, would it be enough to run once an hour instead of every 20 minutes? If that is the case then we can probably replace "*/${minute_random}" with "${minute_random}" which then will mean "run at this minute (every hour)", and then no matter what rand returns the frequency will be the same, just distributed over the full hour.

@eest
Copy link
Contributor

eest commented Oct 11, 2024

... and if we where to change it to "${minute_random}", keep in mind that the valid range of the minute interval is 0-59, so in that case we might need to change the value in fqdn_rand(60) (I dont recall if the rand range is inclusive (0-60) or exclusive (0-59) of the given number).

@eest
Copy link
Contributor

eest commented Oct 11, 2024

Looking at https://www.puppet.com/docs/puppet/5.5/function.html#fqdn_rand it looks like it is exclusive:

Generates a random Integer number greater than or equal to 0 and less than MAX

... so using 60 is probably correct.

@mariahaider
Copy link
Contributor Author

... and if we where to change it to "${minute_random}", keep in mind that the valid range of the minute interval is 0-59, so in that case we might need to change the value in fqdn_rand(60) (I dont recall if the rand range is inclusive (0-60) or exclusive (0-59) of the given number).

Good point, fixed it, running once an hour should be fine.

Copy link
Contributor

@eest eest left a comment

Choose a reason for hiding this comment

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

LGTM

@mariahaider mariahaider merged commit f709e5e into testing Oct 18, 2024
2 checks passed
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