From c667c5f4597d95fd898e8aea4f24e55c1de3793c Mon Sep 17 00:00:00 2001 From: gaoyan Date: Tue, 26 Nov 2024 18:36:04 +0800 Subject: [PATCH] [bug]fix k8s form ingresss bug (#3956) Co-authored-by: gaoyan1998 --- .../main/java/org/dinky/gateway/config/K8sConfig.java | 2 +- .../kubernetes/KubernetesApplicationGateway.java | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dinky-gateway/src/main/java/org/dinky/gateway/config/K8sConfig.java b/dinky-gateway/src/main/java/org/dinky/gateway/config/K8sConfig.java index a5dc20d995..b7cec39481 100644 --- a/dinky-gateway/src/main/java/org/dinky/gateway/config/K8sConfig.java +++ b/dinky-gateway/src/main/java/org/dinky/gateway/config/K8sConfig.java @@ -75,5 +75,5 @@ public class K8sConfig { dataType = "Map", example = "{\"key1\": \"value1\", \"key2\": \"value2\"}", notes = "Ingress configuration properties") - private Map ingressConfig = Maps.newHashMap(); + private Map ingressConfig = Maps.newHashMap(); } diff --git a/dinky-gateway/src/main/java/org/dinky/gateway/kubernetes/KubernetesApplicationGateway.java b/dinky-gateway/src/main/java/org/dinky/gateway/kubernetes/KubernetesApplicationGateway.java index 3132fea281..3aa802ae4a 100644 --- a/dinky-gateway/src/main/java/org/dinky/gateway/kubernetes/KubernetesApplicationGateway.java +++ b/dinky-gateway/src/main/java/org/dinky/gateway/kubernetes/KubernetesApplicationGateway.java @@ -363,11 +363,14 @@ private String getIngressUrl(Ingress ingress, String namespace, String clusterId * @return ingress domain */ private String checkUseIngress() { - Map ingressConfig = k8sConfig.getIngressConfig(); + Map ingressConfig = k8sConfig.getIngressConfig(); if (MapUtils.isNotEmpty(ingressConfig)) { - boolean ingressEnable = - Boolean.parseBoolean(ingressConfig.getOrDefault(DINKY_K8S_INGRESS_ENABLED_KEY, "false")); - String ingressDomain = ingressConfig.getOrDefault(DINKY_K8S_INGRESS_DOMAIN_KEY, StringUtils.EMPTY); + boolean ingressEnable = Boolean.parseBoolean(ingressConfig + .getOrDefault(DINKY_K8S_INGRESS_ENABLED_KEY, "false") + .toString()); + String ingressDomain = ingressConfig + .getOrDefault(DINKY_K8S_INGRESS_DOMAIN_KEY, StringUtils.EMPTY) + .toString(); if (ingressEnable && StringUtils.isNotEmpty(ingressDomain)) { return ingressDomain; }