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 more detailed output for vela addon status #3876

Merged
merged 30 commits into from
May 19, 2022

Conversation

charlie0129
Copy link
Member

@charlie0129 charlie0129 commented May 12, 2022

Description of your changes

Fixes #3860

vela addon status now shows more detailed info.

Screenshots

Before

Screen Shot 2022-05-12 at 11 12 48 PM

After
  • If an addon is installed, and it also exists in the registry:

    • non-verbose output
      Screen Shot 2022-05-19 at 2 56 00 PM
    • verbose output
      Screen Shot 2022-05-19 at 2 56 09 PM
  • If an addon is not installed, but it does exist in the registry:

    • non-verbose output
      Screen Shot 2022-05-19 at 2 56 23 PM
    • verbose output
      Screen Shot 2022-05-19 at 2 56 36 PM
  • If an addon is installed, but it does not exist in the registry:

    • non-verbose output
      Screen Shot 2022-05-19 at 2 56 59 PM
    • verbose output
      Screen Shot 2022-05-19 at 2 57 11 PM
  • If an addon is not installed, nor does it exist in the registry:

    • non-verbose output (since it does not connect to network when -v/--verbose is off, it is not possible to know whether this addon is in registry, so, only disabled is shown)
      Screen Shot 2022-05-19 at 2 57 49 PM
    • verbose output (now we check the registry to know that this addon does not exist, an error will be returned. It is handled by upstream error handlers, and return code will not be 0, indicating an error:
      Screen Shot 2022-05-19 at 2 57 41 PM

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

Relevant unit tests have been added, which will test the four situations above.

Unit tests for helper functions have been created as well.

Special notes for your reviewer

Also prettify output

Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
if a local addon has been installed, the AVAILABLE-VERSIONS column of the registry one will not truncate. this commit fixes that.

Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Limit Description length when using `addon list`

Use simpler method to get addon info

Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
…here

Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
…egistry

Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
@codecov
Copy link

codecov bot commented May 12, 2022

Codecov Report

Merging #3876 (149c2ab) into master (20f1d54) will increase coverage by 0.09%.
The diff coverage is 81.11%.

@@            Coverage Diff             @@
##           master    #3876      +/-   ##
==========================================
+ Coverage   64.12%   64.22%   +0.09%     
==========================================
  Files         312      316       +4     
  Lines       29692    30453     +761     
==========================================
+ Hits        19039    19557     +518     
- Misses       8194     8369     +175     
- Partials     2459     2527      +68     
Flag Coverage Δ
apiserver-unittests 35.05% <18.88%> (-0.17%) ⬇️
core-unittests 55.89% <81.11%> (-0.77%) ⬇️
e2e-multicluster-test 27.04% <0.00%> (+0.42%) ⬆️
e2e-rollout-tests 23.19% <ø> (-0.38%) ⬇️
e2etests 30.27% <ø> (-1.00%) ⬇️

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

Impacted Files Coverage Δ
pkg/addon/error.go 16.66% <ø> (ø)
pkg/addon/helper.go 69.27% <80.00%> (+7.20%) ⬆️
pkg/addon/versioned_registry.go 68.47% <100.00%> (+6.40%) ⬆️
pkg/cmd/factory.go 63.15% <0.00%> (-36.85%) ⬇️
pkg/apiserver/rest/usecase/converter.go 56.75% <0.00%> (-34.91%) ⬇️
pkg/resourcekeeper/statekeep.go 46.80% <0.00%> (-27.11%) ⬇️
pkg/utils/k8s.go 74.46% <0.00%> (-14.11%) ⬇️
...tepdefinition/workflowstepdefinition_controller.go 69.14% <0.00%> (-7.45%) ⬇️
pkg/apiserver/sync/store.go 55.00% <0.00%> (-4.00%) ⬇️
pkg/workflow/providers/multicluster/deploy.go 79.77% <0.00%> (-2.95%) ⬇️
... and 42 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20f1d54...149c2ab. Read the comment docs.

Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
pkg/addon/helper.go Outdated Show resolved Hide resolved
… to get addon status

Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
@wonderflow
Copy link
Collaborator

wonderflow commented May 14, 2022

If an addon is not installed, nor does it exist in the registry:

Why not show the addon is not existed in this case?

For other cases, this PR is really really great! 👍

merge(wholePackage)
}
} else {
meta, err := r.ListAddonMeta()
Copy link
Collaborator

Choose a reason for hiding this comment

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

will it use cache here? I'm not sure if the performance will be very bad here. \cc @wangyikewxgm

Maybe, we can downgrade the experience to the old mode if the registry is not versioned.

Copy link
Member Author

@charlie0129 charlie0129 May 19, 2022

Choose a reason for hiding this comment

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

it is only called when

  1. vela cli
  2. verbose is on (default is off)
  3. non-versioned registry is used

So the user must explicitly say "hey I need detailed info", otherwise this code won't be executed. It think the performance here is not a big deal (with local registries, no noticeable delay when using cli).

references/cli/addon.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@wonderflow wonderflow left a comment

Choose a reason for hiding this comment

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

generally LGTM, ping @wangyikewxgm for review, mainly about the performance.

We should keep the vela addon status command response quickly.

@charlie0129
Copy link
Member Author

Why not show the addon is not existed in this case?

Great suggestion, which will make the output more informative to the user.

Will implement it!

… the registry

Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
…erflow

Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
@wangyikewxgm
Copy link
Collaborator

@wonderflow The main costs is fetching whole addon package. Because user cannot get knowledge of the parameter info about this addon by vela cli before, so I design this feature. Please note that the GetAddonStatus in helper will be used in apiserver and cli, it must be quickly @charlie0129 . So I suggest add --verbose flag in vela addon status, if true cli will fetch whole package and show the parameter info, otherwise won't. The apiserver calls this func needn't fetch the whole package.

@charlie0129
Copy link
Member Author

@wonderflow The main costs is fetching whole addon package. Because user cannot get knowledge of the parameter info about this addon by vela cli before, so I design this feature. Please note that the GetAddonStatus in helper will be used in apiserver and cli, it must be quickly @charlie0129 . So I suggest add --verbose flag in vela addon status, if true cli will fetch whole package and show the parameter info, otherwise won't. The apiserver calls this func needn't fetch the whole package.

Yes, that is why I worried about the performance issue at first. But now GetAddonStatus doesn't get the whole package. It just checks current parameters from secrets, which (I think) is relatively fast. The actual process of getting the whole package is in generateAddonInfo, which is called only when vela addon status is executed.

@wangyikewxgm
Copy link
Collaborator

@wonderflow The main costs is fetching whole addon package. Because user cannot get knowledge of the parameter info about this addon by vela cli before, so I design this feature. Please note that the GetAddonStatus in helper will be used in apiserver and cli, it must be quickly @charlie0129 . So I suggest add --verbose flag in vela addon status, if true cli will fetch whole package and show the parameter info, otherwise won't. The apiserver calls this func needn't fetch the whole package.

Yes, that is why I worried about the performance issue at first. But now GetAddonStatus doesn't get the whole package. It just checks current parameters from secrets, which (I think) is relatively fast. The actual process of getting the whole package is in generateAddonInfo, which is called only when vela addon status is executed.

Please be aware that if the network is too slow to get the whole addon package from registry, user should still check the addon status quickly, this is why I suggest show detail info only when verbose flag is true.

@charlie0129
Copy link
Member Author

So I suggest add --verbose flag in vela addon status

Good idea. Will be implemented!

Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
…addon is not installed, but it does exist in the registry

Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Copy link
Collaborator

@wonderflow wonderflow left a comment

Choose a reason for hiding this comment

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

great job!

Copy link
Collaborator

@Somefive Somefive left a comment

Choose a reason for hiding this comment

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

Fantastic work!

Copy link
Collaborator

@wangyikewxgm wangyikewxgm left a comment

Choose a reason for hiding this comment

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

LGTM

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

Successfully merging this pull request may close these issues.

[Feature] vela addon status shows more detail info.
5 participants