Commit Graph

16 Commits

Author SHA1 Message Date
chaunceyjiang f45aedb716 feat: validate fieldOverrider operation
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
2024-10-11 14:59:04 +08:00
sophie 6bf6f305b8 feat: add fieldoverrider
Signed-off-by: sophie <yl5357@columbia.edu>
2024-10-08 10:36:32 -04:00
karmada-bot 6804af4d04
Merge pull request #5495 from mohamedawnallah/unitTestOverridePolicy
pkg/webhook: unit test override policy
2024-09-21 17:09:06 +08:00
Mohamed Awnallah f19f9c4a45 pkg/webhook: test OverridePolicy
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>
2024-09-13 10:14:04 +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
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
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
whitewindmills 89295f9606 Fix inspection errors
Signed-off-by: whitewindmills <jayfantasyhjh@gmail.com>
2023-05-17 17:06:27 +08:00
chaunceyjiang 8fd5d6dc23 feat: validates the fieldSelector of overridepolicy
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
2023-02-22 22:03:52 +08:00
carlory 990c079eb6 fix setting resource selector default namespace for policy
Signed-off-by: carlory <baofa.fan@daocloud.io>
2022-11-26 19:09:46 +08:00
lonelyCZ f99d1e8a0f Implementing karmada-webhook of validating ClusterOverridePolicy
Signed-off-by: lonelyCZ <531187475@qq.com>
2021-12-20 13:32:52 +08:00
lonelyCZ b8d46597a9 Implementing karmada-webhook of validating OverridePolicy
Signed-off-by: lonelyCZ <531187475@qq.com>
2021-12-18 12:42:22 +08:00
esto a6165e47f9 update import-aliases
Signed-off-by: esto <1291156784@qq.com>
2021-09-15 15:13:14 +08:00
Kevin Wang 4afcabe5f1 rename apigroup name, from propagationstrategy to policy
Signed-off-by: Kevin Wang <kevinwzf0126@gmail.com>
2021-01-25 15:55:06 +08:00
Hongcai Ren 148af0e1d1
Add webhook framework (#133)
Signed-off-by: RainbowMango <renhongcai@huawei.com>
2021-01-21 19:26:29 +08:00