-
Notifications
You must be signed in to change notification settings - Fork 89
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
base: main
Are you sure you want to change the base?
Targetconfig crd #716
Conversation
aerosouund
commented
Jan 24, 2025
•
edited
Loading
edited
- Crd definition
- Crd storage
- Informer initialization
- Testing
- Makefile cleanup
Signed-off-by: aerosouund <[email protected]>
Signed-off-by: aerosouund <[email protected]>
Signed-off-by: aerosouund <[email protected]>
pkg/config/resolver.go
Outdated
@@ -203,6 +206,27 @@ func (r *Resolver) CustomIDGenerators() map[string]result.IDGenerator { | |||
return generators | |||
} | |||
|
|||
func (r *Resolver) AddTargetConfigEventHandlers() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should move this into a controller/client struct. The resolver is only to manage dependencies and not this kind of business logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, this is me still testing out stuff. The Informer initialization task i have in the description is to mark this exact problem
@@ -40,6 +40,9 @@ func (k *k8sPolicyReportClient) Stop() { | |||
func (k *k8sPolicyReportClient) Sync(stopper chan struct{}) error { | |||
factory := metadatainformer.NewSharedInformerFactory(k.metaClient, 15*time.Minute) | |||
|
|||
// tcInformer := tcinformer.NewSharedInformerFactory(tcv1alpha1.New(&rest.RESTClient{}), time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you wanted to try things out, don't forget to clean everything up again.
mx *sync.Mutex | ||
clients []Client | ||
targets map[string]*Target | ||
crdTargets map[string]*Target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason to separate crd targets from config targets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to first write out all the flows for storing crd targets separate from the existing config and once everything is figured out merge them. but no, they both can be stored in the same map as i see the map key is just a random uuid
Signed-off-by: aerosouund <[email protected]>
Signed-off-by: aerosouund <[email protected]>
the |
Signed-off-by: aerosouund <[email protected]>
Signed-off-by: Ammar Yasser <[email protected]>