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

Commit

Permalink
Merge pull request #38 from riotkit-org/36-problem-trying-to-use-with…
Browse files Browse the repository at this point in the history
…-gdrive

#36 - problem trying to use with gdrive: resolves escaping issues
  • Loading branch information
blackandred authored Nov 26, 2022
2 parents 0a008e1 + 445653b commit c5f2627
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cmd/sync-to-remote/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func NewSyncToRemoteCommand() *cobra.Command {
command.Flags().BoolVarP(&noTemplate, "no-template", "", false, "Disables rendering of the rclone configuration file")
command.Flags().StringVarP(&app.srcPath, "src", "s", "./", "Local path to copy files from")
command.Flags().StringVarP(&app.destPath, "dst", "d", "/", "Target path")
command.Flags().StringSliceVarP(&app.remoteParams, "param", "p", []string{}, "List of key=value settings for remote e.g. -p 'type=s3' -p 'provider=Minio' -p 'access_key_id=AKIAIOSFODNN7EXAMPLE'")
command.Flags().StringSliceVarP(&app.encryptParams, "enc-param", "e", []string{}, "List of key=value settings for remote e.g. -p 'remote=remote:testbucket' -p 'password=xxxxxxxx'")
command.Flags().StringArrayVarP(&app.remoteParams, "param", "p", []string{}, "List of key=value settings for remote e.g. -p 'type=s3' -p 'provider=Minio' -p 'access_key_id=AKIAIOSFODNN7EXAMPLE'")
command.Flags().StringArrayVarP(&app.encryptParams, "enc-param", "e", []string{}, "List of key=value settings for remote e.g. -p 'remote=remote:testbucket' -p 'password=xxxxxxxx'")
command.Flags().StringVarP(&app.SchedulerExpression, "schedule", "", "", "Set to a valid crontab-like expression to schedule synchronization periodically")
command.Flags().BoolVarP(&noDelete, "no-delete", "x", true, "Don't delete files in remote filesystem (may be dangerous if wrong path specified)")
command.Flags().BoolVarP(&app.ForceSync, "force-even-if-remote-would-be-cleared", "f", true, "Force synchronize, even if it would mean to remove all files from remote")
Expand Down
7 changes: 4 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ func main() {
}

// prepareArgs Collects all REMOTE_xxx, ENCRYPTED_xxx environment variables and changes to "-p xxx=yyy" and "-e xxx=yyy"
// That makes easier to use in Kubernetes and in Docker
//
// e.g. REMOTE_ACCESS_KEY_ID=123456 - will convert to access_key_id=123456 under section [remote]
// That makes easier to use in Kubernetes and in Docker
//
// e.g. REMOTE_ACCESS_KEY_ID=123456 - will convert to access_key_id=123456 under section [remote]
func prepareArgs(args []string) []string {
for _, env := range os.Environ() {
pair := strings.SplitN(env, "=", 2)
Expand All @@ -46,7 +47,7 @@ func appendVar(args []string, prefix string, switchName string, envName string,
name := strings.ToLower(namePair[1])

args = append(args, switchName)
args = append(args, name+" = "+value)
args = append(args, name+"="+value)

return args
}
3 changes: 1 addition & 2 deletions pkg/server/mutation/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ func createContainer(isInitContainer bool, containerName string, pod *corev1.Pod
VolumeMounts: mergeVolumeMounts(pod.Spec.Containers, params.LocalPath),
// VolumeDevices: nil,
ImagePullPolicy: "Always",

// lifecycle hook allows to perform a last synchronization before the Pod will be terminated
}

if !isInitContainer {
// lifecycle hook allows to perform a last synchronization before the Pod will be terminated
container.Lifecycle = &corev1.Lifecycle{
PreStop: &corev1.LifecycleHandler{
Exec: &corev1.ExecAction{
Expand Down

0 comments on commit c5f2627

Please sign in to comment.