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

KUBE-644: use informers to watch CSRs #154

Merged
merged 7 commits into from
Nov 4, 2024
Merged

Conversation

Trojan295
Copy link
Contributor

No description provided.

@Trojan295 Trojan295 marked this pull request as ready for review October 30, 2024 13:46
@Trojan295 Trojan295 requested a review from a team as a code owner October 30, 2024 13:46
}
},
DeleteFunc: func(obj interface{}) {},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this method be ommited?

if cert.Approved() {
continue
},
UpdateFunc: func(oldObj, newObj interface{}) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need both add and updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, in theory reacting just on add should be enough. Will try to remove the update and see how it behaves.

go WatchCastAINodeCSRs(ctx, log, h.clientset, c)
go func() {
for {
if err := WatchCastAINodeCSRs(ctx, log, h.clientset, c); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why infinite loop here? If watch broke informer will handle reconnect. Did you think of other reasons?

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, the informers handle the reconnect logic, but the createInformer and informer.AddEventHandler might fail. In such case we would end up with a running cluster-controller, but without the auto approval working.

If the context is done, then no error is returned and this goroutine quits.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we initialize informer in main func and pass it here? Because if informer can't be created then there is something wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be possible, sounds like a good idea

@Trojan295 Trojan295 merged commit 94411f2 into main Nov 4, 2024
3 checks passed
@Trojan295 Trojan295 deleted the kube-644/csr-informer branch November 4, 2024 12:24
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.

3 participants