-
Notifications
You must be signed in to change notification settings - Fork 254
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
base: master
Are you sure you want to change the base?
Conversation
@mugeshsp please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
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) |
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) |
Copilot uses AI. Check for mistakes.
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.
@@ -1100,3 +1100,36 @@ func (c *Client) UpdateEndpoint(ctx context.Context, endpointID string, ipInfo m | |||
|
|||
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
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:
NodeNetworkInterfaceFrontendNIC
types, ensuring only appropriate endpoints are cleaned up through the CNS APIDeleteEndpointState
method to enable HTTP DELETE requests to the CNS endpoint APIDeleteEndpointStateHandler
andDeleteEndpointStateHelper
and to handle HTTP DELETE requests for endpoint cleanup