From 2267b66d0c171747d6db44a45b01c5d704b88870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Levilain?= Date: Mon, 18 Nov 2024 10:31:08 +0100 Subject: [PATCH] fix(shulker-proxy-agent): ingress IP can be null --- .../adapters/kubernetes/ImplKubernetesGatewayAdapter.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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() }