fix:group was updated continuously in member cluster

Signed-off-by: Roland.Ma <rolandma@yunify.com>
This commit is contained in:
Roland.Ma
2021-03-31 14:16:27 +00:00
parent a7cbc6f878
commit 60f1f5240b

View File

@@ -146,7 +146,8 @@ func (c *Controller) reconcile(key string) error {
}
if group.Labels != nil {
// Set OwnerReferences when the group has a parent.
// Set OwnerReferences when the group has a parent. And it's owned by kubefed
if group.Labels[constants.KubefedManagedLabel] != "true" {
if parent, ok := group.Labels[iam1alpha2.GroupParent]; ok && !k8sutil.IsControlledBy(group.OwnerReferences, "Group", parent) {
if g == nil {
g = group.DeepCopy()
@@ -168,7 +169,7 @@ func (c *Controller) reconcile(key string) error {
}
}
}
}
if g != nil {
if _, err = c.ksClient.IamV1alpha2().Groups().Update(context.Background(), g, metav1.UpdateOptions{}); err != nil {
return err