feat: only retry to update ref-count on conflict

This commit is contained in:
wencaiwulue
2023-01-26 21:57:15 +08:00
parent 95f81df658
commit f128f5d58e
3 changed files with 36 additions and 2 deletions

View File

@@ -70,7 +70,15 @@ func updateRefCount(configMapInterface v12.ConfigMapInterface, name string, incr
err = retry.OnError(
retry.DefaultRetry,
func(err error) bool {
return !k8serrors.IsNotFound(err)
notFound := k8serrors.IsNotFound(err)
if notFound {
return false
}
conflict := k8serrors.IsConflict(err)
if conflict {
return true
}
return false
},
func() (err error) {
var cm *corev1.ConfigMap