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

feat: make Kubernetes informers cancellable #9411

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

feloy
Copy link
Contributor

@feloy feloy commented Oct 16, 2024

Signed-off-by: Philippe Martin [email protected]

What does this PR do?

For #6114 , we will need to restart the informers every time we change the current context, to change their backoff configuration.

Working on this, I realized that the informers were not correctly stopped when not necessary anymore.

This PR makes the informers cancellable, so we can make them stop their infinite loop of retries.

What issues does this PR fix or reference?

Part of #6114

How to test this PR?

  • Tests are covering the bug fix or the new feature

Signed-off-by: Philippe Martin <[email protected]>
Signed-off-by: Philippe Martin <[email protected]>
@feloy feloy marked this pull request as ready for review October 16, 2024 16:13
@feloy feloy requested review from benoitf and a team as code owners October 16, 2024 16:13
@feloy feloy requested review from cdrage, deboer-tim and axel7083 and removed request for a team October 16, 2024 16:13
@@ -364,7 +366,7 @@ export class ContextsManager {
};
}

private createPodInformer(kc: KubeConfig, namespace: string, context: KubeContext): Informer<V1Pod> {
private createPodInformer(kc: KubeConfig, namespace: string, context: KubeContext): CancellableInformer {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we losing the generic type, is it important ?

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'll check again, does it does not seem to be useful

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 don't think so:

The V1Pod is necessary when calling this.createInformer<V1Pod>, to have he onAdd and other options have the matching type. But the result of createPodInformer is stored in an Informer<KubernetesObject>; the specific type is never used on this side.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okey thanks

Signed-off-by: Philippe Martin <[email protected]>
@feloy feloy requested a review from axel7083 October 17, 2024 06:09
@benoitf benoitf changed the title Make Kubernetes informers cancellable feat: make Kubernetes informers cancellable Oct 17, 2024
Copy link
Contributor

@axel7083 axel7083 left a comment

Choose a reason for hiding this comment

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

LGTM Codewise

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.

2 participants