Fix index and suffix of cronjob names
This commit is contained in:
@@ -62,7 +62,8 @@ func buildCrontab(deployName string, deployment *helm.Deployment, s *types.Servi
|
|||||||
fileGeneratorChan <- role
|
fileGeneratorChan <- role
|
||||||
fileGeneratorChan <- roleBinding
|
fileGeneratorChan <- roleBinding
|
||||||
|
|
||||||
index := len(crons) - 1 // will be 0 when there is only one cron - made to name crons
|
numcron := len(crons) - 1
|
||||||
|
index := 1
|
||||||
|
|
||||||
// create crontabs
|
// create crontabs
|
||||||
for _, cron := range crons {
|
for _, cron := range crons {
|
||||||
@@ -84,14 +85,13 @@ func buildCrontab(deployName string, deployment *helm.Deployment, s *types.Servi
|
|||||||
}
|
}
|
||||||
|
|
||||||
name := deployName
|
name := deployName
|
||||||
if index > 0 {
|
if numcron > 0 {
|
||||||
name = fmt.Sprintf("%s-%d", deployName, index)
|
name = fmt.Sprintf("%s-%d", deployName, index)
|
||||||
index++
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// add crontab
|
// add crontab
|
||||||
suffix := ""
|
suffix := ""
|
||||||
if index > 0 {
|
if numcron > 0 {
|
||||||
suffix = fmt.Sprintf("%d", index)
|
suffix = fmt.Sprintf("%d", index)
|
||||||
}
|
}
|
||||||
cronTab := helm.NewCrontab(
|
cronTab := helm.NewCrontab(
|
||||||
@@ -103,6 +103,7 @@ func buildCrontab(deployName string, deployment *helm.Deployment, s *types.Servi
|
|||||||
)
|
)
|
||||||
logger.Magenta(ICON_CRON, "Generating crontab", deployName, suffix)
|
logger.Magenta(ICON_CRON, "Generating crontab", deployName, suffix)
|
||||||
fileGeneratorChan <- cronTab
|
fileGeneratorChan <- cronTab
|
||||||
|
index++
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user