Skip to content

Commit

Permalink
Fix bug in kubeadmconfig adoption
Browse files Browse the repository at this point in the history
Signed-off-by: killianmuldoon <[email protected]>
  • Loading branch information
killianmuldoon committed Nov 25, 2022
1 parent e3de174 commit 29da46f
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1041,11 +1041,14 @@ func (r *KubeadmConfigReconciler) ensureBootstrapSecretOwnersRef(ctx context.Con
if err != nil {
return errors.Wrapf(err, "failed to add KubeadmConfig %s as ownerReference to bootstrap Secret %s", scope.ConfigOwner.GetName(), secret.GetName())
}
if controller := metav1.GetControllerOf(secret); controller != nil {
util.RemoveOwnerRef(secret.OwnerReferences, *controller)
}
secret.OwnerReferences = util.EnsureOwnerRef(secret.OwnerReferences, metav1.OwnerReference{
APIVersion: scope.ConfigOwner.GetAPIVersion(),
Kind: scope.ConfigOwner.GetKind(),
UID: scope.ConfigOwner.GetUID(),
Name: scope.ConfigOwner.GetName(),
APIVersion: scope.Config.APIVersion,
Kind: scope.Config.Kind,
UID: scope.Config.UID,
Name: scope.Config.Name,
Controller: pointer.Bool(true),
})
err = patchHelper.Patch(ctx, secret)
Expand Down

0 comments on commit 29da46f

Please sign in to comment.