mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Change ScheduledJob POD name suffix from hash to Unix Epoch
This commit is contained in:
		
				
					committed by
					
						
						jdlugole
					
				
			
			
				
	
			
			
			
						parent
						
							79fc0a95a0
						
					
				
				
					commit
					d1896a695f
				
			@@ -32,7 +32,6 @@ go_library(
 | 
				
			|||||||
        "//pkg/runtime:go_default_library",
 | 
					        "//pkg/runtime:go_default_library",
 | 
				
			||||||
        "//pkg/types:go_default_library",
 | 
					        "//pkg/types:go_default_library",
 | 
				
			||||||
        "//pkg/util/errors:go_default_library",
 | 
					        "//pkg/util/errors:go_default_library",
 | 
				
			||||||
        "//pkg/util/hash:go_default_library",
 | 
					 | 
				
			||||||
        "//pkg/util/metrics:go_default_library",
 | 
					        "//pkg/util/metrics:go_default_library",
 | 
				
			||||||
        "//pkg/util/runtime:go_default_library",
 | 
					        "//pkg/util/runtime:go_default_library",
 | 
				
			||||||
        "//pkg/util/wait:go_default_library",
 | 
					        "//pkg/util/wait:go_default_library",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,7 +19,6 @@ package cronjob
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"encoding/json"
 | 
						"encoding/json"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"hash/adler32"
 | 
					 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/golang/glog"
 | 
						"github.com/golang/glog"
 | 
				
			||||||
@@ -30,7 +29,6 @@ import (
 | 
				
			|||||||
	"k8s.io/kubernetes/pkg/apis/batch"
 | 
						"k8s.io/kubernetes/pkg/apis/batch"
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/runtime"
 | 
						"k8s.io/kubernetes/pkg/runtime"
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/types"
 | 
						"k8s.io/kubernetes/pkg/types"
 | 
				
			||||||
	hashutil "k8s.io/kubernetes/pkg/util/hash"
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Utilities for dealing with Jobs and CronJobs and time.
 | 
					// Utilities for dealing with Jobs and CronJobs and time.
 | 
				
			||||||
@@ -200,10 +198,9 @@ func getJobFromTemplate(sj *batch.CronJob, scheduledTime time.Time) (*batch.Job,
 | 
				
			|||||||
	return job, nil
 | 
						return job, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func getTimeHash(scheduledTime time.Time) uint32 {
 | 
					// Return Unix Epoch Time
 | 
				
			||||||
	timeHasher := adler32.New()
 | 
					func getTimeHash(scheduledTime time.Time) int64 {
 | 
				
			||||||
	hashutil.DeepHashObject(timeHasher, scheduledTime)
 | 
						return scheduledTime.Unix()
 | 
				
			||||||
	return timeHasher.Sum32()
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// makeCreatedByRefJson makes a json string with an object reference for use in "created-by" annotation value
 | 
					// makeCreatedByRefJson makes a json string with an object reference for use in "created-by" annotation value
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user