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: make addon init use the latest CUE addon template #4434

Merged
merged 8 commits into from
Jul 25, 2022

Conversation

charlie0129
Copy link
Member

@charlie0129 charlie0129 commented Jul 24, 2022

Signed-off-by: Charlie Chiang charlie_c_0129@outlook.com

Description of your changes

We now support using CUE in addon template #4401 (template.cue instead of template.yaml)

This PR makes vela addon init use this latest feature (generating template.cue).

Generating template.yaml is no longer supported.

This won't cause compatibility issues, since the users that are able to generate template.cue are also using a CLI version that can properly handle template.cue. Those who cannot handle template.cue are using a CLI version that can generate the legacy yaml addon format.

Directory structure:

sample-addon-cue/
├── definitions
│   └── mytrait.cue
├── metadata.yaml
├── parameter.cue
├── README.md
├── resources
│   └── myresource.cue
├── schemas
│   └── myschema.yaml
├── template.cue
└── views
    └── my-view.cue

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. (no permission to add label)

How has this code been tested

Special notes for your reviewer

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

codecov bot commented Jul 24, 2022

Codecov Report

Merging #4434 (f933043) into master (3e57246) will decrease coverage by 6.72%.
The diff coverage is 82.14%.

@@            Coverage Diff             @@
##           master    #4434      +/-   ##
==========================================
- Coverage   59.47%   52.74%   -6.73%     
==========================================
  Files         343      347       +4     
  Lines       34247    34415     +168     
==========================================
- Hits        20368    18152    -2216     
- Misses      11199    13838    +2639     
+ Partials     2680     2425     -255     
Flag Coverage Δ
apiserver-e2etests ?
apiserver-unittests 40.18% <ø> (+0.26%) ⬆️
core-unittests 56.47% <82.14%> (+0.02%) ⬆️
e2e-multicluster-test 19.69% <0.00%> (?)
e2e-rollout-tests 22.95% <ø> (+0.07%) ⬆️
e2etests 29.36% <ø> (+0.39%) ⬆️

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

Impacted Files Coverage Δ
pkg/addon/utils.go 71.57% <77.27%> (-0.59%) ⬇️
pkg/addon/init.go 82.27% <100.00%> (-0.18%) ⬇️
pkg/apiserver/domain/service/service.go 0.00% <0.00%> (-92.31%) ⬇️
...kg/apiserver/interfaces/api/assembler/v1/do2dto.go 0.00% <0.00%> (-90.08%) ⬇️
pkg/apiserver/domain/model/workflow.go 11.76% <0.00%> (-88.24%) ⬇️
pkg/apiserver/domain/model/cluster.go 14.28% <0.00%> (-85.72%) ⬇️
pkg/apiserver/domain/model/env.go 16.66% <0.00%> (-83.34%) ⬇️
pkg/apiserver/interfaces/api/velaql.go 4.16% <0.00%> (-83.34%) ⬇️
pkg/apiserver/event/sync/convert/convert.go 0.00% <0.00%> (-83.22%) ⬇️
pkg/apiserver/domain/model/target.go 20.00% <0.00%> (-80.00%) ⬇️
... and 138 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 3e57246...f933043. Read the comment docs.

Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
pkg/addon/init.go Outdated Show resolved Hide resolved
@wonderflow wonderflow added the backport release-1.5 add this label will automatically backport this PR to release-1.5 branch label Jul 25, 2022
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
return false, fmt.Errorf("no application in %s: %w", AppTemplateCueFileName, err)
}
return true, nil
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Member Author

@charlie0129 charlie0129 Jul 25, 2022

Choose a reason for hiding this comment

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

I figured out that if I were to Unmarshal to Application, it required all these files, otherwise it won't work. Since it only determines if it is a addon dir, just look for output keyword inside template.cue is enough.
What do you think?

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.

need to refactor after the new app render func

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>
@github-actions
Copy link

Successfully created backport PR #4456 for release-1.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport release-1.5 add this label will automatically backport this PR to release-1.5 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants