mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 11:13:48 +00:00
update name of pod index label
This commit is contained in:
parent
ecf0cee91c
commit
98c6e25c37
@ -315,8 +315,7 @@ func addCompletionIndexLabel(template *v1.PodTemplateSpec, index int) {
|
||||
if template.Labels == nil {
|
||||
template.Labels = make(map[string]string, 1)
|
||||
}
|
||||
// Use completion index annotation as label as well for consistency.
|
||||
template.Labels[batch.JobCompletionIndexAnnotation] = strconv.Itoa(index)
|
||||
template.Labels[batch.JobCompletionIndexLabel] = strconv.Itoa(index)
|
||||
}
|
||||
|
||||
func podGenerateNameWithIndex(jobName string, index int) string {
|
||||
|
@ -4413,8 +4413,8 @@ func TestFinalizersRemovedExpectations(t *testing.T) {
|
||||
func checkJobCompletionLabel(t *testing.T, p *v1.PodTemplateSpec) {
|
||||
t.Helper()
|
||||
labels := p.GetLabels()
|
||||
if labels == nil || labels[batch.JobCompletionIndexAnnotation] == "" {
|
||||
t.Errorf("missing expected pod label %s", batch.JobCompletionIndexAnnotation)
|
||||
if labels == nil || labels[batch.JobCompletionIndexLabel] == "" {
|
||||
t.Errorf("missing expected pod label %s", batch.JobCompletionIndexLabel)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,8 @@ const (
|
||||
labelPrefix = "batch.kubernetes.io/"
|
||||
|
||||
JobCompletionIndexAnnotation = labelPrefix + "job-completion-index"
|
||||
// JobCompletionIndexLabel is defined following the format <controller>.kubernetes.io/pod-index
|
||||
JobCompletionIndexLabel = "job.kubernetes.io/pod-index"
|
||||
// JobTrackingFinalizer is a finalizer for Job's pods. It prevents them from
|
||||
// being deleted before being accounted in the Job status.
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user