Skip to content

Scope labels to avoid collisions #64

Description

@ogmueller

It would be really nice, if all chadburn labels are scoped to the container ID/name.

Example:
If a hoster has many docker compose project, it can happen, that the project is using the same labels for chadburn than another project.
These are our labels for a project, where we call an optimize method.

       - "chadburn.enabled=true"
       - "chadburn.job-exec.optimize.schedule=@every 23h"
       - "chadburn.job-exec.optimize.command=php -dmemory_limit=-1 /web/app/console.php index:optimize"
       - "chadburn.job-exec.optimize.no-overlap=true"

Another project has also an optimize step and because of that, named it "optimize" as well.

There is no error message in chadburn, that this is a problem, but the log is rather strange, if you do so. The jobs are kicking themselves in and out all the time and nothing gets executed anymore:

chadburn                | scheduler.go:89 ▶ NOTICE New job registered "optimize" - "php -dmemory_limit=-1 /web/app/console.php index:optimize" - "@every 23h" - ID: 32
chadburn                | scheduler.go:94 ▶ NOTICE Job deregistered (will not fire again) "optimize" - "php -dmemory_limit=-1 /web/app/console.php index:optimize" - "@every 23h" - ID: 32
chadburn                | cron_utils.go:13 ▶ DEBUG removed
chadburn                | scheduler.go:94 ▶ NOTICE Job deregistered (will not fire again) "optimize" - "php -dmemory_limit=-1 /web/app/console.php index:optimize" - "@every 23h" - ID: 32
chadburn                | cron_utils.go:13 ▶ DEBUG removed
chadburn                | cron_utils.go:13 ▶ DEBUG added
chadburn                | scheduler.go:89 ▶ NOTICE New job registered "optimize" - "php -dmemory_limit=-1 /web/app/console.php index:optimize" - "@every 24h" - ID: 33
chadburn                | cron_utils.go:13 ▶ DEBUG added
chadburn                | scheduler.go:89 ▶ NOTICE New job registered "optimize" - "php -dmemory_limit=-1 /web/app/console.php index:optimize" - "@every 24h" - ID: 33
chadburn                | scheduler.go:94 ▶ NOTICE Job deregistered (will not fire again) "optimize" - "php -dmemory_limit=-1 /web/app/console.php index:optimize" - "@every 24h" - ID: 33
chadburn                | cron_utils.go:13 ▶ DEBUG removed
chadburn                | cron_utils.go:13 ▶ DEBUG added
chadburn                | scheduler.go:94 ▶ NOTICE Job deregistered (will not fire again) "optimize" - "php -dmemory_limit=-1 /web/app/console.php index:optimize" - "@every 24h" - ID: 33
chadburn                | scheduler.go:89 ▶ NOTICE New job registered "optimize" - "php -dmemory_limit=-1 /web/app/console.php index:optimize" - "@every 23h" - ID: 34
chadburn                | cron_utils.go:13 ▶ DEBUG removed
chadburn                | cron_utils.go:13 ▶ DEBUG added
chadburn                | scheduler.go:89 ▶ NOTICE New job registered "optimize" - "php -dmemory_limit=-1 /web/app/console.php index:optimize" - "@every 23h" - ID: 34
chadburn                | scheduler.go:94 ▶ NOTICE Job deregistered (will not fire again) "optimize" - "php -dmemory_limit=-1 /web/app/console.php index:optimize" - "@every 23h" - ID: 34
chadburn                | cron_utils.go:13 ▶ DEBUG removed
chadburn                | cron_utils.go:13 ▶ DEBUG added
chadburn                | scheduler.go:89 ▶ NOTICE New job registered "optimize" - "php -dmemory_limit=-1 /web/app/console.php index:optimize" - "@every 24h" - ID: 35
chadburn                | scheduler.go:94 ▶ NOTICE Job deregistered (will not fire again) "optimize" - "php -dmemory_limit=-1 /web/app/console.php index:optimize" - "@every 23h" - ID: 34
chadburn                | cron_utils.go:13 ▶ DEBUG removed
chadburn                | cron_utils.go:13 ▶ DEBUG added
chadburn                | scheduler.go:89 ▶ NOTICE New job registered "optimize" - "php -dmemory_limit=-1 /web/app/console.php index:optimize" - "@every 24h" - ID: 35

If all jobs would be "scoped" to the container, they couldn't overwrite each other and it would prevent any name collision between independent projects. So maybe chadburn could (internally) add the container ID or name to the job-exec name. So if the container is called "gitlab" and the chadburn jobs-exec is called "optimize" make it (internally) "gitlab-optimize" or so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions