Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Log once for excluded resources
Browse files Browse the repository at this point in the history
Logging all excluded resources may be quite noisy. Instead, collect
the IDs of excluded resources and log once (or no times, if there
aren't any).
  • Loading branch information
squaremo committed May 13, 2019
1 parent bde3ad7 commit a9c6fc1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cluster/kubernetes/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ func (c *Cluster) Sync(syncSet cluster.SyncSet) error {

cs := makeChangeSet()
var errs cluster.SyncError
var excluded []string
for _, res := range syncSet.Resources {
resID := res.ResourceID()
id := resID.String()
if !c.IsAllowedResource(resID) {
logger.Log("warning", "not applying resource; excluded by namespace constraints", "resource", id, "source", res.Source())
excluded = append(excluded, id)
continue
}
// make a record of the checksum, whether we stage it to
Expand Down Expand Up @@ -94,6 +95,10 @@ func (c *Cluster) Sync(syncSet cluster.SyncSet) error {
}
}

if len(excluded) > 0 {
logger.Log("warning", "not applying resources; excluded by namespace constraints", "resources", strings.Join(excluded, ","))
}

c.mu.Lock()
defer c.mu.Unlock()
c.muSyncErrors.RLock()
Expand Down

0 comments on commit a9c6fc1

Please sign in to comment.