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: support to sync the revision and the workflow status #4419

Merged
merged 6 commits into from
Jul 22, 2022

Conversation

barnettZQG
Copy link
Collaborator

Signed-off-by: barnettZQG barnett.zqg@gmail.com

Description of your changes

  1. Sync the application revision to the datastore, this is useful to back up the application configuration. But currently, only sync the application spec.
  2. Sync the workflow record to the datastore, users could resume the workflow via UI.
  3. Do not allow to change the inner labels via API. such as ux.oam.dev/from-namespace app.oam.dev/source-of-truth ux.oam.dev/synced-generation
  4. Optimized the logic during application synchronization.

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

Special notes for your reviewer

Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
@codecov
Copy link

codecov bot commented Jul 21, 2022

Codecov Report

Merging #4419 (01ef7ee) into master (181bc92) will increase coverage by 0.56%.
The diff coverage is 55.19%.

@@            Coverage Diff             @@
##           master    #4419      +/-   ##
==========================================
+ Coverage   59.38%   59.94%   +0.56%     
==========================================
  Files         342      347       +5     
  Lines       34115    34381     +266     
==========================================
+ Hits        20258    20611     +353     
+ Misses      11201    11024     -177     
- Partials     2656     2746      +90     
Flag Coverage Δ
apiserver-e2etests 27.59% <50.27%> (+0.33%) ⬆️
apiserver-unittests 39.89% <31.88%> (-0.15%) ⬇️
core-unittests 56.48% <ø> (+0.11%) ⬆️
e2e-multicluster-test 19.80% <0.00%> (?)
e2e-rollout-tests 22.25% <ø> (+0.05%) ⬆️
e2etests ?

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

Impacted Files Coverage Δ
pkg/apiserver/domain/model/application.go 86.41% <ø> (-4.39%) ⬇️
pkg/apiserver/domain/model/workflow.go 100.00% <ø> (ø)
pkg/apiserver/event/sync/cr2ux.go 36.98% <0.00%> (-0.33%) ⬇️
pkg/apiserver/domain/service/workflow.go 53.28% <25.37%> (-4.76%) ⬇️
pkg/apiserver/domain/service/application.go 58.58% <34.48%> (-0.24%) ⬇️
pkg/apiserver/event/sync/store.go 66.66% <75.00%> (+1.12%) ⬆️
pkg/apiserver/event/sync/convert/convert.go 81.02% <93.02%> (+5.48%) ⬆️
pkg/apiserver/domain/service/image.go 28.31% <100.00%> (ø)
pkg/apiserver/event/event.go 100.00% <100.00%> (ø)
pkg/apiserver/event/sync/cache.go 77.14% <100.00%> (ø)
... and 102 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 181bc92...01ef7ee. Read the comment docs.

Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
klog.ErrorS(err, "failed to get controller revision", "oam app name", appName, "workflow name", record.WorkflowName, "record name", record.Name)
var revision = &model.ApplicationRevision{AppPrimaryKey: record.AppPrimaryKey, Version: record.RevisionPrimaryKey}
if err := w.Store.Get(ctx, revision); err != nil {
log.Logger.Errorf("failed to get the application revision from database %s", err.Error())
Copy link
Member

Choose a reason for hiding this comment

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

Same setRecordTerminate here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If the application revision is not found, set the record status to failure.

Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
@barnettZQG barnettZQG merged commit 96ece00 into kubevela:master Jul 22, 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