Skip to content

Commit 189f5f0

Browse files
Merge pull request #18599 from fbac/rsync-compression
Add --compress option to oc rsync
2 parents a7199cf + 91aef73 commit 189f5f0

File tree

5 files changed

+14
-1
lines changed

5 files changed

+14
-1
lines changed

contrib/completions/bash/oc

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contrib/completions/zsh/oc

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/oc/cli/cmd/rsync/copyrsync.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type rsyncStrategy struct {
3030
}
3131

3232
// rshExcludeFlags are flags that are passed to oc rsync, and should not be passed on to the underlying command being invoked via oc rsh.
33-
var rshExcludeFlags = sets.NewString("delete", "strategy", "quiet", "include", "exclude", "progress", "no-perms", "watch")
33+
var rshExcludeFlags = sets.NewString("delete", "strategy", "quiet", "include", "exclude", "progress", "no-perms", "watch", "compress")
3434

3535
func newRsyncStrategy(f *clientcmd.Factory, c *cobra.Command, o *RsyncOptions) (copyStrategy, error) {
3636
// Determine the rsh command to pass to the local rsync command

pkg/oc/cli/cmd/rsync/rsync.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ type RsyncOptions struct {
7979
Quiet bool
8080
Delete bool
8181
Watch bool
82+
Compress bool
8283
SuggestedCmdUsage string
8384

8485
RsyncInclude []string
@@ -122,6 +123,8 @@ func NewCmdRsync(name, parent string, f *clientcmd.Factory, out, errOut io.Write
122123
cmd.Flags().BoolVar(&o.RsyncProgress, "progress", false, "If true, show progress during transfer")
123124
cmd.Flags().BoolVar(&o.RsyncNoPerms, "no-perms", false, "If true, do not transfer permissions")
124125
cmd.Flags().BoolVarP(&o.Watch, "watch", "w", false, "Watch directory for changes and resync automatically")
126+
cmd.Flags().BoolVar(&o.Compress, "compress", false, "compress file data during the transfer")
127+
125128
return cmd
126129
}
127130

pkg/oc/cli/cmd/rsync/util.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ func rsyncFlagsFromOptions(o *RsyncOptions) []string {
6565
if o.Delete {
6666
flags = append(flags, "--delete")
6767
}
68+
if o.Compress {
69+
flags = append(flags, "-z")
70+
}
6871
if len(o.RsyncInclude) > 0 {
6972
for _, include := range o.RsyncInclude {
7073
flags = append(flags, fmt.Sprintf("--include=%s", include))
@@ -98,6 +101,9 @@ func rsyncSpecificFlags(o *RsyncOptions) []string {
98101
if o.RsyncNoPerms {
99102
flags = append(flags, "--no-perms")
100103
}
104+
if o.Compress {
105+
flags = append(flags, "-z")
106+
}
101107
return flags
102108
}
103109

0 commit comments

Comments
 (0)