Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Problem trying to use with gdrive #36

Closed
deadc opened this issue Nov 26, 2022 · 10 comments · Fixed by #38
Closed

Problem trying to use with gdrive #36

deadc opened this issue Nov 26, 2022 · 10 comments · Fixed by #38
Assignees
Labels
bug Something isn't working

Comments

@deadc
Copy link
Contributor

deadc commented Nov 26, 2022

First of all, nice project!

Im trying to use volume-syncing-controller with google drive type, but im getting error with token value.

PodFilesystemSync.yaml:
...
    env:
        REMOTE_TYPE: drive
        REMOTE_CLIENT_ID: xxx.apps.googleusercontent.com
        REMOTE_CLIENT_SECRET: GOCSPX-xxx
        REMOTE_TOKEN: '{"access_token":"xxx","token_type":"Bearer","refresh_token":"xxx","expiry":"2022-05-23T01:04:59.737000688Z"}'
        REMOTE_SCOPE: drive
...

And the output:

> kubectl logs -n internal -c volume-syncing-sidecar vaultwarden-59f586c868-zm7qk
Error: invalid argument "token = {\"access_token\":\"xxx\",\"token_type\":\"Bearer\",\"refresh_token\":\"xxx\",\"expiry\":\"2022-05-23T01:04:59.737000688Z\"}" for "-p, --param" flag: parse error on line 1, column 10: bare " in non-quoted-field
Usage:
  volume-syncing-controller sync-to-remote [flags]
  ....

Not sure if this a problem with rclone itself or volume-syncing-controller

@blackandred
Copy link
Contributor

Hi,

Thanks for the feedback, at first - volume-syncing-controller wasn't tested with Google Drive, but it should work if rclone supports it.

Could you please paste a full Pod yaml there? I'm curious what are the parameters set inside the image, maybe there is an escaping issue somewhere.

@blackandred
Copy link
Contributor

Ok, I have reproduced the issue - simply by exporting those environment variables in the shell and running outside Kubernetes (volume-syncing-controller can work without Kubernetes).

export REMOTE_TYPE=drive
export REMOTE_CLIENT_ID=xxx.apps.googleusercontent.com
export REMOTE_CLIENT_SECRET=GOCSPX-xxx
export REMOTE_TOKEN='{"access_token":"xxx","token_type":"Bearer","refresh_token":"xxx","expiry":"2022-05-23T01:04:59.737000688Z"}'
export REMOTE_SCOPE=drive

make build
./.build/volume-syncing-controller sync-to-remote
Error: invalid argument "token = {\"access_token\":\"xxx\",\"token_type\":\"Bearer\",\"refresh_token\":\"xxx\",\"expiry\":\"2022-05-23T01:04:59.737000688Z\"}" for "-p, --param" flag: parse error on line 1, column 10: bare " in non-quoted-field

@blackandred
Copy link
Contributor

Related issues in other OSS projects:
open-policy-agent/opa#2421
containers/podman#2582

@blackandred blackandred self-assigned this Nov 26, 2022
@blackandred blackandred added the bug Something isn't working label Nov 26, 2022
@blackandred
Copy link
Contributor

Its working for me initially - I will try to connect some Google Drive account to perform a complete test.

./.build/volume-syncing-controller sync-to-remote -v   
INFO[0000] Performing copy from './' to 'remote:/'      
2022/11/26 15:04:44 DEBUG : Setting --config "rclone.conf" from environment variable RCLONE_CONFIG="rclone.conf"
2022/11/26 15:04:44 DEBUG : rclone: Version "1.60.0" starting with parameters ["rclone" "copy" "--create-empty-src-dirs" "./" "remote:/" "-vv"]
2022/11/26 15:04:44 DEBUG : Creating backend with remote "./"
2022/11/26 15:04:44 DEBUG : Using config file from "/home/user/GolandProjects/volume-syncing-controller/rclone.conf"
2022/11/26 15:04:44 DEBUG : fs cache: renaming cache item "./" to be canonical "/home/user/GolandProjects/volume-syncing-controller"
2022/11/26 15:04:44 DEBUG : Creating backend with remote "remote:/"
2022/11/26 15:04:44 DEBUG : remote: Loaded invalid token from config file - ignoring
2022/11/26 15:04:44 DEBUG : remote: Token refresh failed try 1/5: oauth2: cannot fetch token: 401 Unauthorized
Response: {
  "error": "invalid_client",
  "error_description": "The OAuth client was not found."
}

@blackandred
Copy link
Contributor

blackandred commented Nov 26, 2022

I will leave this up to you to test it. I'm merging the PR and tagging a next RC release, in case there will be some issue with Google Drive itself, but not related to escaping please create a separate issue. In this issue please let me know if the escaping issue is still valid.

blackandred added a commit that referenced this issue Nov 26, 2022
…-gdrive

#36 - problem trying to use with gdrive: resolves escaping issues
@blackandred blackandred reopened this Nov 26, 2022
@deadc
Copy link
Contributor Author

deadc commented Nov 27, 2022

Hey!

Thanks for the quick response, I performed new tests and related to double quotes it's working normally now, thanks!

Another problem related to communication with the google api appeared, I opened a PR correcting it.

I believe we can close this issue.

@deadc deadc closed this as completed Nov 27, 2022
@deadc deadc reopened this Nov 27, 2022
@deadc
Copy link
Contributor Author

deadc commented Nov 27, 2022

Sorry!

I've found the same problem with double quotes using initContainer.

> kubectl logs -n internal vaultwarden-7cbc67d789-g65bw -c init-volume-restore
Error: invalid argument "token={\"access_token\":\"xxx\",\"token_type\":\"Bearer\",\"refresh_token\":\"xxx\",\"expiry\":\"2022-11-26T23:48:47.50611305-03:00\"}" for "-p, --param" flag: parse error on line 1, column 8: bare " in non-quoted-field
Usage:
  volume-syncing-controller remote-to-local-sync [flags]

edit: I took the liberty of opening another PR correcting the problem.

@blackandred
Copy link
Contributor

I have reviewed and merged your PRs, then tagged a new release after tests passed - v1.0.1-rc1

btw. I hope there will be a non-rc release till the end of the year 😄

@blackandred
Copy link
Contributor

Please let me know if I could close the issue, or close the issue if you are able to.

@blackandred blackandred added this to the Stable v1.0 version milestone Nov 27, 2022
@deadc
Copy link
Contributor Author

deadc commented Nov 27, 2022

All components seem to be working now. thanks!!

@deadc deadc closed this as completed Nov 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
2 participants