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

Fix: conflict while using gc policy and shared-resource policy concurrently #5330

Conversation

Somefive
Copy link
Collaborator

Signed-off-by: Somefive yd219913@alibaba-inc.com

Description of your changes

When one resource in an application is set to skipGC and being shared, the recycle process could have problems.

For sharing resource, controller will: Check if the application is the last only sharer. If not, just let the next sharer become the owner. If true, it will go on for the deletion.

For skipGC, controller will: Stop the normal deletion and only remove owner label.

So when two policy comes together, the owner label will be removed by the resource sharing label is not, which will leave the controller retry infinitely since the resource sharing label will let the controller treat the resource as not recycled completely.

This PR fixes it through adding additional sharer label removal for sharing resource recycle.

I have:

  • Read and followed KubeVela's contribution process.
  • Related Docs updated properly. In a new feature or configuration option, an update to the documentation is necessary.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

Special notes for your reviewer

@Somefive Somefive added backport release-1.7 add this label will automatically backport this PR to release-1.7 branch backport release-1.6 add this label will automatically backport this PR to release-1.6 branch labels Jan 13, 2023
@Somefive Somefive marked this pull request as draft January 13, 2023 05:34
@codecov
Copy link

codecov bot commented Jan 13, 2023

Codecov Report

Base: 61.12% // Head: 61.04% // Decreases project coverage by -0.07% ⚠️

Coverage data is based on head (72e54e5) compared to base (5ec3bd5).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5330      +/-   ##
==========================================
- Coverage   61.12%   61.04%   -0.08%     
==========================================
  Files         308      308              
  Lines       46773    46785      +12     
==========================================
- Hits        28589    28559      -30     
- Misses      15211    15251      +40     
- Partials     2973     2975       +2     
Flag Coverage Δ
apiserver-e2etests 32.24% <0.00%> (-0.04%) ⬇️
apiserver-unittests 36.20% <ø> (-0.03%) ⬇️
core-unittests 55.24% <100.00%> (-0.08%) ⬇️
e2e-multicluster-test 18.92% <100.00%> (+0.01%) ⬆️
e2e-rollout-tests 21.04% <0.00%> (-0.01%) ⬇️
e2etests 26.36% <0.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
pkg/resourcekeeper/gc.go 80.35% <100.00%> (+0.05%) ⬆️
pkg/addon/registry.go 38.65% <0.00%> (-12.61%) ⬇️
...es/policydefinition/policydefinition_controller.go 73.17% <0.00%> (-7.32%) ⬇️
pkg/apiserver/event/sync/convert.go 81.71% <0.00%> (-3.66%) ⬇️
pkg/multicluster/cluster_management.go 37.23% <0.00%> (-2.66%) ⬇️
pkg/apiserver/interfaces/api/addon.go 69.86% <0.00%> (-1.75%) ⬇️
pkg/addon/addon.go 63.33% <0.00%> (-1.25%) ⬇️
...ler/core.oam.dev/v1alpha2/application/generator.go 86.37% <0.00%> (-0.82%) ⬇️
pkg/apiserver/domain/service/addon.go 62.16% <0.00%> (-0.27%) ⬇️
pkg/apiserver/domain/service/application.go 58.48% <0.00%> (ø)
... and 6 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

…rently

Signed-off-by: Somefive <yd219913@alibaba-inc.com>
@Somefive Somefive force-pushed the fix/conflict-between-gc-shared-resource-policy branch from baf3cc7 to f8239be Compare January 13, 2023 06:26
@Somefive Somefive marked this pull request as ready for review January 13, 2023 06:26
Signed-off-by: Somefive <yd219913@alibaba-inc.com>
@Somefive Somefive merged commit 1e15e27 into kubevela:master Jan 13, 2023
@github-actions
Copy link

Backport failed for release-1.6, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git fetch origin release-1.6
git worktree add -d .worktree/backport-5330-to-release-1.6 origin/release-1.6
cd .worktree/backport-5330-to-release-1.6
git checkout -b backport-5330-to-release-1.6
ancref=$(git merge-base df3f134f12dcc1894f072527a3f91273c31e749b 72e54e5f9052a2cb17d2827b9b610a70a6431a59)
git cherry-pick -x $ancref..72e54e5f9052a2cb17d2827b9b610a70a6431a59

@github-actions
Copy link

Successfully created backport PR #5333 for release-1.7.

Somefive added a commit to Somefive/kubevela that referenced this pull request Jan 13, 2023
…rently (kubevela#5330)

* Fix: conflict while using gc policy and shared-resource policy concurrently

Signed-off-by: Somefive <yd219913@alibaba-inc.com>

* Fix: github ci

Signed-off-by: Somefive <yd219913@alibaba-inc.com>

Signed-off-by: Somefive <yd219913@alibaba-inc.com>
Somefive added a commit to Somefive/kubevela that referenced this pull request Jan 13, 2023
…rently (kubevela#5330)

* Fix: conflict while using gc policy and shared-resource policy concurrently

Signed-off-by: Somefive <yd219913@alibaba-inc.com>

* Fix: github ci

Signed-off-by: Somefive <yd219913@alibaba-inc.com>

Signed-off-by: Somefive <yd219913@alibaba-inc.com>
wonderflow pushed a commit that referenced this pull request Jan 13, 2023
…rently (#5330) (#5338)

* Fix: conflict while using gc policy and shared-resource policy concurrently

Signed-off-by: Somefive <yd219913@alibaba-inc.com>

* Fix: github ci

Signed-off-by: Somefive <yd219913@alibaba-inc.com>

Signed-off-by: Somefive <yd219913@alibaba-inc.com>

Signed-off-by: Somefive <yd219913@alibaba-inc.com>
zhaohuiweixiao pushed a commit to zhaohuiweixiao/kubevela that referenced this pull request Mar 7, 2023
…rently (kubevela#5330)

* Fix: conflict while using gc policy and shared-resource policy concurrently

Signed-off-by: Somefive <yd219913@alibaba-inc.com>

* Fix: github ci

Signed-off-by: Somefive <yd219913@alibaba-inc.com>

Signed-off-by: Somefive <yd219913@alibaba-inc.com>
@Somefive Somefive deleted the fix/conflict-between-gc-shared-resource-policy branch June 20, 2023 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport release-1.6 add this label will automatically backport this PR to release-1.6 branch backport release-1.7 add this label will automatically backport this PR to release-1.7 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants