In this commit, we fix th null pointer dereference issue
that happens in altnames mutators for both Karmada APIServer
and EtcdServer when accessing the `Components` field on
`AltNamesMutatorConfig` struct.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit we introduce unit tests for the `Validation Admission`. These
tests ensure correct behavior for various validation scenarios and improve coverage:
- 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
`MultiClusterIngress` spec, ensuring error messaging.
- Confirms that valid `MultiClusterIngress` objects are admitted without errors.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we refactor `FederatedResourceQuota` webhook
mainly matching on substrings instead of whole strings for reliability
and resilience and reformat the test case names to follow format
`Function_Scenario_ExpectedResult` for better readability.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we introduce unit tests for the `MutatingAdmission`
webhook that mutates the `ClusterResourceBinding` resource. These tests
ensure correct behavior for various mutation scenarios and improve coverage:
- Testing the handling of decode errors and ensuring that admission is denied
when decoding fails.
- Full coverage testing of policy mutation, including setting default UUID
labels for the `ClusterResourceBinding`.
- Verifying that only the expected patch for the UUID label is applied, ensuring
no other unnecessary mutations.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we introduce unit tests for the `MutatingAdmission`
webhook that mutates the `ResourceBinding` resource. These tests ensure
correct behavior for various mutation scenarios and improve coverage:
- Testing the handling of decode errors and ensuring that admission
is denied when decoding fails.
- Full coverage testing of policy mutation, including setting default
UUID labels for the `ResourceBinding`.
- Verifying that only the expected patch for the UUID label is applied,
ensuring no other unnecessary mutations.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we introduce unit tests for both the `ValidationAdmission`
and `MutatingAdmission` webhooks specifically for the `OverridePolicy` 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
label values in the `OverridePolicy` spec, ensuring proper error messaging.
- Confirms that valid `OverridePolicy` objects are admitted without errors.
- Mutation webhook tests:
- Handles decode errors and denies admission when decoding fails.
- Provides full coverage of policy mutation, including setting default
namespaces and validating no unnecessary patches.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we introduce unit tests for both the `ValidatingAdmission`
and `MutatingAdmission` webhooks for the `ClusterPropagationPolicy` resource.
The tests include:
- Validation webhook tests:
- Tests how the webhook responds when decoding the request object fails.
- Ensures updates to the `SchedulerName` field are denied, as it should remain immutable.
- Validates that changes to the `ClusterPropagationPolicyPermanentIDLabel` label and its absence in creation requests are correctly handled.
- Confirms that valid `ClusterPropagationPolicy` objects are allowed through without errors.
- Mutation webhook tests:
- Handles decode errors and denies admission when decoding fails.
- Provides full coverage of cluster policy mutation with default values and patch application.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we refactor propagation policy names and check
on number of patches the mutation happens.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
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>