Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Targetconfig crd #716

Merged
merged 53 commits into from
Mar 9, 2025
Merged
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
e407f8c
feat: create targetconfig clientset and crd struct
aerosouund Jan 23, 2025
d73cd55
modify destination package
aerosouund Jan 23, 2025
bfcb8e1
wip target config
aerosouund Jan 24, 2025
0e854e8
create target config client and set it as a dependency for the resolver
aerosouund Jan 24, 2025
ffa0339
some fixes
aerosouund Jan 25, 2025
4387ff7
delete unused client package and cleanup makefile
aerosouund Jan 26, 2025
d387055
Merge branch 'main' into targetconfig-crd
aerosouund Jan 26, 2025
d58f87c
change targetconfig to a config generic
aerosouund Jan 28, 2025
135da16
initialize map
aerosouund Jan 28, 2025
e53777e
add other config types
aerosouund Jan 28, 2025
1053683
use a channel to communicate target changes
aerosouund Jan 29, 2025
a9f2583
use cache in target
aerosouund Feb 1, 2025
56da453
change test signatures to match codebase changes
aerosouund Feb 3, 2025
239435a
change webook field calles webhook to host
aerosouund Feb 3, 2025
e4987cb
change webook field calles webhook to host
aerosouund Feb 3, 2025
34997d0
tc event and restart in run.go
aerosouund Feb 3, 2025
afde70e
remove comment
aerosouund Feb 3, 2025
b4b51b3
update makefile comment
aerosouund Feb 3, 2025
befa65c
gofumpy
aerosouund Feb 3, 2025
edba4fa
gofumpt
aerosouund Feb 3, 2025
99fe42c
only restart the policy report informer once all tcs has synced
aerosouund Feb 4, 2025
547f845
remove todo
aerosouund Feb 4, 2025
89abe77
list using a clientset
aerosouund Feb 4, 2025
9f9a2c1
crd modifications
aerosouund Feb 4, 2025
866361a
remove redundant comment
aerosouund Feb 6, 2025
2136db1
disable informer resync
aerosouund Feb 6, 2025
3105829
make fmt
aerosouund Feb 6, 2025
7bd9dda
fix all failing tests and remove tests that no longer make sense
aerosouund Feb 6, 2025
fb2db0e
remove references to thew restart channel
aerosouund Feb 8, 2025
4060545
in cluster config
aerosouund Feb 9, 2025
6dddc11
update crd
aerosouund Feb 9, 2025
3b1db6d
change groupname and add missing slack target
aerosouund Feb 10, 2025
30f1d7a
run fmt
aerosouund Feb 10, 2025
11a2308
update group name
aerosouund Feb 10, 2025
02c64e1
fix result sending exiting if one of the results is in the cache
aerosouund Feb 10, 2025
c5ef882
fix result sending for batch send clients
aerosouund Feb 10, 2025
c397c11
clone cache to clients at client start time
aerosouund Feb 12, 2025
c264a8d
fmt
aerosouund Feb 12, 2025
24e7e34
remove filesystem kubeconfig read
aerosouund Feb 16, 2025
b4617df
fix caching logic at send
aerosouund Feb 16, 2025
5cedec8
add tcfg to rbac
aerosouund Feb 16, 2025
edc6a28
return filters
aerosouund Feb 16, 2025
c74f205
dont use an array in validation
aerosouund Feb 17, 2025
21fcc53
change send result tests to account for new sending logic
aerosouund Feb 20, 2025
ce57e0b
change send result tests to account for new sending logic
aerosouund Feb 20, 2025
beb8bd2
add ms teams
aerosouund Feb 21, 2025
3771ead
drop the skip existing polr informer restart
aerosouund Feb 24, 2025
e68947b
strip the changes to new result
aerosouund Mar 1, 2025
b183d85
drop the client cache and restart signal
aerosouund Mar 2, 2025
22fb0d4
remove timestamp and base client fields
aerosouund Mar 3, 2025
6918bd6
remove methods from the test client
aerosouund Mar 3, 2025
609696d
Merge branch 'main' into targetconfig-crd
aerosouund Mar 3, 2025
502ca4e
fix go mod
aerosouund Mar 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions pkg/listener/send_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package listener

import (
"sync"
"time"

corev1 "k8s.io/api/core/v1"

Expand All @@ -28,20 +27,23 @@ func NewSendResultListener(targets *target.Collection) report.PolicyReportResult
result.Resources = []corev1.ObjectReference{*re.GetScope()}
}

resultsToSend := []v1alpha2.PolicyReportResult{}
existing := target.Cache().GetResults(re.GetID())
for _, r := range re.GetResults() {
preExisted := time.Unix(r.Timestamp.Seconds, int64(r.Timestamp.Nanos)).Local().Before(target.CreationTimestamp())
if (preExisted && target.SkipExistingOnStartup()) || !target.Validate(re, result) {
continue
}

for _, r := range re.GetResults() {
if helper.Contains(r.GetID(), existing) {
continue
}
target.Send(result)

resultsToSend = append(resultsToSend, r)
}

target.Cache().AddReport(re)
if len(resultsToSend) > 0 {
for _, r := range resultsToSend {
target.Send(r)
}
}
}(t, rep, r)
}

Expand Down
Loading