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

Support CSI start AlluxioFuse process in separate pod #15221

Merged
merged 18 commits into from
Apr 12, 2022
Merged
16 changes: 11 additions & 5 deletions docs/en/deploy/Running-Alluxio-On-Kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -1473,12 +1473,12 @@ Here are some common properties that you can customize:
<td>The path in Alluxio which will be mounted</td>
</tr>
<tr>
<td>mountPath</td>
<td>The path that Alluxio will be mounted to in the application container</td>
<td>mountInPod</td>
<td>Set to true to launch Fuse process in an alluxio-fuse pod. Otherwise in the same container as nodeserver</td>
</tr>
<tr>
<td>javaOptions</td>
<td>The customized options which will be passes to fuse daemon</td>
<td>mountPath</td>
<td>The path that Alluxio will be mounted to in the application container</td>
</tr>
<tr>
<td>mountOptions</td>
Expand All @@ -1496,11 +1496,12 @@ Modify or add any configuration properties as required, then create the respecti
$ mv alluxio-csi-controller-rbac.yaml.template alluxio-csi-controller-rbac.yaml
$ mv alluxio-csi-controller.yaml.template alluxio-csi-controller.yaml
$ mv alluxio-csi-driver.yaml.template alluxio-csi-driver.yaml
$ mv alluxio-csi-fuse-configmap.yaml.template alluxio-csi-fuse-configmap.yaml
$ mv alluxio-csi-nodeplugin.yaml.template alluxio-csi-nodeplugin.yaml
```
Then run
```console
$ kubectl apply -f alluxio-csi-controller-rbac.yaml -f alluxio-csi-controller.yaml -f alluxio-csi-driver.yaml -f alluxio-csi-nodeplugin.yaml
$ kubectl apply -f alluxio-csi-controller-rbac.yaml -f alluxio-csi-controller.yaml -f alluxio-csi-driver.yaml -f alluxio-csi-fuse-configmap.yaml -f alluxio-csi-nodeplugin.yaml
```
to deploy CSI-related services.

Expand All @@ -1527,6 +1528,11 @@ $ kubectl apply -f alluxio-pvc-static.yaml
```
to deploy the resources.

Note: If `mountInPod` is set to `true`, in `alluxio-pv.yaml`, the value of `spec.csi.volumeHandle`
needs to be unique for CSI to identify different volumes. If the values of `volumeHundle` of two
PVs are the same, CSI would regard them as the same volume, and thus may not launch Fuse pod,
affecting the business pods.

{% endnavtab %}
{% navtab Dynamic Volume Provisioning %}

Expand Down
5 changes: 4 additions & 1 deletion integration/docker/csi/alluxio/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ type controllerServer struct {
*csicommon.DefaultControllerServer
}

/*
* If dynamic provisioning, CreateVolume() is called when the pvc is created and matches one of the storageclass.
*/

func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
volumeID := sanitizeVolumeID(req.GetName())

Expand Down Expand Up @@ -122,7 +126,6 @@ func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
glog.V(3).Infof("Invalid delete volume req: %v", req)
return nil, err
}
glog.V(4).Infof("Deleting volume %s", volumeID)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't do anything here. The log is misleading.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does the returned value not trigger a deletion? If so why is the return type not a CreateVolumeResponse?
return &csi.DeleteVolumeResponse{}, nil

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually the returned value will trigger the deletion of the pv. However that is not happening inside this function, so logging should also not be here. Plus we are not removing any data stored in Alluxio


return &csi.DeleteVolumeResponse{}, nil
}
Expand Down
11 changes: 8 additions & 3 deletions integration/docker/csi/alluxio/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog"
csicommon "github.com/kubernetes-csi/drivers/pkg/csi-common"
"k8s.io/client-go/kubernetes"
)

const (
Expand All @@ -23,11 +24,13 @@ const (
)

type driver struct {
csiDriver *csicommon.CSIDriver
nodeId, endpoint string
csiDriver *csicommon.CSIDriver
endpoint string
client kubernetes.Clientset
nodeId string
}

func NewDriver(nodeID, endpoint string) *driver {
func NewDriver(nodeID, endpoint string, client kubernetes.Clientset) *driver {
glog.Infof("Driver: %v version: %v", driverName, version)
csiDriver := csicommon.NewCSIDriver(driverName, version, nodeID)
csiDriver.AddControllerServiceCapabilities([]csi.ControllerServiceCapability_RPC_Type{csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME})
Expand All @@ -37,6 +40,7 @@ func NewDriver(nodeID, endpoint string) *driver {
nodeId: nodeID,
endpoint: endpoint,
csiDriver: csiDriver,
client: client,
}
}

Expand All @@ -49,6 +53,7 @@ func (d *driver) newNodeServer() *nodeServer {
return &nodeServer{
nodeId: d.nodeId,
DefaultNodeServer: csicommon.NewDefaultNodeServer(d.csiDriver),
client: d.client,
}
}

Expand Down
Loading