-
Notifications
You must be signed in to change notification settings - Fork 857
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: Addon support app template written by cuelang. #4401
Feat: Addon support app template written by cuelang. #4401
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4401 +/- ##
=======================================
Coverage 59.92% 59.92%
=======================================
Files 347 347
Lines 34281 34281
=======================================
Hits 20544 20544
Misses 10986 10986
Partials 2751 2751
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
1204157
to
a33bd6e
Compare
6ac41c0
to
9fc3f56
Compare
|
||
app.Name = addonutil.Addon2AppName(addon.Name) | ||
// force override the namespace defined vela with DefaultVelaNS,this value can be modified by Env | ||
app.SetNamespace(types.DefaultKubeVelaNS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering how can this value be modified with env?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we support vela addon enable --namespace x
now ? It's a TODO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is by design. All addon associated application in same name is more convenient to manage. But user still can set DEFAULT_VELA_NS
env to change this.
|
||
// This func can be used for addon render, supporting render app template and component. | ||
// Please notice the result will be stored in object parameter, so object must be a pointer type | ||
func (a addonCueTemplateRender) toObject(cueTemplate string, object interface{}) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func (a addonCueTemplateRender) toObject(cueTemplate string, object interface{}) error { | |
func (a addonCueTemplateRender) render(cueTemplate string) (*Application,error) { |
This function can only output Application cause you have specific logic inside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This func can be called by both render app and appCompnent, that's determined by input object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if so ,you should make the cuepath output
as an input, it can become much more common function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we need change this path? The appComponent and app defined in cue file are all in output
block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how would you deal with the case for "outputs"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the input parameter is cueTemplate file which contain one output and several outputs, and the outputs is unstructed object, I plan to add a input parameter value as aliaOutputs []unstructed.unstructure
which fetch all outpus object in this cueTemplate
if err != nil { | ||
return err | ||
} | ||
contextFile.WriteString(fmt.Sprintf("context: metadata: %s\n", string(metadataJSON))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will the metadataJSON be empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, empty meta will get {"name":"","version":"","description":"","icon":"","invisible":false}
9ef3e3a
to
5926964
Compare
Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com> refactor some codes Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com> WIP delete useless workflow Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com> add checklegacy addon Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com> refactor some logics Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com> fix panic test Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com> delete useless addon test Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com> fix empty clusterargs Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com> fix comments Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com> fix panic test Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com> add tests Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com> fix render tests Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com> fix checkdiff Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com> fix comments Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
5926964
to
95bedda
Compare
This pr support writing basic addon application template framework by cue, so addon-developer can define the final app with parameter.Will allow user define a
parameter.cue
file outsideresource
dir. All parameters defined in this file will affect resources inresources
dir andtemplate.cue
.So a new addon dir is like this:
Besides, this pr also dose such things:
deployTo.runtimeCluster=true
want to deploy to runtime clusters but still don't have a topology polocy, we assume it's a legacy addon, will attach a topology policy to this app, not two workflowSteps(deploy-local, deploy-all-runtime) as before.template.cue
.Description of your changes
Fixes #4283
I have:
make reviewable
to ensure this PR is ready for review.backport release-x.y
labels to auto-backport this PR if necessary.How has this code been tested
Special notes for your reviewer