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

Implement vineyard runtime engine and controller #3649

Merged

Conversation

dashanji
Copy link
Contributor

@dashanji dashanji commented Dec 18, 2023

Fixes #3528

Copy link

fluid-e2e-bot bot commented Dec 18, 2023

Hi @dashanji. Thanks for your PR.

I'm waiting for a fluid-cloudnative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@dashanji dashanji changed the title Implement vineyard runtime dev [WIP] Implement vineyard runtime dev Dec 18, 2023
@dashanji dashanji marked this pull request as draft December 18, 2023 08:42
@dashanji dashanji force-pushed the implement-vineyard-runtime-dev branch from 65d7f32 to 8dd8590 Compare December 28, 2023 12:02
@dashanji dashanji changed the title [WIP] Implement vineyard runtime dev Implement vineyard runtime engine and controller Dec 28, 2023
@dashanji dashanji marked this pull request as ready for review December 28, 2023 12:04
@dashanji dashanji force-pushed the implement-vineyard-runtime-dev branch from 8dd8590 to 72a8699 Compare December 28, 2023 12:12
Copy link

codecov bot commented Dec 28, 2023

Codecov Report

Attention: 459 lines in your changes are missing coverage. Please review.

Comparison is base (2414a25) 64.40% compared to head (ec2ef82) 64.47%.
Report is 2 commits behind head on master.

Files Patch % Lines
pkg/ddc/vineyard/shut_down.go 46.15% 55 Missing and 15 partials ⚠️
pkg/ddc/vineyard/health_check.go 74.58% 32 Missing and 14 partials ⚠️
pkg/ddc/vineyard/node.go 54.25% 32 Missing and 11 partials ⚠️
pkg/ddc/vineyard/transform.go 71.81% 25 Missing and 17 partials ⚠️
pkg/ddc/vineyard/master.go 69.04% 15 Missing and 11 partials ⚠️
pkg/ddc/vineyard/dataset.go 69.44% 13 Missing and 9 partials ⚠️
pkg/ddc/vineyard/transform_resources.go 72.83% 13 Missing and 9 partials ⚠️
pkg/ddc/vineyard/status.go 69.69% 12 Missing and 8 partials ⚠️
pkg/ddc/vineyard/ufs.go 0.00% 17 Missing ⚠️
pkg/ddc/vineyard/utils.go 84.40% 8 Missing and 9 partials ⚠️
... and 18 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3649      +/-   ##
==========================================
+ Coverage   64.40%   64.47%   +0.06%     
==========================================
  Files         444      471      +27     
  Lines       26797    28140    +1343     
==========================================
+ Hits        17258    18142     +884     
- Misses       7524     7844     +320     
- Partials     2015     2154     +139     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dashanji dashanji force-pushed the implement-vineyard-runtime-dev branch 2 times, most recently from 88e3956 to 7f51863 Compare December 29, 2023 02:47
@cheyang
Copy link
Collaborator

cheyang commented Dec 30, 2023

@dashanji Please fix the conflict. Thanks.

Makefile Outdated
CSI_IMG ?= ${IMG_REPO}/fluid-csi
LOADER_IMG ?= ${IMG_REPO}/fluid-dataloader
INIT_USERS_IMG ?= ${IMG_REPO}/init-users
WEBHOOK_IMG ?= ${IMG_REPO}/fluid-webhook
CRD_UPGRADER_IMG?= ${IMG_REPO}/fluid-crd-upgrader
GO_MODULE ?= off
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest keeping it as off for compatible with other runtime controllers.

@dashanji
Copy link
Contributor Author

dashanji commented Jan 2, 2024

@dashanji Please fix the conflict. Thanks.

ok.

@dashanji dashanji force-pushed the implement-vineyard-runtime-dev branch from 7f51863 to 9337d8b Compare January 2, 2024 02:47
@@ -0,0 +1,120 @@
/*
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you help keep the same format with the followings:

/*
Copyright 2023 The Fluid Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the advice, I have updated the lincense from 2023 to 2024.

@dashanji dashanji force-pushed the implement-vineyard-runtime-dev branch from e48a60c to bd81941 Compare January 2, 2024 07:12
@cheyang
Copy link
Collaborator

cheyang commented Jan 2, 2024

/test fluid-e2e

@@ -161,6 +176,8 @@ spec:
hostPath:
path: /runtime-mnt/vineyard/{{ .Release.Namespace }}/{{ $fullName }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think /runtime-mnt is configurable. Try to avoid hard code this directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make sense to me.

@@ -91,6 +91,9 @@ spec:
- --spill_upper_rate
- "{{ include "vineyard.spill.upperRate" . }}"
{{- end }}
- --metrics
Copy link
Member

Choose a reason for hiding this comment

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

Does it mean that vineyard reports metrics via exporter? But how vineyardd manage to find out which is the allocated exporter port?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does it mean that vineyard reports metrics via exporter?

By vineyardd itself. The --metrics field means vineyardd will print internal metrics info (only about vineyard object) to the stdout and the log_dir field means vineyard will store these metrics info under a directory.

But how vineyardd manage to find out which is the allocated exporter port?

vineyardd doesn't need to know the port, we have an external exporter to convert these logs (/var/log/vineyard) to metrics via https://github.com/fluid-cloudnative/fluid/pull/3649/files#diff-6109bb7b99b63ccc2d90ea9d7c1ca8dece4d3873aabfc77280196643e7f6593cR162.

Copy link
Member

@TrafalgarZZZ TrafalgarZZZ Jan 4, 2024

Choose a reason for hiding this comment

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

Thanks! Got it now. One more question is that, does Vineyardd automatically rotate its log messages? And what will happen if the external exporter fail over? Will the external exporter recover all the metrics from the all the logs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

does Vineyardd automatically rotate its log messages?

No, vineyardd will preserve all log messages.

And what will happen if the external exporter fail over?

It will convert all logs to metrics again.

Will the external exporter recover all the metrics from the all the logs?

Yes, from the log file.

Copy link
Member

@TrafalgarZZZ TrafalgarZZZ left a comment

Choose a reason for hiding this comment

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

I've also found some minor issue in the Vineyard helm chart, and I left some comments in the previous PR

return utils.RequeueIfError(errors.Wrap(err, "Unable to get ddc runtime"))
}
}
ctx.Runtime = runtime
Copy link
Member

Choose a reason for hiding this comment

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

Please also assign ctx.EngineImpl like the code here. Recently, we added a new field named ctx.EngineImpl to build ddc engine. You can see the PR description for more details.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks.

}

//2. Get the template value file
valueFile, err := os.CreateTemp(os.TempDir(), fmt.Sprintf("%s-%s-values.yaml", e.name, e.runtimeType))
Copy link
Member

Choose a reason for hiding this comment

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

Ditto. Recently change the temp file name using <e.name>-<e.engineImpl>-values.yaml. For vineyard, engineImpl should be the same with runtimeType, I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Get, thanks.

}

func (e *VineyardEngine) getConfigmapName() string {
return e.name + "-" + e.runtimeType + "-values"
Copy link
Member

Choose a reason for hiding this comment

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

Ditto. Better use e.engineImpl instead

}

func (e *VineyardEngine) transformTieredStore(runtime *datav1alpha1.VineyardRuntime) TieredStore {
quota := resource.MustParse("4Gi")
Copy link
Member

Choose a reason for hiding this comment

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

For vineyard users, How to set Vineyard's memory quota? And How to set spill quota and path in VineyardRuntime.spec.tieredstore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How to set Vineyard's memory quota?

  tieredstore:
    levels:
    - mediumtype: MEM
      quota: 4Gi

How to set spill quota and path in VineyardRuntime.spec.tieredstore?

  tieredstore:
    levels:
    - level: 0
      mediumtype: MEM
      quota: 4Gi
    - level: 1
      mediumtype: SSD
      quota: 10Gi
      volumeType: Hostpath
      path: /var/spill-path

Copy link
Member

Choose a reason for hiding this comment

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

Thx. I wonder why there is a constant MEM level with 4Gi in transformTieredStore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If users doesn't set the any tieredstore fields in the VineyardRuntime.spec, the 4Gi will be used as the default one.

Copy link
Member

Choose a reason for hiding this comment

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

OK, but here's something tricky. Now the code firstly value.TieredStore = e.transformTieredStore(runtime), and then calculates memory request of Vineyard workers according to runtimeInfo's GetTieredStoreInfo() in e.transformResourcesForWorker(). That makes an inconsistency when a default 4Gi MEM level is used. However, I do think it's a common problem for all the runtimes, so I think the code LGTM now. I will try to refactor the runtimeInfo code to make it clearer and more consistent. cc @cheyang

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make sense to me. I have fixed it in the latest commit and it will raise an error if the tieredStore of vineyard runtime is empty.

pkg/ddc/vineyard/transform.go Outdated Show resolved Hide resolved
@dashanji dashanji force-pushed the implement-vineyard-runtime-dev branch from a5908fa to e04d56c Compare January 4, 2024 11:22
@dashanji
Copy link
Contributor Author

dashanji commented Jan 5, 2024

Hi @cheyang @TrafalgarZZZ, could you please take a look at this? Thanks.


fuse:
image: vineyardcloudnative/mount-vineyard-socket
image: vineyardcloudnative/vineyard-fluid-mount
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about naming it to vineyard-fluid-fuse?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link

sonarcloud bot commented Jan 8, 2024

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

86 New issues
2 Security Hotspots
No data about Coverage
22.2% Duplication on New Code

See analysis details on SonarCloud

Copy link
Member

@TrafalgarZZZ TrafalgarZZZ left a comment

Choose a reason for hiding this comment

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

/lgtm
Thank you for the PR!

Copy link
Collaborator

@cheyang cheyang left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

Copy link

fluid-e2e-bot bot commented Jan 9, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cheyang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fluid-e2e-bot fluid-e2e-bot bot merged commit f913136 into fluid-cloudnative:master Jan 9, 2024
10 checks passed
@dashanji dashanji deleted the implement-vineyard-runtime-dev branch January 9, 2024 06:03
xliuqq pushed a commit to xliuqq/fluid that referenced this pull request Jan 17, 2024
)

* Expose metric for vineyard runtime.

Signed-off-by: Ye Cao <[email protected]>

* Add the rbac role and dockerfile for vineyard runtime.

Signed-off-by: Ye Cao <[email protected]>

* Add the vineyard runtime command for lanuching vineyard controller.

Signed-off-by: Ye Cao <[email protected]>

* Implement the vineyard engine and controller.

Signed-off-by: Ye Cao <[email protected]>

* Add the unit test for vineyard engine and controller.

Signed-off-by: Ye Cao <[email protected]>

* Fix the lint issues.

Signed-off-by: Ye Cao <[email protected]>

* Fix unit test errors.

Signed-off-by: Ye Cao <[email protected]>

* Turn off the golang module.

Signed-off-by: Ye Cao <[email protected]>

* Resolve conflicts.

Signed-off-by: Ye Cao <[email protected]>

* Format the licenses.

Signed-off-by: Ye Cao <[email protected]>

* Make the fuse dir configurable.

Signed-off-by: Ye Cao <[email protected]>

* Improve the helm chart of vineyard runtime and the vineyard engine.

Signed-off-by: Ye Cao <[email protected]>

* Delete the svc domain in the vineyard helm chart.

Signed-off-by: Ye Cao <[email protected]>

* Disable the vineyard metrics and change the image of vineyard-mount-socket to vineyard-fluid-mount.

Signed-off-by: Ye Cao <[email protected]>

* Change the vineyard fuse image from vineyard-fluid-mount to vineyard-fluid-fuse.

Signed-off-by: Ye Cao <[email protected]>

* Raise an error when the tieredStore of vineyard runtime is empty.

Signed-off-by: Ye Cao <[email protected]>

---------

Signed-off-by: Ye Cao <[email protected]>
xliuqq added a commit to xliuqq/fluid that referenced this pull request Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURES] Add the Proposal for Vineyard Runtime
3 participants