Skip to content

Commit 552e313

Browse files
authored
fix(cg): truncate long clean-cache job name (#72)
Signed-off-by: Xuhui zhang <xuhui@juicedata.io>
1 parent a238eb4 commit 552e313

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

pkg/builder/job.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ func NewCleanCacheJob(cg juicefsiov1.CacheGroup, worker corev1.Pod) *batchv1.Job
324324

325325
job := &batchv1.Job{
326326
ObjectMeta: metav1.ObjectMeta{
327-
Name: common.GenCleanCacheJobName(cg.Name, worker.Spec.NodeName),
327+
Name: utils.GenCleanCacheJobName(cg.Name, worker.Spec.NodeName),
328328
Namespace: worker.Namespace,
329329
Labels: map[string]string{
330330
common.LabelAppType: common.LabelCleanCacheJobValue,

pkg/common/common.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ func GenWorkerName(cgName string, nodeName string) string {
119119
return fmt.Sprintf("%s-%s-%s", WorkerNamePrefix, cgName, nodeName)
120120
}
121121

122-
func GenCleanCacheJobName(cgName, nodeName string) string {
123-
return fmt.Sprintf("%s-%s-%s", CleanCacheContainerName, cgName, nodeName)
124-
}
125-
126122
func GenSyncSecretName(syncJobName string) string {
127123
return fmt.Sprintf("juicefs-%s-secrets", syncJobName)
128124
}

pkg/utils/job.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,7 @@ func GenCronJobName(wuName string) string {
5151
n := fmt.Sprintf("%s-%s", common.WarmUpNamePrefix, wuName)
5252
return TruncateLabelValueWithLength(n, common.CronJobNameMaxLength)
5353
}
54+
55+
func GenCleanCacheJobName(cgName, nodeName string) string {
56+
return TruncateLabelValue(fmt.Sprintf("%s-%s-%s", common.CleanCacheContainerName, cgName, nodeName))
57+
}

0 commit comments

Comments
 (0)