From 24abbddf14904d6599872b7beb42f1fc039bbc7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Tue, 4 Jun 2019 14:59:22 +0200 Subject: [PATCH] ceph: fix pod memory check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes the second test case where limit and request are either identical or different but still we use limit as a value. Signed-off-by: Sébastien Han --- pkg/operator/ceph/spec/spec.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/operator/ceph/spec/spec.go b/pkg/operator/ceph/spec/spec.go index ce930e302..97a78c4ae 100644 --- a/pkg/operator/ceph/spec/spec.go +++ b/pkg/operator/ceph/spec/spec.go @@ -173,12 +173,12 @@ func CheckPodMemory(resources v1.ResourceRequirements, cephPodMinimumMemory uint // This means LIMIT < REQUEST // Kubernetes will refuse to schedule that pod however it's still valuable to indicate that user's input was incorrect - if uint64(podMemoryLimit.Value()) < display.MbTob(cephPodMinimumMemory) { + if uint64(podMemoryLimit.Value()) < uint64(podMemoryRequest.Value()) { extraErrorLine := `\n - User has specified a pod memory limit below the pod memory request in the cluster CRD.\n + User has specified a pod memory limit %dmb below the pod memory request %dmb in the cluster CR.\n Rook will create pods that are expected to fail to serve as a more apparent error indicator to the user.` - return fmt.Errorf(errorMessage+extraErrorLine, display.BToMb(uint64(podMemoryLimit.Value())), cephPodMinimumMemory) + return fmt.Errorf(extraErrorLine, display.BToMb(uint64(podMemoryLimit.Value())), display.BToMb(uint64(podMemoryRequest.Value()))) } return nil