mirror of
https://github.com/alibaba/higress.git
synced 2026-06-09 04:37:31 +08:00
fix: skip unhealthy or disabled services form nacos and always marshal AllowTools field (#3220)
Co-authored-by: EricaLiu <30773688+Erica177@users.noreply.github.com>
This commit is contained in:
@@ -43,7 +43,7 @@ type McpServerRule struct {
|
|||||||
MatchRoute []string `json:"_match_route_,omitempty"`
|
MatchRoute []string `json:"_match_route_,omitempty"`
|
||||||
Server *ServerConfig `json:"server,omitempty"`
|
Server *ServerConfig `json:"server,omitempty"`
|
||||||
Tools []*McpTool `json:"tools,omitempty"`
|
Tools []*McpTool `json:"tools,omitempty"`
|
||||||
AllowTools []string `json:"allowTools,omitempty"`
|
AllowTools []string `json:"allowTools"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfig struct {
|
type ServerConfig struct {
|
||||||
|
|||||||
@@ -434,7 +434,7 @@ func (w *watcher) processToolConfig(dataId, data string, credentials map[string]
|
|||||||
rule.Server.SecuritySchemes = toolsDescription.SecuritySchemes
|
rule.Server.SecuritySchemes = toolsDescription.SecuritySchemes
|
||||||
}
|
}
|
||||||
|
|
||||||
var allowTools []string
|
allowTools := []string{}
|
||||||
for _, t := range toolsDescription.Tools {
|
for _, t := range toolsDescription.Tools {
|
||||||
convertTool := &provider.McpTool{Name: t.Name, Description: t.Description}
|
convertTool := &provider.McpTool{Name: t.Name, Description: t.Description}
|
||||||
|
|
||||||
@@ -813,6 +813,9 @@ func generateServiceEntry(host string, services *model.Service) *v1alpha3.Servic
|
|||||||
endpoints := make([]*v1alpha3.WorkloadEntry, 0)
|
endpoints := make([]*v1alpha3.WorkloadEntry, 0)
|
||||||
|
|
||||||
for _, service := range services.Hosts {
|
for _, service := range services.Hosts {
|
||||||
|
if !service.Healthy || !service.Enable {
|
||||||
|
continue
|
||||||
|
}
|
||||||
protocol := common.HTTP
|
protocol := common.HTTP
|
||||||
if service.Metadata != nil && service.Metadata["protocol"] != "" {
|
if service.Metadata != nil && service.Metadata["protocol"] != "" {
|
||||||
protocol = common.ParseProtocol(service.Metadata["protocol"])
|
protocol = common.ParseProtocol(service.Metadata["protocol"])
|
||||||
|
|||||||
Reference in New Issue
Block a user