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

Feat: add pre-dispatch dryrun check #5277

Merged

Conversation

Somefive
Copy link
Collaborator

@Somefive Somefive commented Jan 5, 2023

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

Description of your changes

Previously, when application contains objects that should not be dispatched (like invalid resource, target cluster disconnected, authorization failed), the dispatch of the resources are recorded in ResourceTracker, which will trigger these resources to be recycled and state-kept afterwards. However, since these dispatch are not successful, we will encounter errors during gc or state-keep.

In PR #5266, we add vela delete -i command to make post fixes to ResourceTrackers available which means even if these invalid resources are recorded in the ResourceTracker, we can still provide a way for user to fix them.

This PR add pre-dispatch DryRun check for the to-dispatch resources before recording them into ResourceTrackers. Therefore, invalid resources will not be recorded if they are detected during the dryrun process. It will greatly reduce the possibility of recording not-dispatched resources into ResourceTrackers. In the case that dryrun does not successfully detected all invalid resources, user can still fall back to use vela delete -i to handle the issue.

Partially fixes #4700 & fixes #5191.

P.S. cluster-gateway is required to be upgraded to handle multi-cluster dryrun request.

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

@codecov
Copy link

codecov bot commented Jan 5, 2023

Codecov Report

Base: 61.21% // Head: 61.21% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (f4a2845) compared to base (360c9e2).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5277      +/-   ##
==========================================
- Coverage   61.21%   61.21%   -0.01%     
==========================================
  Files         307      307              
  Lines       46350    46356       +6     
==========================================
+ Hits        28375    28376       +1     
  Misses      15063    15063              
- Partials     2912     2917       +5     
Flag Coverage Δ
apiserver-e2etests 35.57% <ø> (-0.03%) ⬇️
apiserver-unittests 36.30% <ø> (ø)
core-unittests 55.15% <33.33%> (-0.05%) ⬇️
e2e-multicluster-test 19.01% <66.66%> (+0.01%) ⬆️
e2e-rollout-tests 20.73% <33.33%> (?)
e2etests 26.25% <100.00%> (+0.19%) ⬆️

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

Impacted Files Coverage Δ
pkg/features/controller_features.go 100.00% <ø> (ø)
pkg/resourcekeeper/dispatch.go 78.12% <100.00%> (+4.79%) ⬆️
pkg/addon/registry.go 38.65% <0.00%> (-12.61%) ⬇️
pkg/apiserver/interfaces/api/oam_application.go 59.18% <0.00%> (-5.11%) ⬇️
pkg/apiserver/event/sync/cr2ux.go 55.81% <0.00%> (-4.66%) ⬇️
...es/policydefinition/policydefinition_controller.go 73.17% <0.00%> (-3.66%) ⬇️
...tepdefinition/workflowstepdefinition_controller.go 77.64% <0.00%> (-3.53%) ⬇️
pkg/apiserver/domain/service/target.go 57.86% <0.00%> (-3.38%) ⬇️
pkg/apiserver/utils/bcode/bcode.go 51.11% <0.00%> (-2.23%) ⬇️
pkg/multicluster/virtual_cluster.go 76.19% <0.00%> (-1.10%) ⬇️
... and 15 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.

Signed-off-by: Somefive <yd219913@alibaba-inc.com>
@Somefive Somefive force-pushed the fix/add-dryrun-check-for-dispatch branch from 3e70fc6 to f4a2845 Compare January 5, 2023 08:41
Copy link
Collaborator

@barnettZQG barnettZQG left a comment

Choose a reason for hiding this comment

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

LGTM

@FogDong FogDong merged commit 693eb3c into kubevela:master Jan 6, 2023
callmeoldprince pushed a commit to callmeoldprince/kubevela that referenced this pull request Jan 6, 2023
Signed-off-by: Somefive <yd219913@alibaba-inc.com>

Signed-off-by: Somefive <yd219913@alibaba-inc.com>
barnettZQG pushed a commit to barnettZQG/kubevela that referenced this pull request Jan 30, 2023
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
Signed-off-by: Somefive <yd219913@alibaba-inc.com>

Signed-off-by: Somefive <yd219913@alibaba-inc.com>
@Somefive Somefive deleted the fix/add-dryrun-check-for-dispatch 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
None yet
Projects
None yet
4 participants