fix: karmada join fail when secret exist

Signed-off-by: Alan Zhu <zg.zhu@daocloud.io>
This commit is contained in:
Alan Zhu 2022-01-23 15:49:46 +08:00
parent fc64c81e24
commit 44299055e0
1 changed files with 1 additions and 2 deletions

View File

@ -43,9 +43,8 @@ func CreateSecret(client kubeclient.Interface, secret *corev1.Secret) (*corev1.S
st, err := client.CoreV1().Secrets(secret.Namespace).Create(context.TODO(), secret, metav1.CreateOptions{})
if err != nil {
if apierrors.IsAlreadyExists(err) {
return st, nil
return client.CoreV1().Secrets(secret.Namespace).Get(context.TODO(), secret.Name, metav1.GetOptions{})
}
return nil, err
}