1
0
mirror of synced 2026-02-13 13:06:56 +00:00

Fix reconcile with source in a different namespace

Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
This commit is contained in:
Somtochi Onyekwere
2021-04-16 08:53:30 +01:00
parent fc3a09b5ad
commit 6c656b7366
3 changed files with 17 additions and 10 deletions

View File

@@ -18,7 +18,7 @@ type reconcileWithSource interface {
adapter
reconcilable
reconcileSource() bool
getSource() (reconcileCommand, string)
getSource() (reconcileCommand, types.NamespacedName)
}
type reconcileWithSourceCommand struct {
@@ -55,14 +55,13 @@ func (reconcile reconcileWithSourceCommand) run(cmd *cobra.Command, args []strin
}
if reconcile.object.reconcileSource() {
reconcileCmd, nsName := reconcile.object.getSource()
nsCopy := rootArgs.namespace
objectNs := reconcile.object.asClientObject().GetNamespace()
if objectNs != "" {
rootArgs.namespace = reconcile.object.asClientObject().GetNamespace()
if nsName.Namespace != "" {
rootArgs.namespace = nsName.Namespace
}
reconcileCmd, sourceName := reconcile.object.getSource()
err := reconcileCmd.run(nil, []string{sourceName})
err := reconcileCmd.run(nil, []string{nsName.Name})
if err != nil {
return err
}