-
Notifications
You must be signed in to change notification settings - Fork 38
feat: add managed resource webhook #1152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
pkg/webhook/managedresource/managedresource_validating_webhook_test.go
Outdated
Show resolved
Hide resolved
pkg/webhook/managedresource/managedresource_validating_webhook.go
Outdated
Show resolved
Hide resolved
|
The UT gate is failing because of this test https://github.com/Azure/fleet/blob/main/pkg/webhook/webhook_test.go#L28 https://github.com/Azure/fleet/actions/runs/16003096328/job/45142931406?pr=1152 PTAL |
pkg/webhook/managedresource/managedresource_validating_webhook_test.go
Outdated
Show resolved
Hide resolved
|
We should also add E2Es here https://github.com/Azure/fleet/blob/main/test/e2e/webhook_test.go |
de8bc2a to
35cc8f0
Compare
Signed-off-by: Nont <[email protected]>
Signed-off-by: Nont <[email protected]>
Signed-off-by: Nont <[email protected]>
Signed-off-by: Nont <[email protected]>
Signed-off-by: Nont <[email protected]>
Signed-off-by: Nont <[email protected]>
4475ea8 to
660c99d
Compare
|
You may want to look into ValidatingAdmissionPolicy - webhooks are a huge lift (and, if they are blocking, an uptime risk for the api server). VAP is extremely lightweight. |
@stevekuznetsov thanks for the input. We'll go ahead with this approach for now and will be validating if it can be simplified further with the way you suggest. |
7952439 to
334f248
Compare
334f248 to
9103561
Compare
Signed-off-by: Nont <[email protected]>
9103561 to
c35147c
Compare
| if err := runtime.Convert_runtime_RawExtension_To_runtime_Object(&raw, &obj, nil); err != nil { | ||
| return nil, nil, err | ||
| } | ||
| o, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj) | ||
| if err != nil { | ||
| return nil, nil, err | ||
| } | ||
| u := unstructured.Unstructured{Object: o} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We achieve the same using https://github.com/Azure/fleet/blob/main/pkg/webhook/clusterresourceplacement/v1alpha1_clusterresourceplacement_validating_webhook.go#L41. But this can be handled in a follow up PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using a converter doesn't improve much here. It's probably even simpler to not have a decoder just to convert from raw to runtime.Object.
Arvindthiru
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
2b17a21 to
044e29c
Compare
Signed-off-by: Nont <[email protected]>
044e29c to
d39c3b3
Compare
Description of your changes
Fixes :
Enable the fleet dataplane to deny any create/update/delete operations on ARM managed resources. At the moment, CRP, Namespace, ResourceQuota, and NetworkPolicy can be managed resources.
I have:
make reviewableto ensure this PR is ready for review.How has this code been tested
make local-unit-testran successfullySpecial notes for your reviewer