From 6ac95e40a4e67b2db16d51c756cd01505de240b5 Mon Sep 17 00:00:00 2001 From: Daniel Valdivia Date: Tue, 23 Feb 2021 12:49:46 -0800 Subject: [PATCH] Get Tenants endpoints check hostname (#609) --- restapi/admin_tenants.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/restapi/admin_tenants.go b/restapi/admin_tenants.go index dd818f9f6..2b06ee125 100644 --- a/restapi/admin_tenants.go +++ b/restapi/admin_tenants.go @@ -404,10 +404,22 @@ func getTenantInfoResponse(session *models.Principal, params admin_api.TenantInf var minioEndpoint string var consoleEndpoint string if minSvc != nil && len(minSvc.Status.LoadBalancer.Ingress) > 0 { - minioEndpoint = fmt.Sprintf("%s://%s", schema, minSvc.Status.LoadBalancer.Ingress[0].IP) + if minSvc.Status.LoadBalancer.Ingress[0].IP != "" { + minioEndpoint = fmt.Sprintf("%s://%s", schema, minSvc.Status.LoadBalancer.Ingress[0].IP) + } + + if minSvc.Status.LoadBalancer.Ingress[0].Hostname != "" { + minioEndpoint = fmt.Sprintf("%s://%s", schema, minSvc.Status.LoadBalancer.Ingress[0].Hostname) + } + } if conSvc != nil && len(conSvc.Status.LoadBalancer.Ingress) > 0 { - consoleEndpoint = fmt.Sprintf("%s://%s%s", consoleSchema, conSvc.Status.LoadBalancer.Ingress[0].IP, consolePort) + if conSvc.Status.LoadBalancer.Ingress[0].IP != "" { + consoleEndpoint = fmt.Sprintf("%s://%s%s", consoleSchema, conSvc.Status.LoadBalancer.Ingress[0].IP, consolePort) + } + if conSvc.Status.LoadBalancer.Ingress[0].Hostname != "" { + consoleEndpoint = fmt.Sprintf("%s://%s%s", consoleSchema, conSvc.Status.LoadBalancer.Ingress[0].Hostname, consolePort) + } } if minioEndpoint != "" || consoleEndpoint != "" { info.Endpoints = &models.TenantEndpoints{