ceph: fix pod memory check

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 <seb@redhat.com>
This commit is contained in:
Sébastien Han committed 2019-06-07 15:06:16 +02:00
1 parent fb22976750
commit 24abbddf14
1 file changed
+3 -3
+3 -3
View File
@@ -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