mirror of
https://github.com/alibaba/higress.git
synced 2026-05-27 06:07:27 +08:00
fix: when there is a non-ip IPAddr in Eureka, delete it to avoid a failure in EDS (#1322)
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -125,13 +126,25 @@ func (c *eurekaHttpClient) getApplications(path string) (*Applications, error) {
|
|||||||
|
|
||||||
apps := map[string]*fargo.Application{}
|
apps := map[string]*fargo.Application{}
|
||||||
for idx := range rj.Response.Applications {
|
for idx := range rj.Response.Applications {
|
||||||
|
ignore := false
|
||||||
app := rj.Response.Applications[idx]
|
app := rj.Response.Applications[idx]
|
||||||
|
for _, instance := range app.Instances {
|
||||||
|
if ip := net.ParseIP(instance.IPAddr); ip == nil {
|
||||||
|
log.Warnf("the Non-IP IPAddr %s is not allowed, please check your app: %s", instance.IPAddr, app.Name)
|
||||||
|
ignore = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ignore {
|
||||||
|
continue
|
||||||
|
}
|
||||||
apps[app.Name] = app
|
apps[app.Name] = app
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, app := range apps {
|
for name, app := range apps {
|
||||||
log.Debugf("Parsing metadata for app %v", name)
|
log.Debugf("Parsing metadata for app %v", name)
|
||||||
if err := app.ParseAllMetadata(); err != nil {
|
if err := app.ParseAllMetadata(); err != nil {
|
||||||
|
log.Errorf("Failed to parse metadata for app %v: %v", name, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user