Skip to content

通过higress可以请求到nacos上不健康的实例 || You can request unhealthy instances on nacos through higress #3737

@AMagnolia

Description

@AMagnolia

在使用最新2.2.1版本的all in one higress时发现,在nacos上没有下线,只是健康状态为false的实例仍然可以通过higress请求到。

查看了代码,似乎只有mcpserver的部分对不健康实例进行了过滤:
func generateServiceEntry(host string, services *model.Service) *v1alpha3.ServiceEntry {
if services == nil || len(services.Hosts) == 0 {
return nil
}
portList := make([]*v1alpha3.ServicePort, 0)
endpoints := make([]*v1alpha3.WorkloadEntry, 0)

for _, service := range services.Hosts {
	if !service.Healthy || !service.Enable {
		continue
	}

... ...
}
而普通的restful服务似乎没有这段逻辑,麻烦看一下是否有问题。


When using the latest 2.2.1 version of all in one higress, I found that there was no offline on nacos, but instances with a false health status could still be requested through higress.

After looking at the code, it seems that only the mcpserver part filters unhealthy instances:
func generateServiceEntry(host string, services *model.Service) *v1alpha3.ServiceEntry {
if services == nil || len(services.Hosts) == 0 {
return nil
}
portList := make([]*v1alpha3.ServicePort, 0)
endpoints := make([]*v1alpha3.WorkloadEntry, 0)

for _, service := range services.Hosts {
	if !service.Healthy || !service.Enable {
		continue
	}

... ...
}
The ordinary restful service does not seem to have this logic. Please check if there is a problem.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions