fix affinity check
@@ -138,15 +138,17 @@ func (Backup) SetStoragePVC(job *batchv1.JobSpec, cr *api.PerconaXtraDBCluster,
pvc,
}
- if len(cr.Spec.Backup.Resources.String()) > 0 {
+ if cr.Spec.Backup != nil {
+ if cr.Spec.Backup.Resources != nil {
job.Template.Spec.Containers[0].Resources = *cr.Spec.Backup.Resources
}
+ if cr.Spec.Backup.Affinity != nil {
+ job.Template.Spec.Affinity = cr.Spec.Backup.Affinity
+ }
+ }
if len(cr.Spec.Backup.Tolerations) > 0 {
job.Template.Spec.Tolerations = cr.Spec.Backup.Tolerations
}
- if len(cr.Spec.Backup.Affinity.String()) > 0 {
- job.Template.Spec.Affinity = cr.Spec.Backup.Affinity
- }
if len(cr.Spec.Backup.Labels) > 0 {
job.Template.Labels = cr.Spec.Backup.Labels
}
