-
Notifications
You must be signed in to change notification settings - Fork 859
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
Feat: support custom cascading gc policy #6059
Feat: support custom cascading gc policy #6059
Conversation
eda4749
to
3541d64
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #6059 +/- ##
==========================================
+ Coverage 57.16% 61.03% +3.87%
==========================================
Files 220 224 +4
Lines 31136 31278 +142
==========================================
+ Hits 17800 19092 +1292
+ Misses 11695 10422 -1273
- Partials 1641 1764 +123
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
@@ -80,12 +80,6 @@ jobs: | |||
go install github.com/onsi/ginkgo/v2/ginkgo | |||
go get github.com/onsi/gomega/... | |||
|
|||
- name: Setup KinD |
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.
Why are we deleting this?
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.
Because we have two "Setup KinD" in e2e-test.
// GarbageCollectPropagationOrphan orphan child resources while deleting target resources | ||
GarbageCollectPropagationOrphan = "orphan" | ||
// GarbageCollectPropagationBackground delete child resources in background while deleting target resources | ||
GarbageCollectPropagationBackground = "background" |
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.
How about cascading
? I think backgroud is kinda confusing since we don't allow foreground
GC option.
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.
Actually, "foreground" is okay for client-go but we should not allow it here. It will block the controller and should only be a CLI case.
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.
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.
Great, I renamed the value of "background" to "cascading".
3541d64
to
68cc8f3
Compare
68cc8f3
to
3541d64
Compare
Signed-off-by: Somefive <yd219913@alibaba-inc.com>
3541d64
to
07471ef
Compare
@@ -12,6 +12,8 @@ template: { | |||
selector: #ResourcePolicyRuleSelector | |||
// +usage=Specify the strategy for target resource to recycle | |||
strategy: *"onAppUpdate" | "onAppDelete" | "never" | |||
// +usage=Specify the deletion propagation strategy for target resource to delete | |||
propagation?: "orphan" | "cascading" |
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.
Which propagation will be used by default?
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.
The default case is having no propagation settings. For Kubernetes, when the propagation setting is absent, it will determine the propagation by resources. For example, for deployments, it will be "cascading" (or in other word "background"), but for jobs, it will be "orphan". It works like "auto".
Description of your changes
The default behaviour of deleting Job in Kubernetes will orphan the underlying pods. The initial design is to ensure the logs of pods can be reserved. But there are cases that KubeVela users do not want to orphan pods and want to delete them when Job or upper layer application is recycled.
This PR adds a "cascading" fields in the "garbage-collect" policy, which allows user to customize the deletion behaviour for selected resources. If not set, KubeVela controller will use the native Kubernetes behaviour for deletion.
Example:
In the above example, the job will recycle the underlying pods when it is deleted. If the policy is not configured, the pods will be left even if the job and the app is deleted.
I have:
make reviewable
to ensure this PR is ready for review.backport release-x.y
labels to auto-backport this PR if necessary.How has this code been tested
Special notes for your reviewer