feat: deny the member leave when member still has serviceExport#1092
feat: deny the member leave when member still has serviceExport#1092zhiying-lin merged 2 commits intoAzure:mainfrom
Conversation
6240c14 to
701d74c
Compare
701d74c to
7acac79
Compare
michaelawyu
left a comment
There was a problem hiding this comment.
Added some comments, PTAL.
|
|
||
| // Handle memberClusterValidator checks to see if member cluster has valid fields. | ||
| func (v *memberClusterValidator) Handle(_ context.Context, req admission.Request) admission.Response { | ||
| func (v *memberClusterValidator) Handle(ctx context.Context, req admission.Request) admission.Response { |
There was a problem hiding this comment.
Another naming nit: the added logic might no longer belong in a validator? It's more of a guard 😄
There was a problem hiding this comment.
That is, the logic seems to be more aligned with those in fleetresourcehandler pkg?
There was a problem hiding this comment.
fleetresourcehandler pkg is aim to validate the CR permissions so far. feel this package is better?
| mcObjectName := types.NamespacedName{Name: req.Name, Namespace: req.Namespace} | ||
| klog.V(2).InfoS("Validating webhook handling member cluster", "operation", req.Operation, "memberCluster", mcObjectName) | ||
|
|
||
| if req.Operation == admissionv1.Delete { // Will reject the requests whenever the serviceExport is not deleted |
There was a problem hiding this comment.
I have some random thoughts, these are not blocker per se, just something that occurred to me when reading the code:
There was a problem hiding this comment.
We already have a webhook that guards against deletion attempts on Azure Fleet Manager from users (or any source other than RP, AKS support, etc.). So technically speaking the added logic is added to prevent RP (in most cases) from triggering the deletion. How would these components interact I guess? The concern is mostly that users won't see the error message that reminds them to delete service exports.
There was a problem hiding this comment.
For upstream they have full control so we generally assume that protection is not 100% a must.
There was a problem hiding this comment.
In the RP side, we should surface this error to the user. Will test that.
TitleEnhance member leave validation and E2E tests Description
Changes walkthrough 📝
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Description of your changes
deny the member leave when member still has serviceExport in the webhook
Fixes #
I have:
make reviewableto ensure this PR is ready for review.How has this code been tested
Special notes for your reviewer