Commit Graph

28 Commits

Author SHA1 Message Date
karmada-bot 2e60a6e8a5
Merge pull request #5494 from mohamedawnallah/unitTestClusterPropagationPolicy
pkg/webhook: unit test cluster propagation policy
2024-09-13 16:36:59 +08:00
Mohamed Awnallah 87958641ae pkg/webhook: test ClusterPropagationPolicy
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>
2024-09-13 10:08:43 +03:00
Mohamed Awnallah df270fab91 pkg/webhook: log mutating webhook handlers
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>
2024-09-11 07:53:16 +03:00
changzhen 911cc44974 remove pp/cpp name length limit
Signed-off-by: changzhen <changzhen5@huawei.com>
2024-08-16 10:34:15 +08: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 91f72f998c Transplant propagation policy finalizer to karmada-webhook
Signed-off-by: whitewindmills <jayfantasyhjh@gmail.com>
2024-07-08 10:23:38 +08:00
whitewindmills b7678c92b2 Add validation on policy permanent ID
Signed-off-by: whitewindmills <jayfantasyhjh@gmail.com>
2024-05-22 17:59:52 +08:00
jwcesign 6a54a9abb4 feat: add permanent id label to pp/cpp/rb/crb/work resources
Signed-off-by: jwcesign <jwcesign@gmail.com>
2024-04-10 16:08:51 +08:00
zhy76 adef1e5974 feat: add license and verify license for code file
Signed-off-by: zhy76 <958474674@qq.com>
2023-11-16 11:11:21 +08:00
chaunceyjiang 2c55f10641 feat: Refactor the mechanism for propagating serviceexport derived svc and eps.
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
2023-08-18 16:04:35 +08:00
RainbowMango 4ee4b22f05 Adopt Kubernetes breaking changes: PR 113542 which require singular names for core types
Adopt breaking change of contriller-runtime PR 2122
Adopt breaking change of contriller-runtime PR 2296
Adopt breaking change of controller-runtime PR 2139
Adopt breaking change of controller-runtime PR 2135
Adopt breaking change of Kubernetes PR 116218
Adopt breaking change of controller-runtime PR 2149
Adopt breaking change of controller-runtime PR 2150
Adopt breaking change of controller-runtime PR 2134
Adopt breaking change of controller-runtime PR 2293
Adopt breaking change of controller-runtime PR 2144
Adopt k8s feature: watch list. PR 115402
Adopt breaking change of Kubernetes PR 117102
Adopt Kubernetes change: disable staticcheck
Fix unit tests that failure due to fake-client behavior changes.

Signed-off-by: RainbowMango <qdurenhongcai@gmail.com>
2023-07-29 16:47:38 +08:00
karmada-bot 8594406e5f
Merge pull request #3398 from whitewindmills/code-cleanup
Fix inspection errors
2023-05-19 20:28:53 +08:00
whitewindmills 89295f9606 Fix inspection errors
Signed-off-by: whitewindmills <jayfantasyhjh@gmail.com>
2023-05-17 17:06:27 +08:00
Poor12 2c9d900c28 add some fields for GracefulEvictionTask
Signed-off-by: Poor12 <shentiecheng@huawei.com>
2023-04-24 14:59:27 +08:00
whitewindmills 26c787531e add placement helper
Signed-off-by: whitewindmills <jayfantasyhjh@gmail.com>
2023-04-01 16:45:57 +08:00
changzhen 42c2e3c643 add validation for orderedClusterAffinities
Signed-off-by: changzhen <changzhen5@huawei.com>
2023-02-18 15:45:44 +08:00
Poor12 b9e32de35d add schedulerName validation
Signed-off-by: Poor12 <shentiecheng@huawei.com>
2023-02-01 14:47:42 +08:00
chaunceyjiang 7a3207c8ee fix: set the default value of replicaSchedulengType
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
2023-01-09 14:37:20 +08:00
carlory 1b33ef882b move validation funcs into util/validation
Signed-off-by: carlory <baofa.fan@daocloud.io>
2022-11-29 10:30:17 +08:00
changzhen 5a767f4f21 allow to update the resourceSelector of PropagationPolicy/ClusterPropagationPolicy
Signed-off-by: changzhen <changzhen5@huawei.com>
2022-11-09 16:40:57 +08:00
Garrybest c5b35bd199 add default tolerations for pp and cpp
Signed-off-by: Garrybest <garrybest@foxmail.com>
2022-08-02 17:20:25 +08:00
learner0810 3ffa9dc95f fix/log-severity
Signed-off-by: learner0810 <zhongjun.li@daocloud.io>
2021-10-02 20:26:53 +08:00
changzhen 1e6c21cc28 mutate policy's ResourceSelectors in webhook
Signed-off-by: changzhen <changzhen5@huawei.com>
2021-07-09 11:02:23 +08:00
lihanbo 7e1e7b9726 add e2e test for scheduling base on cluster provider/region
Signed-off-by: lihanbo <lihanbo2@huawei.com>
2021-05-25 09:11:57 +08:00
lihanbo b565cc0caa support schedule based on cluster provider/region/zone
Signed-off-by: lihanbo <lihanbo2@huawei.com>
2021-05-25 09:11:57 +08:00
RainbowMango 763c2a10e7 Adopt Reconcile() method signature change
Adopt MapOjbect removing change
Adopt event handling object changes
Adopt ToRequestsFunc to MapFunc change
Adopt EnqueueRequestsFromMapFunc change
Adopt runerable interface change
Adopt using admission review version v1

Signed-off-by: RainbowMango <renhongcai@huawei.com>
2021-05-08 19:12:35 +08:00
yangcheng-icbc c77304df01
PropagationPolicy and ClusterPropagationPolicy name should be no more than 63 characters (#249)
Signed-off-by: icbc-yangcheng <shineus1996@gmail.com>
2021-04-01 14:55:07 +08:00
Hanbo Li d48065f086
add webhook for clusterpropagationpolicy and propagationpolicy (#201)
Signed-off-by: lihanbo <lihanbo2@huawei.com>
2021-03-10 09:36:32 +08:00