fix: replica set deployment for multi tenants (#8673)

Changes in IP underneath are dynamic in replica sets
with multiple tenants, so deploying in that fashion
will not work until we wait for atleast one participatory
server to be local.

This PR also ensures that multi-tenant zone expansion also
works in replica set k8s deployments.

Introduces a new ENV `KUBERNETES_REPLICA_SET` check to call
appropriate code paths.
This commit is contained in:
Harshavardhana
2019-12-19 13:45:56 -08:00
committed by kannappanr
parent 39face27cf
commit d140074773
7 changed files with 56 additions and 17 deletions

View File

@@ -162,8 +162,8 @@ func sortIPs(ipList []string) []string {
func getAPIEndpoints() (apiEndpoints []string) {
var ipList []string
if globalMinioHost == "" {
ipList = sortIPs(localIP4.ToSlice())
ipList = append(ipList, localIP6.ToSlice()...)
ipList = sortIPs(mustGetLocalIP4().ToSlice())
ipList = append(ipList, mustGetLocalIP6().ToSlice()...)
} else {
ipList = []string{globalMinioHost}
}
@@ -278,8 +278,8 @@ func isLocalHost(host string, port string, localPort string) (bool, error) {
}
// If intersection of two IP sets is not empty, then the host is localhost.
isLocalv4 := !localIP4.Intersection(hostIPs).IsEmpty()
isLocalv6 := !localIP6.Intersection(hostIPs).IsEmpty()
isLocalv4 := !mustGetLocalIP4().Intersection(hostIPs).IsEmpty()
isLocalv6 := !mustGetLocalIP6().Intersection(hostIPs).IsEmpty()
if port != "" {
return (isLocalv4 || isLocalv6) && (port == localPort), nil
}