Skip to content
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

Add Checks for Fleet Existence During Application Deletion #605

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

LiZhenCheng9527
Copy link
Contributor

What type of PR is this?
/kind feature

What this PR does / why we need it:
Add Checks for Fleet Existence During Application Deletion
Which issue(s) this PR fixes:
Fixes #604

Signed-off-by: LiZhenCheng9527 <lizhencheng6@huawei.com>
@kurator-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hzxuzhonghu for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

Copy link

netlify bot commented Feb 20, 2024

Deploy Preview for kurator-dev canceled.

Name Link
🔨 Latest commit 4b3cbd7
🔍 Latest deploy log https://app.netlify.com/sites/kurator-dev/deploys/65e68033b6f9bc0008af4d8b

e2e/suite_test.go Outdated Show resolved Hide resolved
pkg/fleet-manager/application/controller.go Outdated Show resolved Hide resolved
func (a *ApplicationManager) reconcileDelete(ctx context.Context, app *applicationapi.Application) (ctrl.Result, error) {
fleetKey := generateFleetKey(app)
fleet := &fleetapi.Fleet{}
if err := a.Client.Get(ctx, fleetKey, fleet); err == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should log error when the error is not found, for other errors we should retry.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the application does not need to delete resources in member cluster, we may skip this ops

@LiZhenCheng9527 LiZhenCheng9527 force-pushed the fix-delete branch 11 times, most recently from 6b37b4e to 4acac35 Compare February 27, 2024 09:25
@LiZhenCheng9527 LiZhenCheng9527 force-pushed the fix-delete branch 2 times, most recently from 3ed0a26 to 85b4aac Compare March 1, 2024 10:33
Signed-off-by: LiZhenCheng9527 <lizhencheng6@huawei.com>
fleetKey := generateFleetKey(app)
fleet := &fleetapi.Fleet{}
if err := a.Client.Get(ctx, fleetKey, fleet); err != nil {
log.Error(err, "failed to find fleet", "fleet", fleetKey)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check network / server error, and return

Signed-off-by: LiZhenCheng9527 <lizhencheng6@huawei.com>
if apierrors.IsNotFound(err) {
log.Info("fleet does not exist", "fleet", fleetKey)
}
log.Info("failed to get fleet", "fleet", fleetKey, "error", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not right. You should return only for this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleting an application with no fleet can cause a crash.
3 participants