Skip to content

Commit

Permalink
Update pivot for Cluster OwnerReferences
Browse files Browse the repository at this point in the history
  • Loading branch information
detiber committed Feb 28, 2019
1 parent 460f07d commit d9a43a1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/clusterctl/phases/pivot.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ func moveMachineDeployment(from, to clusterclient.Client, md *clusterv1.MachineD

// New objects cannot have a specified resource version. Clear it out.
md.SetResourceVersion("")

// Remove owner reference. This currently assumes that the only owner reference would be a Cluster.
md.SetOwnerReferences(nil)

if err := to.CreateMachineDeploymentObjects([]*clusterv1.MachineDeployment{md}, md.Namespace); err != nil {
return errors.Wrapf(err, "error copying MachineDeployment %s/%s to target cluster", md.Namespace, md.Name)
}
Expand Down Expand Up @@ -359,7 +363,7 @@ func moveMachineSet(from, to clusterclient.Client, ms *clusterv1.MachineSet) err
// New objects cannot have a specified resource version. Clear it out.
ms.SetResourceVersion("")

// Remove owner reference. This currently assumes that the only owner reference would be a MachineDeployment.
// Remove owner reference. This currently assumes that the only owner references would be a MachineDeployment and/or a Cluster.
ms.SetOwnerReferences(nil)

if err := to.CreateMachineSetObjects([]*clusterv1.MachineSet{ms}, ms.Namespace); err != nil {
Expand Down Expand Up @@ -393,7 +397,7 @@ func moveMachine(from, to clusterclient.Client, m *clusterv1.Machine) error {
// New objects cannot have a specified resource version. Clear it out.
m.SetResourceVersion("")

// Remove owner reference. This currently assumes that the only owner reference would be a MachineSet.
// Remove owner reference. This currently assumes that the only owner references would be a MachineSet and/or a Cluster.
m.SetOwnerReferences(nil)

if err := to.CreateMachineObjects([]*clusterv1.Machine{m}, m.Namespace); err != nil {
Expand Down

0 comments on commit d9a43a1

Please sign in to comment.