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
By default k8s job add below labels for unique identification reference - kubernetes Job :
'controller-uid'
'job-name'
so, during job recreate, just delete above labels, and keep other labels and annotations which is added during job create
By below solution, I have recreate job and keeps labels and annotions which is added during job create.
backup labels & annotations before setting __'job.spec.template.metadata'__as NULL i.e. 'None'
labels = copy.copy(job.spec.template.metadata.labels) #create a copy of existing labels
annotations = copy.copy(job.spec.template.metadata.annotations) #create a copy of existing annotations
delete 'controller-uid' and 'job-name' from old labels
del labels["controller-uid"]
del labels["job-name"]
create objectMeta using backup labels and annotations
Currently, pod template metadata is reset to create new job which delete customized label and annotations added during job creation.
File:
kubernetes/contents/job-run.py
Line 45 in 10fd050
By default k8s job add below labels for unique identification reference - kubernetes Job :
so, during job recreate, just delete above labels, and keep other labels and annotations which is added during job create
By below solution, I have recreate job and keeps labels and annotions which is added during job create.
If maintainer and reviewer are okay with above solution, i would like to add above solution here.
The text was updated successfully, but these errors were encountered: