mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
kubeadm: don't fail post upgrade in EnsureAdminClusterRoleBindingImpl if the error is crb already exists
This commit is contained in:
parent
3aa8c59fec
commit
ec1516b45d
@ -694,9 +694,8 @@ func EnsureAdminClusterRoleBindingImpl(ctx context.Context, adminClient, superAd
|
|||||||
); err != nil {
|
); err != nil {
|
||||||
lastError = err
|
lastError = err
|
||||||
if apierrors.IsAlreadyExists(err) {
|
if apierrors.IsAlreadyExists(err) {
|
||||||
// This should not happen, as the previous "create" call that uses
|
klog.V(5).Infof("ClusterRoleBinding %s already exists.", kubeadmconstants.ClusterAdminsGroupAndClusterRoleBinding)
|
||||||
// the admin.conf should have passed. Return the error.
|
return true, nil
|
||||||
return true, err
|
|
||||||
}
|
}
|
||||||
// Retry on any other type of error.
|
// Retry on any other type of error.
|
||||||
return false, nil
|
return false, nil
|
||||||
|
@ -850,6 +850,12 @@ func TestEnsureAdminClusterRoleBindingImpl(t *testing.T) {
|
|||||||
schema.GroupResource{}, "name")
|
schema.GroupResource{}, "name")
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
setupSuperAdminClient: func(client *clientsetfake.Clientset) {
|
||||||
|
client.PrependReactor("create", "clusterrolebindings", func(action clientgotesting.Action) (bool, runtime.Object, error) {
|
||||||
|
return true, nil, apierrors.NewAlreadyExists(
|
||||||
|
schema.GroupResource{}, "name")
|
||||||
|
})
|
||||||
|
},
|
||||||
expectedError: false,
|
expectedError: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -916,7 +922,7 @@ func TestEnsureAdminClusterRoleBindingImpl(t *testing.T) {
|
|||||||
schema.GroupResource{}, "name")
|
schema.GroupResource{}, "name")
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
expectedError: true,
|
expectedError: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user