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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Conversation

aerosouund
Copy link
Contributor

@aerosouund aerosouund commented Jan 24, 2025

  • Crd definition
  • Crd storage
  • Informer initialization
  • Testing
  • Makefile cleanup

@@ -203,6 +206,27 @@ func (r *Resolver) CustomIDGenerators() map[string]result.IDGenerator {
return generators
}

func (r *Resolver) AddTargetConfigEventHandlers() {
Copy link
Member

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

Copy link
Contributor Author

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)
Copy link
Member

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
Copy link
Member

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?

Copy link
Contributor Author

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

@fjogeleit
Copy link
Member

the test make target is missing. Please ensure to add it again and that all tests passing

@fjogeleit fjogeleit linked an issue Jan 26, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Allow Reconfiguration when config file changes
2 participants