-
Couldn't load subscription status.
- Fork 259
fix: update error message for MTPNC not found and not ready in CNS #3776
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 improves the error path when a MultitenantPodNetworkConfig (MTPNC) is missing by introducing a specific “not found” error that Kubernetes kubelet will recognize to retry faster, and it adds unit tests to cover these new error messages.
- Introduce
errMTPNCNotFoundand wrap cache-get errors so they return a “network is not ready” prefix - Update
getIPConfigandgetMTPNCto return the new wrapped error - Add and adjust unit tests to assert on the new error wrapping and message contents
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cns/middlewares/k8sSwiftV2.go | Added errMTPNCNotFound, getMTPNCNotFoundErr, and updated error returns in cache‐get failures |
| cns/middlewares/k8sSwiftV2_linux_test.go | Imported errors and strings, and extended tests to check for "network is not ready" in error messages |
Comments suppressed due to low confidence (2)
cns/middlewares/k8sSwiftV2_linux_test.go:252
- To mirror the earlier
errors.Ischeck for the "not found" case, consider addingassert.Assert(t, errors.Is(err, errMTPNCNotReady), ...)here so you verify the wrapping for the "not ready" error as well.
assert.Error(t, err, errMTPNCNotReady.Error()) cns/middlewares/k8sSwiftV2.go:31
- Make sure you have added
import "fmt"at the top of this file so thatfmt.Errorfcompiles correctly.
var getMTPNCNotFoundErr = func(err error) error { | /azp run Azure Container Networking PR |
| Azure Pipelines successfully started running 1 pipeline(s). |
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.
| /azp run Azure Container Networking PR |
| Azure Pipelines successfully started running 1 pipeline(s). |
| /azp run Azure Container Networking PR |
| Azure Pipelines successfully started running 1 pipeline(s). |
| @isaac-dasan title reads mtpnc not found but we also cover dhcp discover failed case. I would like to have separate PR for returning network not ready if dhcp discover failed |
| /azp run Azure Container Networking PR |
| Azure Pipelines successfully started running 1 pipeline(s). |
| /azp run Azure Container Networking PR |
| Azure Pipelines successfully started running 1 pipeline(s). |
| /azp run Azure Container Networking PR |
| Azure Pipelines successfully started running 1 pipeline(s). |
| /azp run Azure Container Networking PR |
| Azure Pipelines successfully started running 1 pipeline(s). |
| @microsoft-github-policy-service rerun |
40b0c5c to 9b3bdbe Compare Signed-off-by: GitHub <noreply@github.com>
9b3bdbe to ca1b3c2 Compare | /azp run Azure Container Networking PR |
| Azure Pipelines successfully started running 1 pipeline(s). |
| @microsoft-github-policy-service rerun |
| @microsoft-github-policy-service rerun |
…3776) squash commit to prevent github CLA issue Signed-off-by: GitHub <noreply@github.com>
…3776) squash commit to prevent github CLA issue Signed-off-by: GitHub <noreply@github.com>
…found and not ready in CNS (#3775) * fix: update network error msg to match kubelet expectations (#3768) update network error msg to match kubelet expectations Signed-off-by: GitHub <noreply@github.com> * fix: update error message for MTPNC not found and not ready in CNS (#3776) squash commit to prevent github CLA issue Signed-off-by: GitHub <noreply@github.com> --------- Signed-off-by: GitHub <noreply@github.com>
…zure#3776) squash commit to prevent github CLA issue Signed-off-by: GitHub <noreply@github.com>
…3776) squash commit to prevent github CLA issue Signed-off-by: GitHub <noreply@github.com>
Reason for Change:
This is a perf fix. The particular error message "network is not ready" will make kubelet retry with faster backOffInterval than default error messages.
https://github.com/kubernetes/kubernetes/blob/efd2a0d1f514be96a2f012fc3cb40f7c872b4e67/pkg/kubelet/pod_workers.go#L1495C2-L1501C3
Requirements:
Notes: