kruise icon indicating copy to clipboard operation
kruise copied to clipboard

add: Support the deletion protection of service and ingress

Open kevin1689-cloud opened this issue 1 year ago • 11 comments

Ⅰ. Describe what this PR does

This PR complete a feature: Support the deletion protection of service and ingress resources

Ⅱ. Does this pull request fix one issue?

fixs #1218

Ⅲ. Describe how to verify it

The Cascading judgement of Service and Ingress is whether there are any endpoints exist for the Service or Ingress. The verify steps is as show below:

Service Deleteion Protection 1.Create a Service and label it with "policy.kruise.io/delete-protection=Always" 2.Delete the Service should be rejected 3.Patch the Service with label "policy.kruise.io/delete-protection=Cascading" 4.Create endpoints of the Service 5.Delete the Service should be rejected 6.Delete all endpoints of the Service 7.The Service can be delete successfully

Ingress Deleteion Protection 1.Create a Ingress and label it with "policy.kruise.io/delete-protection=Always" 2.Delete the Ingress should be rejected 3.Patch the Ingress with label "policy.kruise.io/delete-protection=Cascading" 4.Create Service which menotioned in spec.rules.http.paths.backend.service of Ingress spec 5.Create endpoints of the Service 6.Delete the Ingress should be rejected 7.Delete all endpoints of the Service 8.The Ingress can be delete successfully

Ⅳ. Special notes for reviews

None

kevin1689-cloud avatar Apr 28 '23 00:04 kevin1689-cloud

Hi, I saw there are some CI ans E2E checks not successful. I checked my code and found there are indeed some bugs in my code. I'm working on to fix them, it's no need to review my code now. When I'm done, I will leave comment to require for code review. Thanks.

kevin1689-cloud avatar May 01 '23 12:05 kevin1689-cloud

@kevin1689-cloud tks very much, k8s community also have related PR, I have not yet figured out how to implement this.

zmberg avatar May 08 '23 07:05 zmberg

@kevin1689-cloud tks very much, k8s community also have related PR, I have not yet figured out how to implement this.

Got it, I'm reading Conversation of the mentioned k8s community PR, the concept of "Lien" is interesting. I‘ve been busy at my company work recently, I thought I could back to working on this pr about 2-3 weeks later and I will fix the bug in my code, read the k8s community PR carefully and give my opinion on that.

kevin1689-cloud avatar May 18 '23 06:05 kevin1689-cloud

@kevin1689-cloud Should we discuss this at the community meeting next Thursday evening?

zmberg avatar Jun 01 '23 08:06 zmberg

@kevin1689-cloud Should we discuss this at the community meeting next Thursday evening?

@zmberg Hi, thanks for the invite, how about we discuss this at the community meeting after next Thursday? I have some company project issue to due with in next week, and I'm afraid can't attend the community meeting in time. By the next community meeting, I will be ready.

kevin1689-cloud avatar Jun 02 '23 00:06 kevin1689-cloud

@zmberg Hi, as we discussed, the main scenarios of service&ingress deletion protection is:

  • Avoid the IP address of service&ingress to be changed due to accidental deletion.

So this time we only support the Always delete protection. I noticed there are two E2E checks not successful, but seems they are not caused by this PR.

Please take a look. Thanks!

kevin1689-cloud avatar Jul 09 '23 08:07 kevin1689-cloud

@zmberg Done. Please take a look.

kevin1689-cloud avatar Jul 10 '23 04:07 kevin1689-cloud

/lgtm

zmberg avatar Jul 10 '23 07:07 zmberg

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

:exclamation: No coverage uploaded for pull request base (master@9ccd897). Click here to learn what that means. Report is 47 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1269   +/-   ##
=========================================
  Coverage          ?   50.26%           
=========================================
  Files             ?      157           
  Lines             ?    23450           
  Branches          ?        0           
=========================================
  Hits              ?    11787           
  Misses            ?    10460           
  Partials          ?     1203           
Flag Coverage Δ
unittests 50.26% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Aug 17 '23 02:08 codecov-commenter

/lgtm

zmberg avatar Mar 07 '24 01:03 zmberg

/approve

zmberg avatar Mar 07 '24 01:03 zmberg

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zmberg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

kruise-bot avatar Mar 07 '24 01:03 kruise-bot