@@ -24,16 +24,16 @@ import (
24
24
"time"
25
25
26
26
v1 "k8s.io/api/core/v1"
27
- networkingv1beta1 "k8s.io/api/networking/v1beta1 "
27
+ networkingv1 "k8s.io/api/networking/v1 "
28
28
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
29
29
"k8s.io/apimachinery/pkg/labels"
30
30
"k8s.io/apimachinery/pkg/util/runtime"
31
31
"k8s.io/apimachinery/pkg/util/sets"
32
32
"k8s.io/apimachinery/pkg/util/wait"
33
33
utilfeature "k8s.io/apiserver/pkg/util/feature"
34
- networkingv1beta1informers "k8s.io/client-go/informers/networking/v1beta1 "
35
- networkingv1beta1client "k8s.io/client-go/kubernetes/typed/networking/v1beta1 "
36
- networkingv1beta1listers "k8s.io/client-go/listers/networking/v1beta1 "
34
+ networkingv1informers "k8s.io/client-go/informers/networking/v1 "
35
+ networkingv1client "k8s.io/client-go/kubernetes/typed/networking/v1 "
36
+ networkingv1listers "k8s.io/client-go/listers/networking/v1 "
37
37
"k8s.io/client-go/tools/cache"
38
38
"k8s.io/client-go/util/workqueue"
39
39
"k8s.io/klog/v2"
@@ -52,12 +52,12 @@ import (
52
52
// MetaAllocator implements current allocator interface using
53
53
// ServiceCIDR and IPAddress API objects.
54
54
type MetaAllocator struct {
55
- client networkingv1beta1client. NetworkingV1beta1Interface
56
- serviceCIDRLister networkingv1beta1listers .ServiceCIDRLister
55
+ client networkingv1client. NetworkingV1Interface
56
+ serviceCIDRLister networkingv1listers .ServiceCIDRLister
57
57
serviceCIDRSynced cache.InformerSynced
58
- ipAddressLister networkingv1beta1listers .IPAddressLister
58
+ ipAddressLister networkingv1listers .IPAddressLister
59
59
ipAddressSynced cache.InformerSynced
60
- ipAddressInformer networkingv1beta1informers .IPAddressInformer
60
+ ipAddressInformer networkingv1informers .IPAddressInformer
61
61
queue workqueue.TypedRateLimitingInterface [string ]
62
62
63
63
internalStopCh chan struct {}
@@ -87,9 +87,9 @@ var _ Interface = &MetaAllocator{}
87
87
// and ServiceCIDR objects to track the assigned IP addresses,
88
88
// using an informer cache as storage.
89
89
func NewMetaAllocator (
90
- client networkingv1beta1client. NetworkingV1beta1Interface ,
91
- serviceCIDRInformer networkingv1beta1informers .ServiceCIDRInformer ,
92
- ipAddressInformer networkingv1beta1informers .IPAddressInformer ,
90
+ client networkingv1client. NetworkingV1Interface ,
91
+ serviceCIDRInformer networkingv1informers .ServiceCIDRInformer ,
92
+ ipAddressInformer networkingv1informers .IPAddressInformer ,
93
93
isIPv6 bool ,
94
94
bitmapAllocator Interface ,
95
95
) (* MetaAllocator , error ) {
@@ -100,9 +100,9 @@ func NewMetaAllocator(
100
100
}
101
101
102
102
// newMetaAllocator is used to build the allocator for testing
103
- func newMetaAllocator (client networkingv1beta1client. NetworkingV1beta1Interface ,
104
- serviceCIDRInformer networkingv1beta1informers .ServiceCIDRInformer ,
105
- ipAddressInformer networkingv1beta1informers .IPAddressInformer ,
103
+ func newMetaAllocator (client networkingv1client. NetworkingV1Interface ,
104
+ serviceCIDRInformer networkingv1informers .ServiceCIDRInformer ,
105
+ ipAddressInformer networkingv1informers .IPAddressInformer ,
106
106
isIPv6 bool ,
107
107
bitmapAllocator Interface ,
108
108
) * MetaAllocator {
@@ -152,13 +152,13 @@ func (c *MetaAllocator) enqueueServiceCIDR(obj interface{}) {
152
152
}
153
153
154
154
func (c * MetaAllocator ) deleteServiceCIDR (obj interface {}) {
155
- serviceCIDR , ok := obj .(* networkingv1beta1 .ServiceCIDR )
155
+ serviceCIDR , ok := obj .(* networkingv1 .ServiceCIDR )
156
156
if ! ok {
157
157
tombstone , ok := obj .(cache.DeletedFinalStateUnknown )
158
158
if ! ok {
159
159
return
160
160
}
161
- serviceCIDR , ok = tombstone .Obj .(* networkingv1beta1 .ServiceCIDR )
161
+ serviceCIDR , ok = tombstone .Obj .(* networkingv1 .ServiceCIDR )
162
162
if ! ok {
163
163
return
164
164
}
@@ -414,8 +414,8 @@ func (c *MetaAllocator) Release(ip net.IP) error {
414
414
}
415
415
func (c * MetaAllocator ) ForEach (f func (ip net.IP )) {
416
416
ipLabelSelector := labels .Set (map [string ]string {
417
- networkingv1beta1 .LabelIPAddressFamily : string (c .IPFamily ()),
418
- networkingv1beta1 .LabelManagedBy : ControllerName ,
417
+ networkingv1 .LabelIPAddressFamily : string (c .IPFamily ()),
418
+ networkingv1 .LabelManagedBy : ControllerName ,
419
419
}).AsSelectorPreValidated ()
420
420
ips , err := c .ipAddressLister .List (ipLabelSelector )
421
421
if err != nil {
@@ -454,8 +454,8 @@ func (c *MetaAllocator) Destroy() {
454
454
// for testing
455
455
func (c * MetaAllocator ) Used () int {
456
456
ipLabelSelector := labels .Set (map [string ]string {
457
- networkingv1beta1 .LabelIPAddressFamily : string (c .IPFamily ()),
458
- networkingv1beta1 .LabelManagedBy : ControllerName ,
457
+ networkingv1 .LabelIPAddressFamily : string (c .IPFamily ()),
458
+ networkingv1 .LabelManagedBy : ControllerName ,
459
459
}).AsSelectorPreValidated ()
460
460
ips , err := c .ipAddressLister .List (ipLabelSelector )
461
461
if err != nil {
@@ -512,13 +512,13 @@ func (c *MetaAllocator) DryRun() Interface {
512
512
return & Allocator {}
513
513
}
514
514
515
- func isReady (serviceCIDR * networkingv1beta1 .ServiceCIDR ) bool {
515
+ func isReady (serviceCIDR * networkingv1 .ServiceCIDR ) bool {
516
516
if serviceCIDR == nil {
517
517
return false
518
518
}
519
519
520
520
for _ , condition := range serviceCIDR .Status .Conditions {
521
- if condition .Type == networkingv1beta1 .ServiceCIDRConditionReady {
521
+ if condition .Type == networkingv1 .ServiceCIDRConditionReady {
522
522
return condition .Status == metav1 .ConditionStatus (metav1 .ConditionTrue )
523
523
}
524
524
}
0 commit comments