You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This adds 13 characters to the CronJob name to create the Job object. However, according to the Kubernetes CronJob spec, when Kubernetes creates a Job from a CronJob, it will only add 11 characters, so the CronJob can be up until 52 characters long.
When creating a Job through ArgoCD UI "Create Job" option will produce the following error:
Unable to execute resource action: Job.batch "***-202406281143" is invalid: [metadata.labels: Invalid value: "***-202406281143": must be no more than 63 characters, spec.template.labels: Invalid value: "***-202406281143": must be no more than 63 characters]
Which makes sense, when the CronJob is 52 characters long, ArgoCD will create a Job with a name of 65 characters long, which will produce the above error.
To Reproduce
Create an Application in ArgoCD that creates a CronJob, with a name of length 51-52
Manually create a Job from that CronJob using the UI
This will show the above error.
Expected behavior
A Job will be started from the CronJob immediately with a correct name.
Recommendations
Replacing %Y (4-digit year) in the date format to %y (2-digit year), will create a Job with CronJob name +11 characters (which is conveniently exactly within spec).
I wonder if having the date in the Job "matters"...meaning, what if we switched to a UUID format? Just a thought. But I agree to maybe not change it right away.
I wonder if having the date in the Job "matters"...meaning, what if we switched to a UUID format? Just a thought. But I agree to maybe not change it right away.
@christianh814 I don't think the current naming is documented anywhere, at least I could not find it in the related discussion for this feature #4116
Checklist:
argocd version
.Describe the bug
When starting a Job from a CronJob in the ArgoCD UI, the Job is created by appending the date string
%Y%m%d%H%M
to the CronJob.metadata.name
.(See https://github.com/argoproj/argo-cd/blob/master/resource_customizations/batch/CronJob/actions/create-job/action.lua#L39)
This adds 13 characters to the
CronJob
name to create theJob
object. However, according to the Kubernetes CronJob spec, when Kubernetes creates aJob
from aCronJob
, it will only add 11 characters, so theCronJob
can be up until 52 characters long.When creating a
Job
through ArgoCD UI "Create Job" option will produce the following error:Which makes sense, when the
CronJob
is 52 characters long, ArgoCD will create aJob
with a name of 65 characters long, which will produce the above error.To Reproduce
CronJob
, with a name of length 51-52This will show the above error.
Expected behavior
A Job will be started from the CronJob immediately with a correct name.
Recommendations
Replacing
%Y
(4-digit year) in the date format to%y
(2-digit year), will create a Job with CronJob name +11 characters (which is conveniently exactly within spec).So, changing:
%Y%m%d%H%M
to%y%m%d%H%M
in the following file: https://github.com/argoproj/argo-cd/blob/master/resource_customizations/batch/CronJob/actions/create-job/action.lua#L39
Version
(server version only, commandline not available)
The text was updated successfully, but these errors were encountered: