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

Add Container Storage Interface (CSI) #13435

Merged
merged 11 commits into from
Jul 3, 2021

Conversation

Binyang2014
Copy link
Contributor

@Binyang2014 Binyang2014 commented May 18, 2021

What changes are proposed in this pull request?

This PR integrates Alluxio CSI from community maintained repo (https://github.com/Alluxio/alluxio-csi) to main repo, with further improvement

Why are the changes needed?

Original CSI repo is not as well curated and managed as the main repo.
Given we have more

Does this PR introduce any user facing changes?

Yes, see the following example

Deploy

Go to deploy folder, Run following commands:

kubectl apply -f csi-alluxio-driver.yml
kubectl apply -f csi-alluxio-daemon.yml

Example Nginx application

The /examples folder contains PersistentVolume, PersistentVolumeClaim and an nginx Pod mounting the alluxio volume under /data.

You will need to update the alluxio MASTER_HOST_NAME and the share information under volumeAttributes in alluxio-pv.yaml file to match your alluxio master configuration.

Run following commands to create nginx pod mounted with alluxio volume:

kubectl apply -f alluxio-pv.yml
kubectl apply -f alluxio-pvc.yml
kubectl apply -f nginx.yml

@alluxio-bot
Copy link
Contributor

Automated checks report:

  • Commits associated with Github account: PASS
  • PR title follows the conventions: FAIL
    • The title of the PR does not pass all the checks. Please fix the following issues:
      • First word of title ("Integral") is not an imperative verb. Please use one of the valid words

Some checks failed. Please fix the reported issues and reply 'alluxio-bot, check this please' to re-run checks.

@codecov-commenter
Copy link

codecov-commenter commented May 18, 2021

Codecov Report

Merging #13435 (1002c6a) into master (624d846) will increase coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #13435      +/-   ##
============================================
+ Coverage     43.66%   43.70%   +0.04%     
- Complexity     9061     9071      +10     
============================================
  Files          1384     1384              
  Lines         80308    80308              
  Branches       9768     9768              
============================================
+ Hits          35063    35097      +34     
+ Misses        42309    42276      -33     
+ Partials       2936     2935       -1     
Impacted Files Coverage Δ
...uxio/master/FaultTolerantAlluxioMasterProcess.java 48.95% <0.00%> (-8.34%) ⬇️
...on/src/main/java/alluxio/util/JvmPauseMonitor.java 76.92% <0.00%> (-2.20%) ⬇️
...main/java/alluxio/concurrent/jsr/ForkJoinPool.java 30.62% <0.00%> (-1.85%) ⬇️
...a/alluxio/master/file/DefaultFileSystemMaster.java 64.70% <0.00%> (+0.04%) ⬆️
...main/java/alluxio/concurrent/jsr/ForkJoinTask.java 5.92% <0.00%> (+0.24%) ⬆️
...ava/alluxio/multi/process/MultiProcessCluster.java 60.16% <0.00%> (+0.26%) ⬆️
...alluxio/master/journal/raft/RaftJournalSystem.java 64.33% <0.00%> (+0.48%) ⬆️
...e/common/src/main/java/alluxio/metrics/Metric.java 59.16% <0.00%> (+0.83%) ⬆️
...io/master/file/meta/InodeTreeBufferedIterator.java 76.63% <0.00%> (+0.93%) ⬆️
...luxio/exception/status/AlluxioStatusException.java 25.00% <0.00%> (+1.08%) ⬆️
... and 10 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 624d846...1002c6a. Read the comment docs.

@Binyang2014 Binyang2014 changed the title Integral CSI into alluxio repo integrate CSI into alluxio repo May 18, 2021
@Binyang2014
Copy link
Contributor Author

Binyang2014 commented May 18, 2021

List the requirements here

  • Move alluxio-csi as a module of alluxio repository
  • Implements the dynamic provisioning and generate csi related yaml files when using helm-generate.sh
  • Using an all-in-one image in whole alluxio. @maobaolong Will not implement in this PR, @apc999 For this, need to merge fuse image and alluxio image first

@Binyang2014 Binyang2014 changed the title integrate CSI into alluxio repo Integrate CSI into alluxio repo May 18, 2021
@alluxio-bot
Copy link
Contributor

Automated checks report:

  • Commits associated with Github account: PASS
  • PR title follows the conventions: PASS

All checks passed!

@Binyang2014 Binyang2014 marked this pull request as ready for review May 19, 2021 06:06
@Binyang2014
Copy link
Contributor Author

@maobaolong Please help to review.
I am not familiar with helm chart part, may missing some file changes

Copy link
Contributor

@maobaolong maobaolong left a comment

Choose a reason for hiding this comment

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

Thank you for bring alluxio-csi to alluxio repo, left some comments, please take a look.

integration/csi/Dockerfile Outdated Show resolved Hide resolved
@@ -0,0 +1,80 @@
# Alluxio CSI

This project implement contienr storage interface(https://github.com/container-storage-interface/spec) for Alluxio.
Copy link
Contributor

Choose a reason for hiding this comment

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

This project -> This module

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

integration/csi/alluxio/controllerserver.go Show resolved Hide resolved
)

const (
driverName = "alluxio"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a hardcode?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, driver name is hardcode. k8s will use this name to find correct csi-controller and node-plugin. And storage and driver should have one to one relationship.

command := exec.Command("/opt/alluxio/integration/fuse/bin/alluxio-fuse", args...)

masterConfig := ""
if masterHost, ok := req.GetVolumeContext()["alluxio.master.hostname"]; ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

How to specify a alluxio.master.hostname?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Under parameters filed of storage class
such as:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: alluxio
provisioner: alluxio
parameters:
  alluxio.master.hostname:  master_ip
volumeBindingMode: Immediate

But this can only be set in javaOptions filed. Add this option here just for backward compatibility

https://github.com/Alluxio/alluxio/blob/master/integration/fuse/bin/alluxio-fuse
*/

alluxioPath := req.GetVolumeContext()["alluxioPath"]
Copy link
Contributor

Choose a reason for hiding this comment

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

I would be better to have the following logic

  • Create an under storage space, for example ozone, s3, ceph bucket, or hdfs, cephfs folder.
  • Create an alluxio mount point to the new under storage space.

When NodeUnpublishVolume, clear the new under storage space and umount the mount point.

Copy link
Contributor Author

@Binyang2014 Binyang2014 Jun 1, 2021

Choose a reason for hiding this comment

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

I think ozone, s3, ceph is the under file system, only admin need to aware about this. So admin can create such folder in alluxio filesystem namespace, and mount different UFS. And provide correct storageClass such as: alluxio-ozon, alluxio-s3, alluxio-ceph.
For end user, if they want to use the storage, he/she can decide to use which storageClass or use many of them. And mount to different container path according to POD config

integration/csi/go.mod Show resolved Hide resolved
@@ -0,0 +1,481 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this file necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's auto generated, we should not change this file

{{ if .Values.csi.clientEnabled -}}
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to abstract the storageClass to an individual file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@Binyang2014
Copy link
Contributor Author

@maobaolong For end of line issue, if there no "\n" at the end of file, github will show:
image

@maobaolong
Copy link
Contributor

@Binyang2014 Sorry, got it, thanks for share this tip.

Copy link
Contributor

@LuQQiu LuQQiu left a comment

Choose a reason for hiding this comment

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

Left some minor comments, LGTM

@@ -0,0 +1,79 @@
# Alluxio CSI

This module implement contienr storage interface(https://github.com/container-storage-interface/spec) for Alluxio.
Copy link
Contributor

Choose a reason for hiding this comment

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

contienr -> container


## Requirements

Kubernetes 1.14 or higher, RBAC enbaled in API server.
Copy link
Contributor

Choose a reason for hiding this comment

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

Add the whole name and link for RBAC since it's a name quite unfamiliar for users include me

## Usage

### Deploy
Please use `helm-generate.sh` to generate related templates. All CSI related templates should under `integration/kubernetes/<deploy-mode>/csi` folder.
Copy link
Contributor

Choose a reason for hiding this comment

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

Add line between Deploy and Please


You can custmomize alluxio volumes via serveral configurations.

The options you can customized:
Copy link
Contributor

Choose a reason for hiding this comment

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

customize

| Options | Description |
| --- | --- |
| `alluxioPath` | The path in alluxio |
| `javaOptions` | The customized options which pass to fuse daemon |
Copy link
Contributor

Choose a reason for hiding this comment

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

which pass -> which will be passed

}

/*
Based on https://github.com/openshift/origin/blob/master/pkg/util/proc/reaper.go
Copy link
Contributor

Choose a reason for hiding this comment

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

this link cannot be opened, try using a permanent link instead of the master branch link

@Binyang2014
Copy link
Contributor Author

@LuQQiu @apc999.
Still has some items left.

  1. Currently, we don't build the CSI image and push it to docker-hub. So customers need to build the CSI image by themselves. We need to provide CSI image or integral csi into fuse image
  2. For helm chart part. May need more tests, and I want to make CSI as a deployment option. I am not sure if current implementation is correct

@maobaolong
Copy link
Contributor

@Binyang2014 If we can, I hope we can maintain an all-in-one alluxio image, it include alluxio main services, fuse and csi in the future. For this PR, it looks good now.

@LuQQiu
Copy link
Contributor

LuQQiu commented Jun 17, 2021

@Binyang2014 @maobaolong We plan to deprecate the alluxio-fuse image since the current alluxio docker image contains the fuse logics as well.
@Binyang2014 what's needed for alluxio docker image to include the CSI logics? will it have a large impact on the docker image size? Agreed with @maobaolong that we would be better to maintain a All-in-one image if the impact is acceptable.

@jiacheliu3 can you help review the helm-chart related code in this PR? and give @Binyang2014 some suggestions for how to test them out?

@Binyang2014
Copy link
Contributor Author

@LuQQiu We need to put CSI binary into image, it just about 13MB.

@LuQQiu
Copy link
Contributor

LuQQiu commented Jun 17, 2021

@Binyang2014 then it's totally acceptable to put it in the docker image. Are the CSI binaries included in this PR, or how can we build the CSI binaries?

@apc999
Copy link
Contributor

apc999 commented Jun 17, 2021

@jiacheliu3 can you take a look at the helmchart part?

@Binyang2014
Copy link
Contributor Author

@LuQQiu
Copy link
Contributor

LuQQiu commented Jun 18, 2021

@Binyang2014 can you help move the CSI DockerFile logics into Alluxio DockerFile in this PR or the future PRs and update the related documentations?

@Binyang2014
Copy link
Contributor Author

@Binyang2014 can you help move the CSI DockerFile logics into Alluxio DockerFile in this PR or the future PRs and update the related documentations?

Doc updated. Will create an other PR to put CSi bit into alluxio Dockerfile.

Copy link
Contributor

@jiacheliu3 jiacheliu3 left a comment

Choose a reason for hiding this comment

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

Thanks @Binyang2014 ! Sorry about the late review. My comments are majorly about parameterizing in the helm chart you added. I think it makes sense to be able to configure a few of them. I'm open to discussions :)

integration/csi/Dockerfile Show resolved Hide resolved
integration/csi/README.md Outdated Show resolved Hide resolved
heritage: {{ .Release.Service }}
role: alluxio-csi-controller
spec:
hostNetwork: true
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if there's a need to enable hostNetwork=false?

Comment on lines +18 to +19
attachRequired: false
podInfoOnMount: true
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if these should be parameterized?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These parameters used by developer. Admin/users don't need to take care

Binyang2014 and others added 2 commits June 30, 2021 18:27
Co-authored-by: Jiacheng Liu <jiacheliu3@gmail.com>
@Binyang2014
Copy link
Contributor Author

@jiacheliu3 Thanks for review, please take a look again.

Copy link
Contributor

@jiacheliu3 jiacheliu3 left a comment

Choose a reason for hiding this comment

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

Thanks @Binyang2014 ! Left a minor comment, LGTM. If you could resolve that minor comment that'd be even better :)

@Binyang2014
Copy link
Contributor Author

Thanks @Binyang2014 ! Left a minor comment, LGTM. If you could resolve that minor comment that'd be even better :)

Add comments for these fields. Thx

@LuQQiu
Copy link
Contributor

LuQQiu commented Jul 1, 2021

Error: 9.429 [ERROR] Errors:
Error: 9.429 [ERROR] alluxio.master.journal.raft.RaftJournalTest.gainPrimacyAfterCatchup
Error: 9.430 [ERROR] Run 1: RaftJournalTest.gainPrimacyAfterCatchup:390->promoteFollower:404 » Timeout Tim...
Error: 9.431 [ERROR] Run 2: RaftJournalTest.gainPrimacyAfterCatchup:390->promoteFollower:404 » Timeout Tim...
07:44:09.434 [INFO]
Error: 9.435 [ERROR] alluxio.master.journal.raft.RaftJournalTest.gainPrimacyAfterSuspend
Error: 9.435 [ERROR] Run 1: RaftJournalTest.gainPrimacyAfterSuspend:350->promoteFollower:404 » Timeout Tim...
Error: 9.435 [ERROR] Run 2: RaftJournalTest.gainPrimacyAfterSuspend:350->promoteFollower:404 » Timeout Tim...

@LuQQiu
Copy link
Contributor

LuQQiu commented Jul 1, 2021

@Binyang2014 Can you help merge master into your csi branch and update this PR? I doubt that the RaftJournalTest is already fixed in the master branch.

@apc999 apc999 changed the title Integrate CSI into alluxio repo Add Container Storage Interface (CSI) Jul 3, 2021
@apc999
Copy link
Contributor

apc999 commented Jul 3, 2021

alluxio-bot, merge this please

@alluxio-bot alluxio-bot merged commit 3ec7ef9 into Alluxio:master Jul 3, 2021
bzheng888 pushed a commit to bzheng888/alluxio that referenced this pull request Jul 24, 2021
## What changes are proposed in this pull request?

This PR integrates Alluxio CSI from community maintained repo
(https://github.com/Alluxio/alluxio-csi) to main repo, with further
improvement

## Why are the changes needed?

Original CSI repo is not as well curated and managed as the main repo.
Given we have more

## Does this PR introduce any user facing changes?

Yes, see the following example

### Deploy

Go to `deploy` folder, Run following commands:
```bash
kubectl apply -f csi-alluxio-driver.yml
kubectl apply -f csi-alluxio-daemon.yml
```

### Example Nginx application
The `/examples` folder contains `PersistentVolume`,
`PersistentVolumeClaim` and an nginx `Pod` mounting the alluxio volume
under `/data`.

You will need to update the alluxio `MASTER_HOST_NAME` and the share
information under `volumeAttributes` in `alluxio-pv.yaml` file to match
your alluxio master configuration.

Run following commands to create nginx pod mounted with alluxio volume:
```bash
kubectl apply -f alluxio-pv.yml
kubectl apply -f alluxio-pvc.yml
kubectl apply -f nginx.yml
```

pr-link: Alluxio#13435
change-id: cid-9f2d2c1b6723421861822388c73fb41e88a10e94
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.

8 participants