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

Inconsistent cron replication documentation and implementation #20429

Closed
Joseph94m opened this issue May 14, 2024 · 1 comment
Closed

Inconsistent cron replication documentation and implementation #20429

Joseph94m opened this issue May 14, 2024 · 1 comment
Assignees
Labels

Comments

@Joseph94m
Copy link

Joseph94m commented May 14, 2024

The documentation in the harbor GUI states that the seconds field can take any value from 0-59
image
https://github.com/goharbor/harbor/blob/main/src/portal/src/app/shared/components/cron-schedule/cron-tooltip/cron-tooltip.component.html#L29

But when a value different than 0 is specified, the validator fails the request with the following message:
the 1st field (indicating Seconds of time) of the cron setting must be 0

By searching for the message we find the culprit: https://github.com/goharbor/harbor/blob/main/src/controller/replication/model/model.go#L113

Versions:
Please specify the versions of following systems.

  • harbor version: [2.10.0]
  • docker engine version: [5:26.0.0-1~debian.11~bullseye]
  • docker-compose version: [2.25.0-1~debian.11~bullseye]

Why are we forcing the seconds value to be 0? Personally it suits be to be able to specify the replication crons up to the second.
I have a few pull-based replications that i perform every 2 minutes, but I want to stagger them out every 15 seconds so we don't have a thundering herd on the source harbor.


Speaking of that, when a harbor receives multiple requests and that it can't handle all of them, it starts rejecting the requests with 401/403 status codes but that's an issue for another day.
By digging deeper, I found that it's the Auth Middleware that does not give back the oath token, and when the request continues to the backend, it is not equipped with the oauth so the remaining calls fail.

@zyyw
Copy link
Contributor

zyyw commented May 20, 2024

The cron image is just a general rule on how to specify cron string for scheduled job. However, Harbor enforced some additional limitations.
As for the second field, it is fixed to be 0. The reason for that is mainly to avoid users configuring it as * which is overwhelming and doesn't makes sense. And the second field is fixed as 0 in UI for all scheduled tasks, API is try to make it consistent with it.
As for the minute field, it cannot be *, because replicating every minute might also be overwhelming.

@zyyw zyyw closed this as completed May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants