diff --git a/cmd/sync-to-remote/main.go b/cmd/sync-to-remote/main.go index 5c9216a..cba35df 100644 --- a/cmd/sync-to-remote/main.go +++ b/cmd/sync-to-remote/main.go @@ -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") diff --git a/main.go b/main.go index d0164d9..aa26a91 100644 --- a/main.go +++ b/main.go @@ -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) @@ -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 } diff --git a/pkg/server/mutation/containers.go b/pkg/server/mutation/containers.go index 1f07e6f..581118d 100644 --- a/pkg/server/mutation/containers.go +++ b/pkg/server/mutation/containers.go @@ -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{