Signed-off-by: Joe Nathan Abellard <contact@jabellard.com>
Initial structure
Signed-off-by: Joe Nathan Abellard <contact@jabellard.com>
Update api
Signed-off-by: Joe Nathan Abellard <contact@jabellard.com>
Update api
Signed-off-by: Joe Nathan Abellard <contact@jabellard.com>
In this commit, we introduce unit tests for the `MutatingAdmission`
webhook specifically for the `Work` resource. The mutation webhook
tests include the following:
- Handles decode errors and denies admission when decoding fails.
- Provides full coverage of policy mutation, including setting default
and validating no unnecessary patches.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we introduce unit tests for both the `ValidationAdmission`
and `MutatingAdmission` webooks specifically for the `MultiClusterService` resource.
- Validation webhook tests:
- Tests the behavior when decoding the request object fails, verifying
that admission is denied with an appropriate error message.
- Validates that the webhook denies admission when encountering invalid
values in the `MultiClusterService` spec, ensuring error messaging.
- Confirms that valid `MultiClusterService` objects are admitted without errors.
- Mutation webhook tests:
- Handles decode errors and denies admission when decoding fails.
- Provides full coverage of `MultiClusterService` object mutation,
including setting default namespaces and validating no unnecessary patches.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we log the mutating handlers for `OverridePolicy`,
`ClusterPropagationPolicy`, and `MultiClusterService`. Specifically, it logs
information about the mutation of these resources, including the namespace,
name, and the operation type from the admission request.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we introduce unit tests for both the `ValidatingAdmission`
and `MutatingAdmission` webhooks for the `PropagationPolicy` resource.
The tests include:
- Validation webhook tests:
- Tests how the webhook responds when decoding the request object fails.
- Ensures that updates to the `SchedulerName` field are denied, as it should remain immutable.
- Validates that changes to the `PropagationPolicyPermanentIDLabel` label and its absence in creation requests are correctly handled.
- Confirms that valid `PropagationPolicy` objects are allowed through without errors.
- Mutation webhook tests:
- Handles decode errors and denies admission when decoding fails.
- Provides full coverage of policy mutation with default values and patch application.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
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>
The operation-scope flag gets used a lot when examining resources on
member clusters. The 's' shorthand was added to improve user QoL.
Signed-off-by: ahorine <allen.horine@gmail.com>