Skip to content

Commit d74a9d4

Browse files
committed
explain what happens on update
1 parent c48ddd1 commit d74a9d4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/cluster/cluster.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ func compareResourcesAssumeFirstNotNil(a *v1.ResourceRequirements, b *v1.Resourc
497497

498498
func (c *Cluster) validateResources(spec *acidv1.PostgresSpec) error {
499499

500+
// setting limits too low can cause unnecessary evictions / OOM kills
500501
const (
501502
cpuMinLimit = "256m"
502503
memoryMinLimit = "256Mi"
@@ -554,10 +555,11 @@ func (c *Cluster) Update(oldSpec, newSpec *acidv1.Postgresql) error {
554555
}
555556
}()
556557

557-
// check if pod resources were edited below the enforced minimum limits
558558
if err := c.validateResources(&newSpec.Spec); err != nil {
559559
err = fmt.Errorf("insufficient resource limits specified: %v", err)
560560

561+
// cancel update only when (already too low) pod resources were edited
562+
// if cluster was successfully running before the update, continue but log a warning
561563
isCPULimitSmaller, err2 := util.IsSmallerQuantity(newSpec.Spec.Resources.ResourceLimits.CPU, oldSpec.Spec.Resources.ResourceLimits.CPU)
562564
isMemoryLimitSmaller, err3 := util.IsSmallerQuantity(newSpec.Spec.Resources.ResourceLimits.Memory, oldSpec.Spec.Resources.ResourceLimits.Memory)
563565

0 commit comments

Comments
 (0)