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

feature: run a clean-up job when uninstalling #3339

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

ty-dc
Copy link
Collaborator

@ty-dc ty-dc commented Apr 7, 2024

Thanks for contributing!

What type of PR is this?

What this PR does / why we need it:
close #2653

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

  1. Remove all spiderpool mutatingwebhookconfigurations
  2. Remove all spiderpool validatingwebhookconfigurations
  3. Remove all spiderpool CR:SpiderIPPool,SpiderSubnet、SpiderEndpoint, etc.

@ty-dc ty-dc added the release/feature-new release note for new feature label Apr 7, 2024
Copy link

codecov bot commented Apr 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.31%. Comparing base (dc8e9af) to head (a9fc861).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3339   +/-   ##
=======================================
  Coverage   81.31%   81.31%           
=======================================
  Files          50       50           
  Lines        4352     4352           
=======================================
  Hits         3539     3539           
  Misses        661      661           
  Partials      152      152           
Flag Coverage Δ
unittests 81.31% <ø> (ø)

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

@ty-dc ty-dc force-pushed the feature/uninstall branch 4 times, most recently from 953fa75 to b17898e Compare April 7, 2024 02:18
@ty-dc ty-dc added the pr/not-ready not ready for merging label Apr 7, 2024
@weizhoublue
Copy link
Collaborator

could it be tested in a E2E case ?


err = c.Delete(ctx, &item)
if err != nil {
return err
Copy link
Collaborator

Choose a reason for hiding this comment

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

for cleaning job, it should not be interrupted, and clean as much as possible

@ty-dc ty-dc force-pushed the feature/uninstall branch 6 times, most recently from e2440a5 to 06ebb91 Compare April 9, 2024 02:23
@ty-dc ty-dc removed the pr/not-ready not ready for merging label Apr 9, 2024
@ty-dc
Copy link
Collaborator Author

ty-dc commented Apr 10, 2024

Run codecov/[email protected]
  with:
    directory: ./
    files: coverage.out
    flags: unittests
    name: my-codecov-umbrella
    fail_ci_if_error: true
    verbose: true

should look like this:

Run codecov/[email protected]
  with:
    directory: ./
    files: coverage.out
    flags: unittests
    name: my-codecov-umbrella
    fail_ci_if_error: true
    verbose: true
    token: ***

}
}

return nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

中间有哪个清除失败了,最终返回错误,反应在 job 的 状态中

Copy link
Collaborator

Choose a reason for hiding this comment

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

@ty-dc ty-dc force-pushed the feature/uninstall branch 2 times, most recently from 8ca3e54 to d715c4d Compare April 11, 2024 06:48
if err != nil {
return fmt.Errorf("failed to update spiderEndpoint's: %v finalizers to be empty: %v ", &item, err)
}
logger.Sugar().Infof("succeeded to update spiderEndpoint's: %v finalizers to be empty", &item)
Copy link
Collaborator

Choose a reason for hiding this comment

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

succeeded to clean the finalizers of spiderEndpoint xxxx

@Icarus9913 Icarus9913 removed their request for review April 13, 2024 09:16
@@ -757,6 +757,10 @@ spiderpoolController:
## @param spiderpoolController.tls.auto.extraDnsNames extra DNS names of server cert for auto method
extraDnsNames: []

cleanup:
Copy link
Collaborator

Choose a reason for hiding this comment

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

mention it in the document of uninstalling

if err == nil {
err := c.Delete(ctx, mObj)
if err != nil {
return fmt.Errorf("failed to delete MutatingWebhookConfiguration: %v.", err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

卸载是尽最大可能删除东西,任何删除失败的动作,不要 return ,而是 日志后 continue 继续删除其他

@weizhoublue
Copy link
Collaborator

@cyclinder 现在垃圾资源的清除,除了 Spiderpool 本身,其它 项目 的垃圾资源 是否还需要 帮助删除 ?

@ty-dc ty-dc requested a review from windsonsea as a code owner April 15, 2024 07:31
@ty-dc ty-dc force-pushed the feature/uninstall branch 6 times, most recently from 477e449 to fa006c4 Compare April 15, 2024 08:13
Copy link
Collaborator

@windsonsea windsonsea left a comment

Choose a reason for hiding this comment

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

Headings can be shorter and better


Replace `<spiderpool-name>` with the name of the Spiderpool you want to uninstall and `<spiderpool-namespace>` with the namespace of the Spiderpool.

### In versions higher than 0.9.2
Copy link
Collaborator

Choose a reason for hiding this comment

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

Above v0.9.2

kubectl get spidercoordinators.spiderpool.spidernet.io -o name | wc -l
```

### In versions lower than 0.9.2
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
### In versions lower than 0.9.2
### Below v0.9.2


将 `<spiderpool-name>` 替换为要卸载的 Spiderpool 的名称,将 `<spiderpool-namespace>` 替换为 Spiderpool 所在的命名空间。

### 在高于 0.9.2 的版本
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
### 在高于 0.9.2 的版本
### 0.9.2 以上版本

kubectl get spidercoordinators.spiderpool.spidernet.io -o name | wc -l
```

### 在低于 0.9.2 的版本
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
### 在低于 0.9.2 的版本
### 0.9.2 以下版本

Copy link
Collaborator

@cyclinder cyclinder left a comment

Choose a reason for hiding this comment

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

Can you update your PR description to list all the resources you clean? I think we should clean up the below resources in order:

  1. All the CRD instances: IPPools,Subnets,SpiderMultusConfig...
  2. The CRD definitions.
  3. Pods that have not been completely deleted, Example sriov-network-config-daemon, see clean sriov pod #2822

@ty-dc
Copy link
Collaborator Author

ty-dc commented Apr 16, 2024

Can you update your PR description to list all the resources you clean? I think we should clean up the below resources in order:

  1. All the CRD instances: IPPools,Subnets,SpiderMultusConfig...
  2. The CRD definitions. CRD 定义。
  3. Pods that have not been completely deleted, Example sriov-network-config-daemon, see clean sriov pod #2822

updated,Step 2 Do it happily. But step 3, what if the customer installed it themselves? Is there any way we can know whether a resource like sirov was installed via spiderpool?


### 0.9.2 以上版本

在 0.9.2 之后引入了自动清理 Spiderpool 资源的功能,它通过 `spiderpoolController.cleanup.enabled` 配置项来启用,该值默认为 `true`,您可以通过如下方式验证与 Spiderpool 相关的资源数量是否自动被清理。
Copy link
Collaborator

@weizhoublue weizhoublue Apr 16, 2024

Choose a reason for hiding this comment

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

为什么是 0.9.2 , 而不是 下一个 0.10 什么的版本
这个也不会进 0.9.3

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@weizhoublue weizhoublue merged commit 97fb6c6 into spidernet-io:main Apr 22, 2024
48 of 49 checks passed
@ty-dc ty-dc mentioned this pull request Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release/feature-new release note for new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

run a clean-up job when uninstalling
4 participants