Address feedback

Rename application for connection pool (ideally in the future make it
configurable). Take into accounts nils for MaxInt32
This commit is contained in:
Dmitrii Dolgov 2020-03-17 11:33:56 +01:00
parent cf6541b8cf
commit 1c7065e4ce
2 changed files with 16 additions and 1 deletions

View File

@ -424,7 +424,7 @@ func (c *Cluster) connPoolLabelsSelector() *metav1.LabelSelector {
extraLabels := labels.Set(map[string]string{
"connection-pool": c.connPoolName(),
"application": "connection-pool",
"application": "db-connection-pool",
})
connPoolLabels = labels.Merge(connPoolLabels, c.labelsSet(false))

View File

@ -149,7 +149,22 @@ func CoalesceInt32(val, defaultVal *int32) *int32 {
return val
}
// 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.
func MaxInt32(a, b *int32) *int32 {
if a == nil && b == nil {
return nil
}
if a == nil {
return b
}
if b == nil {
return a
}
if *a > *b {
return a
}