-
Notifications
You must be signed in to change notification settings - Fork 258
Fix: Delete State From State File (FrontendNIC) #4077
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
base: master
Are you sure you want to change the base?
Conversation
… method to enhance endpoint deletion logic
…ateHandler and DeleteEndpointStateHelper
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 implements a comprehensive DeleteEndpointState API in CNS (Container Network Service) to improve endpoint lifecycle management in stateless CNI scenarios. The implementation includes creating the Delete Endpoint State API, handler, and helper functions, along with integrating the functionality into the network manager with proper validation for FrontendNIC scenarios.
- Added conditional endpoint deletion logic in network manager for FrontendNIC types
- Implemented HTTP DELETE endpoint handler and helper functions in CNS REST server
- Created client-side DeleteEndpointState method to support HTTP DELETE requests
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
network/manager.go | Added conditional endpoint deletion logic for FrontendNIC types in stateless CNI mode |
cns/restserver/ipam.go | Implemented DeleteEndpointStateHandler and helper functions with merge conflict markers |
cns/client/client.go | Added DeleteEndpointState client method for HTTP DELETE requests |
Comments suppressed due to low confidence (1)
cns/restserver/ipam.go:1
- Git merge conflict markers are present in the code. These need to be resolved by removing the conflict markers and keeping the appropriate code sections.
// Copyright 2017 Microsoft. All rights reserved.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
// Decode the request body to get ipInfo if needed | ||
var req map[string]*IPInfo | ||
err := common.Decode(w, r, &req) | ||
if err != nil { | ||
logger.Printf("[DeleteEndpointStateHandler] Failed to decode request body: %v", err) //nolint:staticcheck // reason: using deprecated call until migration to new API | ||
// Continue with deletion even if decode fails, as ipInfo might not be needed | ||
} | ||
|
Copilot
AI
Oct 13, 2025
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.
The code decodes a request body for a DELETE operation but then ignores any decode errors and doesn't use the decoded data. Since DELETE operations typically don't require a request body and the endpointID is extracted from the URL path, this decode logic should be removed.
// Decode the request body to get ipInfo if needed | |
var req map[string]*IPInfo | |
err := common.Decode(w, r, &req) | |
if err != nil { | |
logger.Printf("[DeleteEndpointStateHandler] Failed to decode request body: %v", err) //nolint:staticcheck // reason: using deprecated call until migration to new API | |
// Continue with deletion even if decode fails, as ipInfo might not be needed | |
} |
Copilot uses AI. Check for mistakes.
is this AI generated? the copilot comment is exactly the description - it usually summarizes differently
|
Reason for Change:
This PR implements a comprehensive DeleteEndpointState API in CNS (Container Network Service) to improve endpoint lifecycle management in stateless CNI scenarios. The changes include creating the Delete Endpoint State API, handler, and helper functions, along with integrating the functionality into the network manager with proper validation for FrontendNIC scenarios.
Requirements:
Notes: