Skip to content

Conversation

@isaac-dasan
Copy link
Member

@isaac-dasan isaac-dasan commented Jul 4, 2025

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:

Copilot AI review requested due to automatic review settings July 4, 2025 03:40
@isaac-dasan isaac-dasan requested a review from a team as a code owner July 4, 2025 03:40
@isaac-dasan isaac-dasan requested a review from tamilmani1989 July 4, 2025 03:40
Copy link
Contributor

Copilot AI left a 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 errMTPNCNotFound and wrap cache-get errors so they return a “network is not ready” prefix
  • Update getIPConfig and getMTPNC to 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.Is check for the "not found" case, consider adding assert.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 that fmt.Errorf compiles correctly.
var getMTPNCNotFoundErr = func(err error) error { 
@isaac-dasan
Copy link
Member Author

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).
Copy link
Collaborator

@rbtr rbtr left a comment

Choose a reason for hiding this comment

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

@isaac-dasan
Copy link
Member Author

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).
@isaac-dasan
Copy link
Member Author

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).
@tamilmani1989
Copy link
Member

@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

@isaac-dasan isaac-dasan changed the title fix: error message for mtpnc not found and add UT fix: update error message for swiftv2 code path Jul 8, 2025
@isaac-dasan isaac-dasan changed the title fix: update error message for swiftv2 code path fix: update error message for MTPNC not found and not ready in CNS Jul 9, 2025
@isaac-dasan
Copy link
Member Author

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).
rbtr
rbtr previously approved these changes Jul 9, 2025
@isaac-dasan
Copy link
Member Author

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).
@isaac-dasan
Copy link
Member Author

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).
@isaac-dasan isaac-dasan enabled auto-merge July 10, 2025 00:41
@QxBytes
Copy link
Contributor

QxBytes commented Jul 10, 2025

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).
@isaac-dasan
Copy link
Member Author

@microsoft-github-policy-service rerun

@isaac-dasan isaac-dasan force-pushed the isaac/swiftv2/errormessage/ut branch from 40b0c5c to 9b3bdbe Compare July 10, 2025 03:16
Signed-off-by: GitHub <noreply@github.com>
@isaac-dasan isaac-dasan force-pushed the isaac/swiftv2/errormessage/ut branch from 9b3bdbe to ca1b3c2 Compare July 10, 2025 03:28
@isaac-dasan
Copy link
Member Author

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).
@isaac-dasan
Copy link
Member Author

@microsoft-github-policy-service rerun

@isaac-dasan isaac-dasan added this pull request to the merge queue Jul 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 10, 2025
@isaac-dasan isaac-dasan added this pull request to the merge queue Jul 10, 2025
@isaac-dasan
Copy link
Member Author

@microsoft-github-policy-service rerun

Merged via the queue into master with commit 0cc9bb9 Jul 10, 2025
15 of 16 checks passed
@isaac-dasan isaac-dasan deleted the isaac/swiftv2/errormessage/ut branch July 10, 2025 23:15
isaac-dasan added a commit that referenced this pull request Jul 11, 2025
…3776) squash commit to prevent github CLA issue Signed-off-by: GitHub <noreply@github.com>
isaac-dasan added a commit that referenced this pull request Jul 11, 2025
…3776) squash commit to prevent github CLA issue Signed-off-by: GitHub <noreply@github.com>
github-merge-queue bot pushed a commit that referenced this pull request Jul 11, 2025
…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>
NihaNallappagari pushed a commit to NihaNallappagari/azure-container-networking that referenced this pull request Sep 4, 2025
…zure#3776) squash commit to prevent github CLA issue Signed-off-by: GitHub <noreply@github.com>
sivakami-projects pushed a commit that referenced this pull request Oct 23, 2025
…3776) squash commit to prevent github CLA issue Signed-off-by: GitHub <noreply@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

7 participants