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