-
Notifications
You must be signed in to change notification settings - Fork 260
fix: only ping k8s for healthz in podsubnet #3616
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
Conversation
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.
Pull Request Overview
This PR refactors the healthz handler to only include Kubernetes API server connectivity checks in dynamic podsubnet mode, reducing unnecessary checks in static modes. Key changes include:
- Modifying the main service to conditionally enable the API server ping based on the podsubnet mode.
- Updating tests to reflect the new Config struct in the healthz package.
- Refactoring the healthz handler to use a new configuration structure with a single PingAPIServer flag.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cns/service/main.go | Updated healthz handler initialization to use conditional API ping. |
| cns/healthserver/healthz_test.go | Updated tests to use the new Config struct with the PingAPIServer flag. |
| cns/healthserver/healthz.go | Refactored the NewHealthzHandlerWithChecks function to use the new config. |
Comments suppressed due to low confidence (2)
cns/healthserver/healthz.go:22
- [nitpick] The new struct name 'Config' is quite generic; consider renaming it to 'HealthzConfig' to provide clearer context.
type Config struct {
cns/healthserver/healthz.go:30
- Avoid shadowing the input 'cfg' by using a different variable name (e.g., 'kubeCfg') when obtaining the kubeconfig to improve code clarity.
cfg, err := ctrl.GetConfig()
|
/azp run Azure Container Networking PR |
|
Azure Pipelines successfully started running 1 pipeline(s). |
7fef88b to
35c0c96
Compare
Signed-off-by: GitHub <[email protected]>
4290f92 to
43a0746
Compare
|
/azp run Azure Container Networking PR |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: GitHub <[email protected]>
43a0746 to
6e3ad3d
Compare
|
/azp run Azure Container Networking PR |
|
Azure Pipelines successfully started running 1 pipeline(s). |
* fix: only ping k8s for healthz in podsubnet Signed-off-by: GitHub <[email protected]> * update dockerfiles Signed-off-by: GitHub <[email protected]> --------- Signed-off-by: GitHub <[email protected]>
We only really need an ongoing connection to k8s if we are in dynamic podsubnet mode. Overlay and vnetblock are static and do not need it after initialization, so we shouldn't consider loss of apiserver connectivity a restartable failure in those scenarios.