@@ -17,6 +17,7 @@ import (
1717 batchv1 "k8s.io/api/batch/v1"
1818 corev1 "k8s.io/api/core/v1"
1919 k8serrors "k8s.io/apimachinery/pkg/api/errors"
20+ "k8s.io/apimachinery/pkg/api/resource"
2021 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122 "k8s.io/apimachinery/pkg/labels"
2223 "k8s.io/apimachinery/pkg/types"
@@ -334,9 +335,8 @@ func (r *PGClusterReconciler) reconcilePatroniVersionCheck(ctx context.Context,
334335 cr .Annotations = make (map [string ]string )
335336 }
336337
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
340340 return nil
341341 }
342342
@@ -371,7 +371,7 @@ func (r *PGClusterReconciler) reconcilePatroniVersionCheck(ctx context.Context,
371371
372372 // If the imageIDs slice contains the imageID from the status, we skip checking the Patroni version.
373373 // 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 != "" {
375375 cr .Annotations [pNaming .AnnotationPatroniVersion ] = cr .Status .PatroniVersion
376376 return nil
377377 }
@@ -404,13 +404,23 @@ func (r *PGClusterReconciler) reconcilePatroniVersionCheck(ctx context.Context,
404404 "bash" ,
405405 },
406406 Args : []string {
407- "-c" , "sleep 300 " ,
407+ "-c" , "sleep 60 " ,
408408 },
409409 Resources : cr .Spec .InstanceSets [0 ].Resources ,
410410 },
411411 },
412412 SecurityContext : cr .Spec .InstanceSets [0 ].SecurityContext ,
413413 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+ },
414424 },
415425 }
416426
0 commit comments