Merge pull request #85789 from ZP-AlwaysWin/dev-1202

Remove unnecessary nil check in if statement in nodelease controller
This commit is contained in:
Kubernetes Prow Robot 2019-12-12 18:32:54 -08:00 committed by GitHub
commit 6db550d1db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,7 +213,7 @@ func (c *controller) newLease(base *coordinationv1.Lease) *coordinationv1.Lease
// kubelet.nodeRef.UID. When lease is initially created, it is possible that
// the connection between master and node is not ready yet. So try to set
// owner reference every time when renewing the lease, until successful.
if lease.OwnerReferences == nil || len(lease.OwnerReferences) == 0 {
if len(lease.OwnerReferences) == 0 {
if node, err := c.client.CoreV1().Nodes().Get(c.holderIdentity, metav1.GetOptions{}); err == nil {
lease.OwnerReferences = []metav1.OwnerReference{
{