mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-07 01:41:21 +02:00
1) Handle per-cluster sidecars 2) Add this option to operator CRD 3) ad parsing for proepr comparison
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user