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: cli def alias support #4185

Merged
merged 1 commit into from Jun 18, 2022
Merged

Feat: cli def alias support #4185

merged 1 commit into from Jun 18, 2022

Conversation

zhiyu0729
Copy link
Contributor

Signed-off-by: Zhiyu Wang zhiyuwang.newbis@gmail.com

Description of your changes

User can use alias metadata in cue.

Fixes #

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

go run cmd/plugin/main.go def render test.cue
go run cmd/plugin/main.go def get test-trait

test: {
	type:  "trait"
	alias: "可以加上中文别名"
}

Special notes for your reviewer

The alias field can also be placed in the annotation, but I think it's better as a native field.

@codecov
Copy link

codecov bot commented Jun 15, 2022

Codecov Report

Merging #4185 (4e7af61) into master (27ec48b) will decrease coverage by 1.46%.
The diff coverage is 38.63%.

❗ Current head 4e7af61 differs from pull request most recent head 6c2b835. Consider uploading reports for the commit 6c2b835 to get more accurate results

@@            Coverage Diff             @@
##           master    #4185      +/-   ##
==========================================
- Coverage   60.33%   58.86%   -1.47%     
==========================================
  Files         330      331       +1     
  Lines       31938    31974      +36     
==========================================
- Hits        19269    18823     -446     
- Misses      10164    10648     +484     
+ Partials     2505     2503       -2     
Flag Coverage Δ
apiserver-unittests 35.35% <13.51%> (+0.05%) ⬆️
core-unittests 54.92% <34.09%> (-0.09%) ⬇️
e2e-multicluster-test 20.04% <9.09%> (+0.09%) ⬆️
e2e-rollout-tests 22.32% <40.00%> (+0.03%) ⬆️
e2etests ?

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

Impacted Files Coverage Δ
pkg/velaql/parse.go 65.67% <0.00%> (-26.00%) ⬇️
pkg/workflow/tasks/template/load.go 75.00% <0.00%> (-2.42%) ⬇️
pkg/velaql/view.go 68.29% <37.50%> (-2.76%) ⬇️
pkg/definition/definition.go 74.40% <71.42%> (-0.09%) ⬇️
pkg/resourcekeeper/delete.go 73.33% <100.00%> (+0.91%) ⬆️
pkg/resourcekeeper/dispatch.go 76.00% <100.00%> (+0.48%) ⬆️
pkg/resourcekeeper/utils.go 100.00% <100.00%> (ø)
pkg/workflow/tasks/discover.go 71.52% <100.00%> (-10.72%) ⬇️
.../manualscalertrait/manualscalertrait_controller.go 11.53% <0.00%> (-55.77%) ⬇️
.../core.oam.dev/v1beta1/componentdefinition_types.go 0.00% <0.00%> (-50.00%) ⬇️
... and 50 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 27ec48b...6c2b835. Read the comment docs.

@@ -45,6 +45,8 @@ import (
const (
// DescriptionKey the key for accessing definition description
DescriptionKey = "definition.oam.dev/description"
// AliasKey the key for accessing definition alias
AliasKey = "definition.oam.dev/alias"
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's align the key with where it's used

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lost in cli args, fixed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

does velaux apiserver use this alias? @barnettZQG

Copy link
Contributor Author

Choose a reason for hiding this comment

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

currently not, but we can use it later

Copy link
Collaborator

Choose a reason for hiding this comment

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

It should be used somewhere or it's meanless.

Signed-off-by: Zhiyu Wang <zhiyuwang.newbis@gmail.com>
@Somefive
Copy link
Collaborator

Is this alias used in any other places? Like vela def list? Or kubectl get TraitDefintion?

@zhiyu0729
Copy link
Contributor Author

We're currently using aliases to show our preferred naming on ux instead of dns-formatted english, which is a great experience.

@wonderflow
Copy link
Collaborator

wonderflow commented Jun 16, 2022

We're currently using aliases to show our preferred naming on ux instead of dns-formatted english, which is a great experience.

Yes, you can also give that experience in vela def list , vela trait, and vela component.

@Somefive
Copy link
Collaborator

We're currently using aliases to show our preferred naming on ux instead of dns-formatted english, which is a great experience.

Okay, I recommend to make this alias also available in vela def list, vela trait and other related commands. But it does not necessarily to be done in this PR. We can leave it for future work.

@zhiyu0729
Copy link
Contributor Author

Yes, it can also be used in vela def get or list, but I'm not sure if there is such a case, maybe we can add when needed

@wonderflow wonderflow merged commit e572235 into kubevela:master Jun 18, 2022
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.

None yet

3 participants