-
Notifications
You must be signed in to change notification settings - Fork 259
fix: Adding delete timestamp check #4078
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 adds validation to prevent IP configuration requests for pods with terminating MultitenantPodNetworkConfig (MTPNC) resources by checking if the deletion timestamp is set.
- Introduces an
IsTerminating()method to check if a MTPNC resource has a deletion timestamp - Adds validation in the middleware to reject requests when MTPNC is terminating
- Includes test coverage for the terminating state scenario
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crd/multitenancy/api/v1alpha1/utils.go | Adds IsTerminating() method to check deletion timestamp |
| cns/middlewares/k8sSwiftV2.go | Implements validation to reject IP config requests when MTPNC is terminating |
| cns/middlewares/mock/mockClient.go | Adds mock data for testing MTPNC terminating state |
| cns/middlewares/k8sSwiftV2_linux_test.go | Adds test case to verify terminating state is properly handled |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]> Signed-off-by: shreyashastantram <[email protected]>
|
/azp run Azure Container Networking PR |
|
Azure Pipelines successfully started running 1 pipeline(s). |
f0f45aa
|
/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). |
* Adding delete timestamp check * Adding UT and refactoring getmtpnc * Update cns/middlewares/k8sSwiftV2_linux_test.go Co-authored-by: Copilot <[email protected]> Signed-off-by: shreyashastantram <[email protected]> * Changing the MTPNC error message * Removing unused fields * Revert manifest changes for CRD files * Fixing error message and adding comments * Revert CRD API files to master state * fix: correcting comment assertion --------- Signed-off-by: shreyashastantram <[email protected]> Co-authored-by: Copilot <[email protected]>
Reason for Change:
Adding check to MTPNC to ensure that CNS doesn't respond back with the ipaddress if mtpnc is set for deletion.
Issue Fixed:
Requirements:
Notes: