Skip to content

Disable cron poller via envvar

Sylvester Chin requested to merge sc1-disable-cron-poller into master

What does this MR do and why?

This MR allows users to disable the cron_poller by setting the environment variable GITLAB_CRON_JOBS_POLL_INTERVAL=0. This functionality will be used by gitlab.com to deprecate the use of namespace in Sidekiq (See details of per-shard rollout gitlab-com/gl-infra/scalability#2481 (closed)).

We can disable the cron poller by setting cron_poll_interval to a negative number. However, configMap configures cron_job via the global.appConfig map which prevents us from targeting individual shard deployments.

A targeted approach via envvar allows us to run 2 groups of sidekiq workers with different SIDEKIQ_ENQUEUE_NON_NAMESPACED values (!116379 (merged)). This controlled rollout is safer than a big-bang approach of disabling all namespaces in all Sidekiq pods on 1 deployment.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

On the master branch, visit http://gdk.test:3000/admin/sidekiq/cron. The last enqueued column will update over time (set live polling on the top right corner).

On this branch

  1. Set GITLAB_CRON_JOBS_POLL_INTERVAL=0 in your gdk's env.runit file.
  2. Restart sidekiq via gdk restart rails-background-jobs
  3. Monitor the cron page http://gdk.test:3000/admin/sidekiq/cron, no more crons should run. tip: just leave it for 5-10 minutes, there should be no more just now or x seconds ago.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sylvester Chin

Merge request reports

Loading