Fix: fail to get the endpoints via the velaql (#4056)

Signed-off-by: yangsoon <songyang.song@alibaba-inc.com>

Co-authored-by: yangsoon <songyang.song@alibaba-inc.com>
This commit is contained in:
yangs 2022-05-30 15:48:28 +08:00 committed by GitHub
parent 8fb38672f5
commit c8eb0b4dbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -110,6 +110,9 @@ func (h *provider) ListResourcesInApp(ctx wfContext.Context, v *value.Value, act
if err != nil {
return v.FillObject(err.Error(), "err")
}
if appResList == nil {
appResList = make([]Resource, 0)
}
return fillQueryResult(v, appResList, "list")
}
@ -133,6 +136,9 @@ func (h *provider) ListAppliedResources(ctx wfContext.Context, v *value.Value, a
if err != nil {
return v.FillObject(err.Error(), "err")
}
if appResList == nil {
appResList = make([]*querytypes.AppliedResource, 0)
}
return fillQueryResult(v, appResList, "list")
}
@ -293,7 +299,7 @@ func (h *provider) GeneratorServiceEndpoints(wfctx wfContext.Context, v *value.V
if err != nil {
return fmt.Errorf("query app failure %w", err)
}
var serviceEndpoints []querytypes.ServiceEndpoint
serviceEndpoints := make([]querytypes.ServiceEndpoint, 0)
var clusterGatewayNodeIP = make(map[string]string)
collector := NewAppCollector(h.cli, opt)
resources, err := collector.ListApplicationResources(app)