From a7c62b7fdd5e978487989a767cb59ba7177c0c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B7=AE=E5=8F=B3?= Date: Fri, 17 Mar 2023 16:53:12 +0800 Subject: [PATCH] Fix cidr multi format. (#2125) Signed-off-by: huaiyou --- pkg/clusterfile/decoder.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/clusterfile/decoder.go b/pkg/clusterfile/decoder.go index ae9dea61bc9..4fa11ea3397 100644 --- a/pkg/clusterfile/decoder.go +++ b/pkg/clusterfile/decoder.go @@ -231,7 +231,8 @@ func checkAndFillCluster(cluster *v2.Cluster) error { clusterEnvMap := strUtil.ConvertStringSliceToMap(cluster.Spec.Env) if svcCIDR, ok := clusterEnvMap[common.EnvSvcCIDR]; ok && svcCIDR != nil { - _, cidr, err := net.ParseCIDR(svcCIDR.(string)) + cidrs := strings.Split(svcCIDR.(string), ",") + _, cidr, err := net.ParseCIDR(cidrs[0]) if err != nil { return fmt.Errorf("failed to parse svc CIDR: %v", err) }