@@ -17,6 +17,7 @@ import (
17
17
batchv1 "k8s.io/api/batch/v1"
18
18
corev1 "k8s.io/api/core/v1"
19
19
k8serrors "k8s.io/apimachinery/pkg/api/errors"
20
+ "k8s.io/apimachinery/pkg/api/resource"
20
21
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21
22
"k8s.io/apimachinery/pkg/labels"
22
23
"k8s.io/apimachinery/pkg/types"
@@ -334,9 +335,8 @@ func (r *PGClusterReconciler) reconcilePatroniVersionCheck(ctx context.Context,
334
335
cr .Annotations = make (map [string ]string )
335
336
}
336
337
337
- // This annotation is used for unit-tests only. Allows to skip the patroni version check
338
- if _ , ok := cr .Annotations [pNaming .InternalAnnotationDisablePatroniVersionCheck ]; ok {
339
- cr .Annotations [pNaming .AnnotationPatroniVersion ] = cr .Status .PatroniVersion
338
+ if patroniVersion , ok := cr .Annotations [pNaming .AnnotationCustomPatroniVersion ]; ok {
339
+ cr .Annotations [pNaming .AnnotationPatroniVersion ] = patroniVersion
340
340
return nil
341
341
}
342
342
@@ -371,7 +371,7 @@ func (r *PGClusterReconciler) reconcilePatroniVersionCheck(ctx context.Context,
371
371
372
372
// If the imageIDs slice contains the imageID from the status, we skip checking the Patroni version.
373
373
// This ensures that the Patroni version is only checked after all pods have been updated.
374
- if slices .Contains (imageIDs , cr .Status .Postgres .ImageID ) && cr .Status .PatroniVersion != "" {
374
+ if ( len ( imageIDs ) == 0 || slices .Contains (imageIDs , cr .Status .Postgres .ImageID ) ) && cr .Status .PatroniVersion != "" {
375
375
cr .Annotations [pNaming .AnnotationPatroniVersion ] = cr .Status .PatroniVersion
376
376
return nil
377
377
}
@@ -404,13 +404,23 @@ func (r *PGClusterReconciler) reconcilePatroniVersionCheck(ctx context.Context,
404
404
"bash" ,
405
405
},
406
406
Args : []string {
407
- "-c" , "sleep 300 " ,
407
+ "-c" , "sleep 60 " ,
408
408
},
409
409
Resources : cr .Spec .InstanceSets [0 ].Resources ,
410
410
},
411
411
},
412
412
SecurityContext : cr .Spec .InstanceSets [0 ].SecurityContext ,
413
413
TerminationGracePeriodSeconds : ptr .To (int64 (5 )),
414
+ Resources : & corev1.ResourceRequirements {
415
+ Limits : corev1.ResourceList {
416
+ corev1 .ResourceCPU : resource .MustParse ("100m" ),
417
+ corev1 .ResourceMemory : resource .MustParse ("64Mi" ),
418
+ },
419
+ Requests : corev1.ResourceList {
420
+ corev1 .ResourceCPU : resource .MustParse ("50m" ),
421
+ corev1 .ResourceMemory : resource .MustParse ("32Mi" ),
422
+ },
423
+ },
414
424
},
415
425
}
416
426
0 commit comments