diff --git a/packages/shulker-proxy-agent/src/common/kotlin/io/shulkermc/proxyagent/adapters/kubernetes/ImplKubernetesGatewayAdapter.kt b/packages/shulker-proxy-agent/src/common/kotlin/io/shulkermc/proxyagent/adapters/kubernetes/ImplKubernetesGatewayAdapter.kt index 097d1bbf..9c05cc4e 100644 --- a/packages/shulker-proxy-agent/src/common/kotlin/io/shulkermc/proxyagent/adapters/kubernetes/ImplKubernetesGatewayAdapter.kt +++ b/packages/shulker-proxy-agent/src/common/kotlin/io/shulkermc/proxyagent/adapters/kubernetes/ImplKubernetesGatewayAdapter.kt @@ -108,7 +108,8 @@ class ImplKubernetesGatewayAdapter(proxyNamespace: String, proxyName: String) : private fun getExternalAddressFromService(service: Service): Optional { return if (service.spec.type == "LoadBalancer") { Optional.ofNullable(service.status.loadBalancer?.ingress?.firstOrNull()) - .map { ingress -> addressFromHostString(ingress.ip) } + .flatMap { ingress -> Optional.of(ingress.ip) } + .map { ip -> addressFromHostString(ip) } } else { Optional.empty() }