Commit Graph

13 Commits

Author SHA1 Message Date
Mohamed Awnallah d5c9a9d803 pkg/webhook: test Multi-Cluster Service
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>
2024-09-12 07:27:34 +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
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
Mohammed Affan 970435c3d1 Add linting for unused parameters
Signed-off-by: Mohammed Affan <mohammed.affan.727@gmail.com>
2024-01-13 12:26:54 +05:30
jwcesign dc4338398a feat: prevent updates to mcs.types or when multiple types are involved.
Signed-off-by: jwcesign <jwcesign@gmail.com>
2023-12-19 20:59:25 +08:00
jwcesign e77fe55851 feat: fix conflicts with pp
Signed-off-by: jwcesign <jwcesign@gmail.com>
2023-12-14 19:46:46 +08:00
jwcesign 5932615cba feat: support mcs with native svc name
Signed-off-by: jwcesign <jwcesign@gmail.com>
2023-11-30 15:55:15 +08:00
jwcesign a39416cb14 api: define API for MultiClusterService
Signed-off-by: jwcesign <jwcesign@gmail.com>
2023-11-24 13:36:54 +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
lonelyCZ 9aefb4c4dd Fix to validate spec.types of MultiClusterService Webhook
Signed-off-by: lonelyCZ <chengzhe@zju.edu.cn>
2023-10-09 13:12:24 +08:00
whitewindmills a061740bb9 add mcs validation ut
Signed-off-by: whitewindmills <jayfantasyhjh@gmail.com>
2023-08-07 11:13:10 +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
yike21 9079268ebb add validation for mcs
Signed-off-by: yike21 <yike21@qq.com>
2023-07-12 09:21:48 +08:00