Allow Sidekiq workers to be disabled by default by configuration
What does this MR do and why?
Allow Sidekiq workers to be disabled by default by configuration. Till now, we enabled all workers when a node was connected as a geo node; we now only enable the needed geo workers. With that, we can disable the offline cloud license provision worker for SaaS.
To achieve the desired goal, we changed the behavior of the cron manager in the following way:
Jobs that get disabled
Mode \ State | Before | After |
---|---|---|
Primary | secondary geo jobs | secondary geo jobs |
Secondary | all jobs except geo jobs and secondary jobs | all jobs except geo jobs and secondary jobs |
Non-geo | all geo jobs | all geo jobs |
Jobs that get enabled
Mode \ State |
Before | After |
---|---|---|
Primary | all jobs expect secondary jobs |
all general geo jobs and primary jobs (this is a change, we don't enable non-geo workers any longer) |
Secondary | all general geo jobs and secondary jobs | all general geo jobs and secondary jobs |
Non-geo | all jobs except geo jobs |
all jobs mentioned in the cron manager (this is a change, we don't enable non-geo workers any longer) |
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After | |
---|---|---|
SaaS | ||
self-managed |
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
-
You can check the state of the worker here http://localhost:3000/admin/background_jobs
-
Switch the state of the worker depending the GitLab instance mode
- SaaS
-
Add a file
env.runit
with the following content to the GDK directoryexport GITLAB_SIMULATE_SAAS=0
-
Restart GitLab with
export GITLAB_SIMULATE_SAAS=0; gdk restart
-
- self-managed
-
Add a file
env.runit
with the following content to the GDK directoryexport GITLAB_SIMULATE_SAAS=1
-
Restart GitLab with
export GITLAB_SIMULATE_SAAS=1; gdk restart
-
- SaaS
-
In case the status does not get updated, delete the workers before restarting with the following on a Rails console:
Sidekiq::Cron::Job.all.each(&:destroy)
Resolves https://gitlab.com/gitlab-org/gitlab/-/issues/488887