mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-19 19:37:25 +02:00
handle case when Patroni returns that lag is unknown (#1724)
* handle case when Patroni returns that lag is unknown * remove some prints from e2e test
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"math"
|
||||
"math/big"
|
||||
"math/rand"
|
||||
"reflect"
|
||||
@@ -19,6 +20,7 @@ import (
|
||||
"github.com/motomux/pretty"
|
||||
resource "k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
"github.com/zalando/postgres-operator/pkg/spec"
|
||||
"golang.org/x/crypto/pbkdf2"
|
||||
@@ -322,6 +324,20 @@ func testNil(values ...*int32) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// Convert int to IntOrString type
|
||||
func ToIntStr(val int) *intstr.IntOrString {
|
||||
b := intstr.FromInt(val)
|
||||
return &b
|
||||
}
|
||||
|
||||
// Get int from IntOrString and return max int if string
|
||||
func IntFromIntStr(intOrStr intstr.IntOrString) int {
|
||||
if intOrStr.Type == 1 {
|
||||
return math.MaxInt
|
||||
}
|
||||
return intOrStr.IntValue()
|
||||
}
|
||||
|
||||
// MaxInt32 : Return maximum of two integers provided via pointers. If one value
|
||||
// is not defined, return the other one. If both are not defined, result is also
|
||||
// undefined, caller needs to check for that.
|
||||
|
||||
Reference in New Issue
Block a user