From a6ffb5e607703c0fbb8c46df2f86ec1114754f24 Mon Sep 17 00:00:00 2001 From: Tom Denham Date: Fri, 14 Jul 2017 11:38:16 -0700 Subject: [PATCH] Remove RevokeLease from manager interface --- subnet/etcdv2/local_manager.go | 4 ---- subnet/etcdv2/subnet_test.go | 23 ----------------------- subnet/kube/kube.go | 4 ---- subnet/subnet.go | 1 - 4 files changed, 32 deletions(-) diff --git a/subnet/etcdv2/local_manager.go b/subnet/etcdv2/local_manager.go index 73ebf2c4ee..2026aedff2 100644 --- a/subnet/etcdv2/local_manager.go +++ b/subnet/etcdv2/local_manager.go @@ -254,10 +254,6 @@ OuterLoop: } } -func (m *LocalManager) RevokeLease(ctx context.Context, sn ip.IP4Net) error { - return m.registry.deleteSubnet(ctx, sn) -} - func (m *LocalManager) RenewLease(ctx context.Context, lease *Lease) error { exp, err := m.registry.updateSubnet(ctx, lease.Subnet, &lease.Attrs, subnetTTL, 0) if err != nil { diff --git a/subnet/etcdv2/subnet_test.go b/subnet/etcdv2/subnet_test.go index c6fb23d4ee..19412e0c0b 100644 --- a/subnet/etcdv2/subnet_test.go +++ b/subnet/etcdv2/subnet_test.go @@ -20,7 +20,6 @@ import ( "testing" "time" - etcd "github.com/coreos/etcd/client" "github.com/coreos/flannel/pkg/ip" . "github.com/coreos/flannel/subnet" "github.com/jonboulle/clockwork" @@ -323,28 +322,6 @@ func TestRenewLease(t *testing.T) { t.Fatal("Failed to find acquired lease") } -func TestLeaseRevoked(t *testing.T) { - msr := newDummyRegistry() - sm := NewMockManager(msr) - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - l := acquireLease(ctx, t, sm) - - if err := sm.RevokeLease(ctx, l.Subnet); err != nil { - t.Fatalf("RevokeLease failed: %v", err) - } - - _, _, err := msr.getSubnet(ctx, l.Subnet) - if err == nil { - t.Fatalf("Revoked lease still exists") - } - if etcdErr, ok := err.(etcd.Error); ok && etcdErr.Code != etcd.ErrorCodeKeyNotFound { - t.Fatalf("getSubnets after revoked lease returned unexpected error: %v", err) - } -} - func TestAddReservation(t *testing.T) { msr := newDummyRegistry() sm := NewMockManager(msr) diff --git a/subnet/kube/kube.go b/subnet/kube/kube.go index 894876c2cf..04ea009940 100644 --- a/subnet/kube/kube.go +++ b/subnet/kube/kube.go @@ -311,10 +311,6 @@ func (ksm *kubeSubnetManager) WatchLease(ctx context.Context, sn ip.IP4Net, curs return subnet.LeaseWatchResult{}, ErrUnimplemented } -func (ksm *kubeSubnetManager) RevokeLease(ctx context.Context, sn ip.IP4Net) error { - return ErrUnimplemented -} - func (ksm *kubeSubnetManager) AddReservation(ctx context.Context, r *subnet.Reservation) error { return ErrUnimplemented } diff --git a/subnet/subnet.go b/subnet/subnet.go index ec4ce7a186..4324093762 100644 --- a/subnet/subnet.go +++ b/subnet/subnet.go @@ -127,7 +127,6 @@ type Manager interface { GetNetworkConfig(ctx context.Context) (*Config, error) AcquireLease(ctx context.Context, attrs *LeaseAttrs) (*Lease, error) RenewLease(ctx context.Context, lease *Lease) error - RevokeLease(ctx context.Context, sn ip.IP4Net) error WatchLease(ctx context.Context, sn ip.IP4Net, cursor interface{}) (LeaseWatchResult, error) WatchLeases(ctx context.Context, cursor interface{}) (LeaseWatchResult, error)