check pg version (#2342)
Fixes #1678 Signed-off-by: Jan Jansen <jan.jansen@gdata.de>
This commit is contained in:
parent
5b310cea31
commit
7372e91956
|
|
@ -228,6 +228,16 @@ func getJobImage(cronJob *batchv1.CronJob) string {
|
|||
return cronJob.Spec.JobTemplate.Spec.Template.Spec.Containers[0].Image
|
||||
}
|
||||
|
||||
func getPgVersion(cronJob *batchv1.CronJob) string {
|
||||
envs := cronJob.Spec.JobTemplate.Spec.Template.Spec.Containers[0].Env
|
||||
for _, env := range envs {
|
||||
if env.Name == "PG_VERSION" {
|
||||
return env.Value
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// SameLogicalBackupJob compares Specs of logical backup cron jobs
|
||||
func SameLogicalBackupJob(cur, new *batchv1.CronJob) (match bool, reason string) {
|
||||
|
||||
|
|
@ -243,6 +253,13 @@ func SameLogicalBackupJob(cur, new *batchv1.CronJob) (match bool, reason string)
|
|||
newImage, curImage)
|
||||
}
|
||||
|
||||
newPgVersion := getPgVersion(new)
|
||||
curPgVersion := getPgVersion(cur)
|
||||
if newPgVersion != curPgVersion {
|
||||
return false, fmt.Sprintf("new job's env PG_VERSION %q does not match the current one %q",
|
||||
newPgVersion, curPgVersion)
|
||||
}
|
||||
|
||||
return true, ""
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue