From 10553a1966892e305252c65ebeb9043416304f48 Mon Sep 17 00:00:00 2001 From: Marek Siarkowicz Date: Wed, 30 Aug 2023 16:42:34 +0200 Subject: [PATCH] Flatten switch case --- .../apiserver/pkg/storage/etcd3/store.go | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go index 3182be090bf..c1ddcabe0f4 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go @@ -678,22 +678,6 @@ func (s *store) GetList(ctx context.Context, key string, opts storage.ListOption if continueRV > 0 { withRev = continueRV } - case recursive && s.pagingEnabled && pred.Limit > 0: - if fromRV != nil { - switch match { - case metav1.ResourceVersionMatchNotOlderThan: - // The not older than constraint is checked after we get a response from etcd, - // and returnedRV is then set to the revision we get from the etcd response. - case metav1.ResourceVersionMatchExact: - withRev = int64(*fromRV) - case "": // legacy case - if *fromRV > 0 { - withRev = int64(*fromRV) - } - default: - return fmt.Errorf("unknown ResourceVersionMatch value: %v", match) - } - } default: if fromRV != nil { switch match { @@ -703,6 +687,9 @@ func (s *store) GetList(ctx context.Context, key string, opts storage.ListOption case metav1.ResourceVersionMatchExact: withRev = int64(*fromRV) case "": // legacy case + if recursive && s.pagingEnabled && pred.Limit > 0 && *fromRV > 0 { + withRev = int64(*fromRV) + } default: return fmt.Errorf("unknown ResourceVersionMatch value: %v", match) }