Commit Graph

4 Commits

Author SHA1 Message Date
Mohamed Awnallah fa4a077865 pkg: test ResourceDeletionProtection valid webhook
In this commit, we add unit tests for the `ValidatingAdmission` validation webhook
specifically for the resource deletion protection feature. These tests ensure
that the webhook correctly handles various admission scenarios:

- Tests the behavior when decoding the request object fails, verifying that admission
is denied with an appropriate error message.
- Ensures that resources labeled with `DeletionProtectionAlways` are denied deletion,
validating that the error message is returned.
- Confirms that resources without the deletion protection label are allowed to be deleted
without errors.
- Validates that resources with other labels are not impacted and are allowed to be deleted.
- Confirms that non-delete operations (e.g., create) are allowed by default.

Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
2024-09-09 03:56:52 +03:00
RainbowMango e8164eeebd Adopt controller-runtime braking changes: generics support PR2783
Adopt controller-runtime breaking changes: make decoder as interface. PR2736

Signed-off-by: RainbowMango <qdurenhongcai@gmail.com>
2024-07-13 16:49:01 +08:00
whitewindmills 2450bd6041 Correct licenses format
Signed-off-by: whitewindmills <jayfantasyhjh@gmail.com>
2024-07-04 10:35:16 +08:00
Vacant2333 1df2420f70 [feat] namespace deletion protection
Signed-off-by: Vacant2333 <vacant2333@gmail.com>
2023-10-17 14:54:54 +08:00