Skip to content

Commit

Permalink
Use port from AppBinding (#120) (#125)
Browse files Browse the repository at this point in the history
/cherry-pick

Signed-off-by: Emruz Hossain <[email protected]>

Ref: stashed/stash#1272
  • Loading branch information
1gtm authored Dec 17, 2020
1 parent 70d872d commit 42458b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ func (opt *perconaOptions) backupPerconaXtraDB(targetRef api_v1beta1.TargetRef)
"-h", appBinding.Spec.ClientConfig.Service.Name,
},
}
// if port is specified, append port in the arguments
if appBinding.Spec.ClientConfig.Service.Port != 0 {
opt.backupOptions.StdinPipeCommand.Args = append(opt.backupOptions.StdinPipeCommand.Args, fmt.Sprintf("--port=%d", appBinding.Spec.ClientConfig.Service.Port))
}
for _, arg := range strings.Fields(opt.xtradbArgs) {
opt.backupOptions.StdinPipeCommand.Args = append(opt.backupOptions.StdinPipeCommand.Args, arg)
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package pkg

import (
"context"
"fmt"
"path/filepath"
"strings"

Expand Down Expand Up @@ -185,6 +186,10 @@ func (opt *perconaOptions) restorePerconaXtraDB(targetRef api_v1beta1.TargetRef)
"-h", appBinding.Spec.ClientConfig.Service.Name,
},
}
// if port is specified, append port in the arguments
if appBinding.Spec.ClientConfig.Service.Port != 0 {
opt.dumpOptions.StdoutPipeCommand.Args = append(opt.dumpOptions.StdoutPipeCommand.Args, fmt.Sprintf("--port=%d", appBinding.Spec.ClientConfig.Service.Port))
}
for _, arg := range strings.Fields(opt.xtradbArgs) {
opt.dumpOptions.StdoutPipeCommand.Args = append(opt.dumpOptions.StdoutPipeCommand.Args, arg)
}
Expand Down

0 comments on commit 42458b3

Please sign in to comment.