Fix cannot modify UserSpec

Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
hongming
2021-02-26 16:13:25 +08:00
parent ee9c2d114c
commit 7929dd361e
2 changed files with 1 additions and 6 deletions

View File

@@ -64,12 +64,9 @@ func (im *imOperator) UpdateUser(new *iamv1alpha2.User) (*iamv1alpha2.User, erro
klog.Error(err)
return nil, err
}
if old.Annotations == nil {
old.Annotations = make(map[string]string, 0)
}
// keep encrypted password
new.Spec.EncryptedPassword = old.Spec.EncryptedPassword
updated, err := im.ksClient.IamV1alpha2().Users().Update(context.Background(), old, metav1.UpdateOptions{})
updated, err := im.ksClient.IamV1alpha2().Users().Update(context.Background(), new, metav1.UpdateOptions{})
if err != nil {
klog.Error(err)
return nil, err