I want to allow the execution of only 3 jobs (with 6 parallel each) at the same time (concurrencyPolicy=Allow).

On the fourth build attempt, with the previous three still running, Kubernetes should behave like spec.concurrencyPolicy=Forbid. It is possible?

For example:

  • spec.schedule="*/1 * * * *"
  • spec.concurrencyPolicy=Allow
  • spec.jobTemplate.spec.parallelism=6
  • spec.jobTemplate.spec.completions=6
  • spec.activeDeadlineSeconds: 900 # 15 minutes

EXECUTING In 09:00 cronjob creates job with 6 parallels and keeps running for 15 minutes (FIRST execution).

EXECUTING In 09:01 cronjob creates one more job and also runs for 15 minutes (SECOUND execution).

EXECUTING In 09:02 cronjob creates one more job and continues to run for 15 minutes (THIRD execution).

NOT EXECUTING In 09:03 cronjob since there are already three jobs started, it won't start another one until one of the previous ones completes.

until...

In 09:14 the cronjob FIRST execution ends.

In 09:15 cronjob will create one more job.

Always limiting runs to 3. Thanks.

0

There are 0 best solutions below