Skip to content

Commit 452345e

Browse files
Merge pull request #1 from ceresimaging/expose-rclone-rc-api
Expose rclone rc api to the cluster internal network
2 parents 2b7c449 + 3b9331a commit 452345e

File tree

10 files changed

+310
-21
lines changed

10 files changed

+310
-21
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v3.0.1
1+
v3.1-ceres

deploy/kubernetes/1.20/csi-controller-rbac.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,29 @@ roleRef:
6464
kind: ClusterRole
6565
name: external-controller-rclone
6666
apiGroup: rbac.authorization.k8s.io
67+
---
68+
# Add a Role for service management
69+
kind: Role
70+
apiVersion: rbac.authorization.k8s.io/v1
71+
metadata:
72+
name: csi-nodeplugin-rclone-service-role
73+
namespace: csi-rclone
74+
rules:
75+
- apiGroups: [""]
76+
resources: ["services"]
77+
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
78+
---
79+
# Add a RoleBinding to bind the role to the ServiceAccount
80+
kind: RoleBinding
81+
apiVersion: rbac.authorization.k8s.io/v1
82+
metadata:
83+
name: csi-nodeplugin-rclone-service-binding
84+
namespace: csi-rclone
85+
subjects:
86+
- kind: ServiceAccount
87+
name: csi-nodeplugin-rclone
88+
namespace: csi-rclone
89+
roleRef:
90+
kind: Role
91+
name: csi-nodeplugin-rclone-service-role
92+
apiGroup: rbac.authorization.k8s.io

deploy/kubernetes/1.20/csi-controller-rclone.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ spec:
4747
- name: socket-dir
4848
mountPath: /plugin
4949
- name: rclone
50-
image: ghcr.io/ceresimaging/csi-rclone:v3.0.1
50+
image: ghcr.io/ceresimaging/csi-rclone:v3.1-ceres
5151
args :
5252
- "/bin/csi-rclone-plugin"
5353
- "--nodeid=$(NODE_ID)"

deploy/kubernetes/1.20/csi-nodeplugin-rbac.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ rules:
2525
- apiGroups: [""]
2626
resources: ["events"]
2727
verbs: ["get", "list", "watch", "create", "update", "patch"]
28+
- apiGroups: [""]
29+
resources: ["services", "endpoints"]
30+
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
2831
---
2932
kind: ClusterRoleBinding
3033
apiVersion: rbac.authorization.k8s.io/v1

deploy/kubernetes/1.20/csi-nodeplugin-rclone.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ spec:
5151
capabilities:
5252
add: ["SYS_ADMIN"]
5353
allowPrivilegeEscalation: true
54-
image: ghcr.io/ceresimaging/csi-rclone:v3.0.1
54+
image: ghcr.io/ceresimaging/csi-rclone:v3.1-ceres
5555
args:
5656
- "/bin/csi-rclone-plugin"
5757
- "--nodeid=$(NODE_ID)"

deploy/kubernetes/1.20/csi-rclone-storageclass.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ volumeBindingMode: WaitForFirstConsumer
88
# You will need to delete storageclass to update this field
99
# provisioner: csi-rclone
1010
# parameters:
11+
# exposeRc: "true"
1112
# pathPattern: "${.PVC.namespace}/${.PVC.annotations.csi-rclone/storage-path}"

example/kubernetes/nginx-example.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Example of Static Provisioning with Persistent Volumes using Rclone CSI Driver
12
apiVersion: v1
23
kind: PersistentVolume
34
metadata:
@@ -9,7 +10,7 @@ spec:
910
- ReadWriteMany
1011
capacity:
1112
storage: 10Gi
12-
storageClassName: rclone
13+
storageClassName: ""
1314
csi:
1415
driver: csi-rclone
1516
volumeHandle: data-id
@@ -20,6 +21,7 @@ spec:
2021
s3-endpoint: "http://minio.minio:9000"
2122
s3-access-key-id: "ACCESS_KEY_ID"
2223
s3-secret-access-key: "SECRET_ACCESS_KEY"
24+
exposeRc: "true" # This enables the rclone RC API
2325
---
2426
apiVersion: v1
2527
kind: PersistentVolumeClaim
@@ -31,7 +33,7 @@ spec:
3133
resources:
3234
requests:
3335
storage: 10Gi
34-
storageClassName: rclone
36+
storageClassName: ""
3537
selector:
3638
matchLabels:
3739
name: data-rclone-example

example/kubernetes/nginx-pvc-example.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
# Example of Dynamic provisioning with PersistentVolumeClaim using rclone CSI driver
12
apiVersion: v1
23
kind: PersistentVolumeClaim
34
metadata:
45
name: data-rclone-example
56
annotations:
67
csi-rclone/storage-path: nginx
78
csi-rclone/umask: "022"
9+
csi-rclone/exposeRc: "true" # This creates a K8s service exposing the rclone RC API
810
spec:
911
accessModes:
1012
- ReadWriteMany

pkg/rclone/controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
119119
if strings.HasPrefix(key, "csi-rclone/") {
120120
key = strings.TrimPrefix(key, "csi-rclone/")
121121

122-
// Only allow some keys (umask, uid) to be passed to the volume context to avoid security issues
123-
if key == "umask" {
122+
// Only allow some keys (umask, uid, exposeRc) to be passed to the volume context to avoid security issues
123+
if key == "umask" || key == "exposeRc" {
124124
volumeContext[key] = value
125125
}
126126
}

0 commit comments

Comments
 (0)