From afaeddb8873aeec6a44e3c8ed1ae576745a4957c Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Tue, 11 Jul 2023 21:31:32 +0400 Subject: [PATCH] fix(edge/groups): skip count untrusted endpoints [EE-5672] (#9176) --- api/http/handler/edgegroups/associated_endpoints.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/http/handler/edgegroups/associated_endpoints.go b/api/http/handler/edgegroups/associated_endpoints.go index e103ada1f..6b5ae3d87 100644 --- a/api/http/handler/edgegroups/associated_endpoints.go +++ b/api/http/handler/edgegroups/associated_endpoints.go @@ -3,6 +3,7 @@ package edgegroups import ( portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/dataservices" + "github.com/portainer/portainer/api/internal/endpointutils" ) type endpointSetType map[portainer.EndpointID]bool @@ -40,7 +41,7 @@ func GetEndpointsByTags(tx dataservices.DataStoreTx, tagIDs []portainer.TagID, p results := []portainer.EndpointID{} for _, endpoint := range endpoints { - if _, ok := endpointSet[endpoint.ID]; ok && (endpoint.Type == portainer.EdgeAgentOnDockerEnvironment || endpoint.Type == portainer.EdgeAgentOnKubernetesEnvironment) { + if _, ok := endpointSet[endpoint.ID]; ok && endpointutils.IsEdgeEndpoint(&endpoint) && endpoint.UserTrusted { results = append(results, endpoint.ID) } }