mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
update documentation on generateSelector for manual selector case
This commit is contained in:
parent
096e67d30e
commit
cd71486cfb
@ -211,9 +211,8 @@ func generateSelector(obj *batch.Job) {
|
|||||||
// a label.
|
// a label.
|
||||||
_, found := obj.Spec.Template.Labels["job-name"]
|
_, found := obj.Spec.Template.Labels["job-name"]
|
||||||
if found {
|
if found {
|
||||||
// User asked us to not automatically generate a selector and labels,
|
// User asked us to automatically generate a selector, but set manual labels.
|
||||||
// but set a possibly conflicting value. If there is a conflict,
|
// If there is a conflict, we will reject in validation.
|
||||||
// we will reject in validation.
|
|
||||||
} else {
|
} else {
|
||||||
obj.Spec.Template.Labels["job-name"] = string(obj.ObjectMeta.Name)
|
obj.Spec.Template.Labels["job-name"] = string(obj.ObjectMeta.Name)
|
||||||
}
|
}
|
||||||
@ -221,9 +220,8 @@ func generateSelector(obj *batch.Job) {
|
|||||||
// only match this job.
|
// only match this job.
|
||||||
_, found = obj.Spec.Template.Labels["controller-uid"]
|
_, found = obj.Spec.Template.Labels["controller-uid"]
|
||||||
if found {
|
if found {
|
||||||
// User asked us to automatically generate a selector and labels,
|
// User asked us to automatically generate a selector, but set manual labels.
|
||||||
// but set a possibly conflicting value. If there is a conflict,
|
// If there is a conflict, we will reject in validation.
|
||||||
// we will reject in validation.
|
|
||||||
} else {
|
} else {
|
||||||
obj.Spec.Template.Labels["controller-uid"] = string(obj.ObjectMeta.UID)
|
obj.Spec.Template.Labels["controller-uid"] = string(obj.ObjectMeta.UID)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user