Skip to content

Commit 18a5daa

Browse files
committed
Remove the Secret's OwnerReferences before pivot
1 parent fc4f55e commit 18a5daa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cmd/clusterctl/phases/pivot.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,10 @@ func moveSecret(from sourceClient, to targetClient, secret *corev1.Secret) error
253253
// New objects cannot have a specified resource version. Clear it out.
254254
secret.SetResourceVersion("")
255255

256-
// Remove owner reference.
257-
secret.SetOwnerReferences(nil)
256+
// remove the UID from ownerReferences as it will be different across clusters
257+
for i := 0; i < len(secret.OwnerReferences); i++ {
258+
secret.OwnerReferences[i].UID = ""
259+
}
258260

259261
if err := to.CreateSecret(secret); err != nil {
260262
return errors.Wrapf(err, "error copying Secret %s/%s to target cluster", secret.Namespace, secret.Name)

0 commit comments

Comments
 (0)