Update node defaults

Do not enable leases by default in the node constructor.
Simplify node constructor to not require a lease client when leases may
not even be enabled.

Updates node status update interval to the kubelet default of 10s (was
5s in vk).
This commit is contained in:
Brian Goff
2019-06-04 16:44:00 -07:00
parent 20e710043f
commit b1236477f5
3 changed files with 56 additions and 41 deletions

View File

@@ -33,11 +33,14 @@ func testNodeRun(t *testing.T, enableLease bool) {
leases := c.Coordination().Leases(corev1.NamespaceNodeLease)
interval := 1 * time.Millisecond
node, err := NewNode(testP, testNode(t), leases, nodes,
opts := []NodeOpt{
WithNodePingInterval(interval),
WithNodeStatusUpdateInterval(interval),
WithNodeDisableLease(!enableLease),
)
}
if enableLease {
opts = append(opts, WithNodeEnableLeaseV1Beta1(leases, nil))
}
node, err := NewNode(testP, testNode(t), nodes, opts...)
assert.NilError(t, err)
chErr := make(chan error)
@@ -157,12 +160,11 @@ func TestNodeCustomUpdateStatusErrorHandler(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
node, err := NewNode(testP, testNode(t), nil, nodes,
node, err := NewNode(testP, testNode(t), nodes,
WithNodeStatusUpdateErrorHandler(func(_ context.Context, err error) error {
cancel()
return nil
}),
WithNodeDisableLease(true),
)
assert.NilError(t, err)