-
Notifications
You must be signed in to change notification settings - Fork 259
Fix: Delete State From State File (FrontendNIC) #3927
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 implements a DeleteEndpointState API in CNS to improve endpoint lifecycle management for stateless CNI scenarios. The changes enable proper cleanup of endpoint state files through HTTP DELETE requests with validation for FrontendNIC types.
- Adds DeleteEndpointState method to CNS client for HTTP DELETE requests
- Implements DeleteEndpointStateHandler and helper functions in REST server
- Integrates endpoint deletion into network manager with FrontendNIC validation
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| network/manager.go | Adds conditional endpoint deletion logic for FrontendNIC types in stateless CNI mode |
| cns/restserver/ipam.go | Implements HTTP DELETE handler and helper function for endpoint state management |
| cns/client/client.go | Adds client method to send DELETE requests to CNS endpoint API |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| } | ||
|
|
||
| // Delete the endpoint from state | ||
| err = service.DeleteEndpointStateHelper(endpointID) |
Copilot
AI
Aug 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 request body decoding appears unnecessary for a DELETE operation. Consider removing this unused variable and the associated decode logic (lines 1349-1354) since DELETE requests typically don't require request body parsing for endpoint deletion.
| err = service.DeleteEndpointStateHelper(endpointID) | |
| // Delete the endpoint from state | |
| err := service.DeleteEndpointStateHelper(endpointID) |
behzad-mir
left a comment
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.
Look good overall. Need to address the changes I mentioned.
|
|
||
| return &response, nil | ||
| } | ||
|
|
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.
Please address the Lint erros in the PR
f446217 to
de798b6
Compare
…ateHandler and DeleteEndpointStateHelper
|
This pull request is stale because it has been open for 2 weeks with no activity. Remove stale label or comment or this will be closed in 7 days |
|
Pull request closed due to inactivity. |
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.
Notes:
NodeNetworkInterfaceFrontendNICtypes, ensuring only appropriate endpoints are cleaned up through the CNS APIDeleteEndpointStatemethod to enable HTTP DELETE requests to the CNS endpoint APIDeleteEndpointStateHandlerandDeleteEndpointStateHelperand to handle HTTP DELETE requests for endpoint cleanup