Skip to content

Commit

Permalink
SPDI-40020. Backport Support CSI start AlluxioFuse process in separat…
Browse files Browse the repository at this point in the history
…e pod

Making CSI launch a separate pod running AlluxioFuse process, instead of
launcing AlluxioFuse process in the CSI nodeserver container

If nodeserver container or node-plugin pod for any reason is down, we
lose Alluxio Fuse process and it's very cumbersome to bring it back.
With a separate Fuse pod, CSI pod won't affect Fuse process.

Solves Alluxio#14917

1. Removed `javaOptions` from csi section in `values.yaml`. Alluxio
properties in helm chart should be organized in one place, not in
`properties` and in `csi`.
2. Add property `mountInPod` in csi section. If set to `true`, Fuse
process is launched in the separate pod.

pr-link: Alluxio#15221
change-id: cid-b6897172e11f80618decbfdc0758423e71aa387e
  • Loading branch information
ssz1997 authored and haoning.sun committed May 23, 2022
1 parent 30e900d commit a787ee3
Show file tree
Hide file tree
Showing 16 changed files with 447 additions and 128 deletions.
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 @@ -1406,12 +1406,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 @@ -1429,11 +1429,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 @@ -1460,6 +1461,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)

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

0 comments on commit a787ee3

Please sign in to comment.