Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove RevokeLease from manager interface #776

Merged
merged 1 commit into from
Jul 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions subnet/etcdv2/local_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
23 changes: 0 additions & 23 deletions subnet/etcdv2/subnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions subnet/kube/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 0 additions & 1 deletion subnet/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down