Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mvbrock committed Jan 23, 2025
1 parent 9bb0b60 commit 10feddd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
18 changes: 9 additions & 9 deletions lib/srv/discovery/access_graph_aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ const (
batchSize = 500
// defaultPollInterval is the default interval between polling for access graph resources
defaultPollInterval = 15 * time.Minute
// Configure health check service to monitor access graph service and
// automatically reconnect if the connection is lost without
// relying on new events from the auth server to trigger a reconnect.
serviceConfig = `{
"loadBalancingPolicy": "round_robin",
"healthCheckConfig": {
"serviceName": ""
}
}`
)

// errNoAccessGraphFetchers is returned when there are no TAG fetchers.
Expand Down Expand Up @@ -257,15 +266,6 @@ func (s *Server) initializeAndWatchAccessGraph(ctx context.Context, reloadCh <-c
const (
// aws discovery semaphore lock.
semaphoreName = "access_graph_aws_sync"
// Configure health check service to monitor access graph service and
// automatically reconnect if the connection is lost without
// relying on new events from the auth server to trigger a reconnect.
serviceConfig = `{
"loadBalancingPolicy": "round_robin",
"healthCheckConfig": {
"serviceName": ""
}
}`
)

clusterFeatures := s.Config.ClusterFeatures()
Expand Down
11 changes: 3 additions & 8 deletions lib/srv/discovery/access_graph_azure.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Teleport
* Copyright (C) 2024 Gravitational, Inc.
* Copyright (C) 2025 Gravitational, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
Expand Down Expand Up @@ -66,6 +66,7 @@ func (s *Server) reconcileAccessGraphAzure(

// Fetch results concurrently
resultsC := make(chan fetcherResult, len(allFetchers))
// Restricts concurrently running fetchers to 3
tokens := make(chan struct{}, 3)
accountIds := map[string]struct{}{}
for _, fetcher := range allFetchers {
Expand Down Expand Up @@ -217,12 +218,6 @@ func (s *Server) initializeAndWatchAzureAccessGraph(ctx context.Context, reloadC
const (
semaphoreExpiration = time.Minute
semaphoreName = "access_graph_azure_sync"
serviceConfig = `{
"loadBalancingPolicy": "round_robin",
"healthCheckConfig": {
"serviceName": ""
}
}`
)
lease, err := services.AcquireSemaphoreLockWithRetry(
ctx,
Expand Down Expand Up @@ -255,7 +250,7 @@ func (s *Server) initializeAndWatchAzureAccessGraph(ctx context.Context, reloadC
defer func() {
lease.Stop()
if err := lease.Wait(); err != nil {
s.Log.WarnContext(ctx, "error cleaning up semaphore", "error", err)
s.Log.WarnContext(ctx, "error cleaning up semaphore", "error", err, "semaphore", semaphoreName)
}
}()

Expand Down
5 changes: 0 additions & 5 deletions lib/srv/discovery/fetchers/azuresync/azure-sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,6 @@ func (f *Fetcher) fetch(ctx context.Context, feats Features) (*Resources, error)
errsCh <- err
return nil
}
principals, err = expandMemberships(ctx, f.graphClient, principals)
if err != nil {
errsCh <- err
return nil
}
result.Principals, err = expandMemberships(ctx, f.graphClient, principals)
if err != nil {
errsCh <- err
Expand Down

0 comments on commit 10feddd

Please sign in to comment.