diseq / csi-rclone

CSI driver for rclone
Apache License 2.0
5 stars 1 forks source link

How to mount Google Drive and other drives that use a Token #3

Open Snake4life opened 3 years ago

Snake4life commented 3 years ago

Hi,

I cant get my Google Drive to work, I always get an error: error parsing rclone-pv.yaml: error converting YAML to JSON: yaml: line 21: did not find expected key

 apiVersion: v1
 kind: PersistentVolume
 metadata:
   name: pv-demo
   labels:
     name: pv-demo
 spec:
   accessModes:
   - ReadWriteMany
   capacity:
     storage: 10Gi
   storageClassName: rclone
   csi:
     driver: csi-rclone
     volumeHandle: data-id
     volumeAttributes:
       remote: "gdrive"
       RCLONE_DRIVE_CLIENT_ID: "<hidden>"
       RCLONE_DRIVE_CLIENT_SECRET: "<hidden>"
       RCLONE_DRIVE_SCOPE: "drive"
       RCLONE_DRIVE_TOKEN: "{"access_token":"<hidden>","token_type":"Bearer","refresh_token":"<hidden>","expiry":"2021-01-26T00:21:26.631264333+01:00"}"
       RCLONE_DRIVE_ROOT_FOLDER_ID: "<hidden>"

Could you please add support for the Access Token?

Send me your contact info (discord, mail, telegram) and I will be happy to provide you my google drive for testing.

diseq commented 3 years ago

Hi, using tokens certificate based login myself and should work. Your problem is related to escaping in yaml. You might try the following instead:

     volumeAttributes:
       remote: "gdrive"
       RCLONE_DRIVE_CLIENT_ID: "<hidden>"
       RCLONE_DRIVE_CLIENT_SECRET: "<hidden>"
       RCLONE_DRIVE_SCOPE: "drive"
       RCLONE_DRIVE_TOKEN: |
         {"access_token":"<hidden>","token_type":"Bearer","refresh_token":"<hidden>","expiry":"2021-01-26T00:21:26.631264333+01:00"}
       RCLONE_DRIVE_ROOT_FOLDER_ID: "<hidden>"

just a suggestion: you might try the command beforehand in the shell with rclone as debugging with a pv in kubernetes is a bit annoying.

diseq commented 3 years ago

i'm also working on to move the credentials to named secrets to make thinks a bit more secure (hope to merge soon).