-
Notifications
You must be signed in to change notification settings - Fork 438
feat: check connectivity with health check #10076
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: check connectivity with health check #10076
Conversation
Signed-off-by: Philippe Martin <[email protected]>
0b546d1
to
0eabf41
Compare
packages/main/src/plugin/kubernetes/contexts-manager-experimental.ts
Outdated
Show resolved
Hide resolved
packages/main/src/plugin/kubernetes/contexts-manager-experimental.ts
Outdated
Show resolved
Hide resolved
packages/main/src/plugin/kubernetes/contexts-manager-experimental.ts
Outdated
Show resolved
Hide resolved
packages/main/src/plugin/kubernetes/contexts-manager-experimental.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Philippe Martin <[email protected]>
Signed-off-by: Philippe Martin <[email protected]>
Signed-off-by: Philippe Martin <[email protected]>
Signed-off-by: Philippe Martin <[email protected]>
Signed-off-by: Philippe Martin <[email protected]>
packages/main/src/plugin/kubernetes/contexts-connectivity-registry.ts
Outdated
Show resolved
Hide resolved
packages/main/src/plugin/kubernetes/contexts-connectivity-registry.ts
Outdated
Show resolved
Hide resolved
packages/main/src/plugin/kubernetes/contexts-manager-experimental.ts
Outdated
Show resolved
Hide resolved
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.
IMHO I don't see the need of the registry, and the event in the health checker as it can just keep the value
ExperimentalChecker:
- map of healthzChecker
for each checker there is inside the value if it's reachable or not
many disposables can be removed, and half of the code
I would like to validate that this pattern is valid with the idea that we want to send to the frontend all these states With this new pattern, we would also need some signal from the checkers to know when the state of a checker changes and to collect all the data from the checkers to send it. |
Signed-off-by: Philippe Martin <[email protected]>
I agree that the IMHO, as the checkers have a short life (they are killed as soon as the kubeconfig is modified again), it seems not reasonable to keep the state of the check inside them, as they will be deleted / recreated every time the Here is a new proposal by simplfying the The registry is very simple, but I expect to add code to send the data to the frontend in this registry. @benoitf WDYT? |
I think my issue is why having a separate registry. State should be closer to the object being checked.
On my side I see no issue having the state part of the object responsible to check the state of a context. If you don't want to keep it as part of the HealthCheck object, make another layer between the two, but not a side instance Also the HealthCheck class is dedicated to a specific context as it's using a kubeconfig object which is a context. So I think it's missing in the name that it's for a specific Context. HealthCheckContext.
Yes it was my worries when I read the code. To me we should separate the inner state of the data vs what we want to expose publicly having the state the closest possible of the object maintaining it. |
} | ||
|
||
// start checking the readiness | ||
public async start(opts?: CheckOptions): Promise<boolean> { |
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.
wondering if options are not part of the constructor
OK, I was checking if the whole kubeconfig is changed or not, but we can do the check at the I'll make the changes. Thanks for your feedback |
packages/main/src/plugin/kubernetes/contexts-manager-experimental.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Philippe Martin <[email protected]>
Signed-off-by: Philippe Martin <[email protected]>
Signed-off-by: Philippe Martin <[email protected]>
} | ||
|
||
update(): void { | ||
console.log('current health check states', this.manager.getHealthCheckersStates()); |
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.
Not sure if we want to merge with this, but it can be useful for testing/reviewing, and I can remove it when LGTM'd
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.
ok for me to keep this trace
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.
thanks for all the improvements
it looks like easier to understand, and each part is doing and managing its own data, so in case of failure, easy to know which part is failing and it we want to enhance parts, contract being clear, we can easily swap one component by another
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.
LGTM
* feat: check cluster connectivity with health check Signed-off-by: Philippe Martin <[email protected]> * fix: abort health check on dispose Signed-off-by: Philippe Martin <[email protected]> * fix: use dispose and EventEmitter Signed-off-by: Philippe Martin <[email protected]> * fix: create Health in constructor Signed-off-by: Philippe Martin <[email protected]> * fix: remove comment on if Signed-off-by: Philippe Martin <[email protected]> * fix: call JSON.stringify only once Signed-off-by: Philippe Martin <[email protected]> * fix: do not use onReadiness event + make set check/reachable atomic Signed-off-by: Philippe Martin <[email protected]> * feat: rewrite by using events Signed-off-by: Philippe Martin <[email protected]> * fix: review Signed-off-by: Philippe Martin <[email protected]> * fix: more unit tests Signed-off-by: Philippe Martin <[email protected]>
What does this PR do?
check connectivity with health check, in the context of experimental kubernetes states,
and saves the state in a
ContextsConnectivityRegistry
.The next step is to dispatch the state to the frontend.
(The first commit of the PR is a copy of the one in #10074)
Screenshot / video of UI
backend only
What issues does this PR fix or reference?
Part of #9938
How to test this PR?
To test the new version, set this preference in ~/.local/share/containers/podman-desktop/configuration/settings.json:
You can have some cluster behind a VPN to provoke some timeout and check by editing the kubeconfig file several times quickly (by changing the current context for example), that previous checks are aborted and only a response from the last (un-aborted) check is received.
Some logs can be added to the
ContextsConnectivityRegistry
to display the state each time it is changed