Skip to content

Commit 72a06c7

Browse files
committed
Removing Slow Set Utility out of repository
1 parent 3429c44 commit 72a06c7

File tree

10 files changed

+66
-134
lines changed

10 files changed

+66
-134
lines changed

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,5 @@ replace k8s.io/component-base => k8s.io/component-base v0.32.0
8888
replace k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.32.2
8989

9090
replace k8s.io/kms => k8s.io/kms v0.32.0
91+
92+
replace github.com/kubernetes-csi/csi-lib-utils => ../csi-lib-utils

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
6060
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
6161
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
6262
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
63-
github.com/kubernetes-csi/csi-lib-utils v0.21.0 h1:dUN/iIgXLucAxyML2iPyhniIlACQumIeAJmIzsMBddc=
64-
github.com/kubernetes-csi/csi-lib-utils v0.21.0/go.mod h1:ZCVRTYuup+bwX9tOeE5Q3LDw64QvltSwMUQ3M3g2T+Q=
6563
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
6664
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
6765
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=

pkg/controller/controller.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"fmt"
2222
"time"
2323

24+
"github.com/kubernetes-csi/csi-lib-utils/slowset"
2425
"github.com/kubernetes-csi/external-resizer/pkg/features"
2526
"k8s.io/apimachinery/pkg/api/errors"
2627

@@ -71,7 +72,7 @@ type resizeController struct {
7172

7273
// slowSet is used to track PVCs for which expansion failed with infeasible error
7374
// and should be retried at slower rate.
74-
slowSet *util.SlowSet
75+
slowSet *slowset.SlowSet
7576

7677
// a cache to store PersistentVolume objects
7778
volumes cache.Store
@@ -113,7 +114,7 @@ func NewResizeController(
113114
volumes: pvInformer.Informer().GetStore(),
114115
claims: pvcInformer.Informer().GetStore(),
115116
eventRecorder: eventRecorder,
116-
slowSet: util.NewSlowSet(maxRetryInterval),
117+
slowSet: slowset.NewSlowSet(maxRetryInterval),
117118
finalErrorPVCs: sets.New[string](),
118119
usedPVCs: newUsedPVCStore(),
119120
handleVolumeInUseError: handleVolumeInUseError,

pkg/controller/expand_and_recover.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ package controller
1818

1919
import (
2020
"fmt"
21+
"time"
2122

23+
"github.com/kubernetes-csi/csi-lib-utils/slowset"
2224
"github.com/kubernetes-csi/external-resizer/pkg/util"
2325
v1 "k8s.io/api/core/v1"
2426
"k8s.io/apimachinery/pkg/api/resource"
@@ -198,7 +200,9 @@ func (ctrl *resizeController) expandAndRecover(pvc *v1.PersistentVolumeClaim, pv
198200

199201
func (ctrl *resizeController) markForSlowRetry(pvcKey string, resizeStatus v1.ClaimResourceStatus) {
200202
if resizeStatus == v1.PersistentVolumeClaimControllerResizeInfeasible {
201-
ctrl.slowSet.Add(pvcKey)
203+
ctrl.slowSet.Add(pvcKey, slowset.ObjectData{
204+
Timestamp: time.Now(),
205+
})
202206
}
203207
}
204208

pkg/modifycontroller/controller.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323

2424
"github.com/kubernetes-csi/external-resizer/pkg/util"
2525

26+
"github.com/kubernetes-csi/csi-lib-utils/slowset"
2627
"github.com/kubernetes-csi/external-resizer/pkg/modifier"
2728
v1 "k8s.io/api/core/v1"
2829
"k8s.io/apimachinery/pkg/labels"
@@ -62,7 +63,7 @@ type modifyController struct {
6263
// the key of the map is {PVC_NAMESPACE}/{PVC_NAME}
6364
uncertainPVCs map[string]v1.PersistentVolumeClaim
6465
// slowSet tracks PVCs for which modification failed with infeasible error and should be retried at slower rate.
65-
slowSet *util.SlowSet
66+
slowSet *slowset.SlowSet
6667
}
6768

6869
// NewModifyController returns a ModifyController.
@@ -102,7 +103,7 @@ func NewModifyController(
102103
claimQueue: claimQueue,
103104
eventRecorder: eventRecorder,
104105
extraModifyMetadata: extraModifyMetadata,
105-
slowSet: util.NewSlowSet(maxRetryInterval),
106+
slowSet: slowset.NewSlowSet(maxRetryInterval),
106107
}
107108
// Add a resync period as the PVC's request modify can be modified again when we are handling
108109
// a previous modify request of the same PVC.

pkg/modifycontroller/modify_volume.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ package modifycontroller
1818

1919
import (
2020
"fmt"
21+
"time"
2122

23+
"github.com/kubernetes-csi/csi-lib-utils/slowset"
2224
"github.com/kubernetes-csi/external-resizer/pkg/util"
2325
"google.golang.org/grpc/codes"
2426
"google.golang.org/grpc/status"
@@ -197,6 +199,8 @@ func (ctrl *modifyController) delayModificationIfRecentlyInfeasible(pvc *v1.Pers
197199
func (ctrl *modifyController) markForSlowRetry(pvc *v1.PersistentVolumeClaim, pvcKey string) {
198200
s := pvc.Status.ModifyVolumeStatus
199201
if s != nil && s.Status == v1.PersistentVolumeClaimModifyVolumeInfeasible {
200-
ctrl.slowSet.Add(pvcKey)
202+
ctrl.slowSet.Add(pvcKey, slowset.ObjectData{
203+
Timestamp: time.Now(),
204+
})
201205
}
202206
}

pkg/util/slowset_test.go

Lines changed: 0 additions & 103 deletions
This file was deleted.

vendor/github.com/kubernetes-csi/csi-lib-utils/leaderelection/leader_election.go

Lines changed: 21 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/util/slowset.go renamed to vendor/github.com/kubernetes-csi/csi-lib-utils/slowset/slowset.go

Lines changed: 24 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,15 @@ github.com/klauspost/compress/internal/cpuinfo
8787
github.com/klauspost/compress/internal/snapref
8888
github.com/klauspost/compress/zstd
8989
github.com/klauspost/compress/zstd/internal/xxhash
90-
# github.com/kubernetes-csi/csi-lib-utils v0.21.0
90+
# github.com/kubernetes-csi/csi-lib-utils v0.21.0 => ../csi-lib-utils
9191
## explicit; go 1.23.1
9292
github.com/kubernetes-csi/csi-lib-utils/accessmodes
9393
github.com/kubernetes-csi/csi-lib-utils/connection
9494
github.com/kubernetes-csi/csi-lib-utils/leaderelection
9595
github.com/kubernetes-csi/csi-lib-utils/metrics
9696
github.com/kubernetes-csi/csi-lib-utils/protosanitizer
9797
github.com/kubernetes-csi/csi-lib-utils/rpc
98+
github.com/kubernetes-csi/csi-lib-utils/slowset
9899
# github.com/mailru/easyjson v0.9.0
99100
## explicit; go 1.20
100101
github.com/mailru/easyjson/buffer
@@ -849,3 +850,4 @@ sigs.k8s.io/yaml/goyaml.v2
849850
# k8s.io/component-base => k8s.io/component-base v0.32.0
850851
# k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.32.2
851852
# k8s.io/kms => k8s.io/kms v0.32.0
853+
# github.com/kubernetes-csi/csi-lib-utils => ../csi-lib-utils

0 commit comments

Comments
 (0)