in fleet-argocd-plugin/fleetclient/fleetclient.go [116:138]
func (c *FleetSync) PluginResults(ctx context.Context, scopeID string) ([]Result, error) {
if c.MembershipTenancyMapCache == nil || c.ScopeTenancyMapCache == nil {
return nil, fmt.Errorf("fleet is empty")
}
var results []Result
// Scope mode. Only include memberships in the specified scope.
if scopeID != "" {
if c.ScopeTenancyMapCache[scopeID] == nil {
return nil, fmt.Errorf("unknown scope ID to the Fleet plugin: %s", scopeID)
}
for _, name := range c.ScopeTenancyMapCache[scopeID] {
results = append(results, resultFromMembership(name, c.ProjectNum))
}
return results, nil
}
// Include all member clusters in the Fleet.
for name := range c.MembershipTenancyMapCache {
results = append(results, resultFromMembership(name, c.ProjectNum))
}
return results, nil
}