1) Handle per-cluster sidecars 2) Add this option to operator CRD 3) ad parsing for proepr comparison

This commit is contained in:
Sergey Dudoladov
2018-11-08 18:41:23 +01:00
parent 047368b612
commit c6df079d2b
5 changed files with 33 additions and 4 deletions
+17
View File
@@ -9,6 +9,7 @@ import (
"time"
"github.com/motomux/pretty"
resource "k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/zalando-incubator/postgres-operator/pkg/spec"
@@ -127,3 +128,19 @@ func Coalesce(val, defaultVal string) string {
}
return val
}
// RequestIsSmallerThanLimit
func RequestIsSmallerThanLimit(requestStr, limitStr string) bool {
request, err := resource.ParseQuantity(requestStr)
if err != nil {
}
limit, err2 := resource.ParseQuantity(requestStr)
if err2 != nil {
}
return request.Cmp(limit) == -1
}