Skip to content

Commit

Permalink
Merge pull request #1446 from KubeKyrie/fix-secret-owner-reference
Browse files Browse the repository at this point in the history
fix set owner-reference
  • Loading branch information
ErikJiang authored Dec 22, 2024
2 parents 85003e0 + 57d455d commit 868189a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pkg/controllers/cluster/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ func (c *Controller) UpdateOwnReferenceToCluster(cluster *clusterv1alpha1.Cluste
return util.UpdateOwnReference(c.ClientSet,
cluster.Spec.ConfigDataList(),
cluster.Spec.SecretDataList(),
*metav1.NewControllerRef(cluster, clusterv1alpha1.SchemeGroupVersion.WithKind("Cluster")),
metav1.OwnerReference{
APIVersion: clusterv1alpha1.SchemeGroupVersion.String(),
Kind: clusterv1alpha1.SchemeGroupVersion.WithKind("Cluster").Kind,
Name: cluster.Name,
UID: cluster.GetUID(),
},
)
}

Expand Down
7 changes: 6 additions & 1 deletion pkg/controllers/clusterops/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,12 @@ func (c *Controller) UpdateOwnReferenceToClusterOps(clusterOps *clusteroperation
c.ClientSet,
clusterOps.Spec.ConfigDataList(),
clusterOps.Spec.SecretDataList(),
*metav1.NewControllerRef(clusterOps, clusteroperationv1alpha1.SchemeGroupVersion.WithKind("ClusterOperation")),
metav1.OwnerReference{
APIVersion: clusterv1alpha1.SchemeGroupVersion.String(),
Kind: clusterv1alpha1.SchemeGroupVersion.WithKind("ClusterOperation").Kind,
Name: clusterOps.Name,
UID: clusterOps.GetUID(),
},
)
}

Expand Down

0 comments on commit 868189a

Please sign in to comment.