@@ -34,16 +34,16 @@ import (
34
34
// // context
35
35
// go pinger.start(ctx, ticker)
36
36
type queuePinger struct {
37
- getEndpointsFn k8s.GetEndpointsFunc
38
- interceptorNS string
39
- interceptorSvcName string
40
- interceptorDeplName string
41
- adminPort string
42
- pingMut * sync.RWMutex
43
- lastPingTime time.Time
44
- allCounts map [string ]int
45
- aggregateCount int
46
- lggr logr.Logger
37
+ getEndpointsFn k8s.GetEndpointsFunc
38
+ interceptorNS string
39
+ interceptorSvcName string
40
+ interceptorServiceName string
41
+ adminPort string
42
+ pingMut * sync.RWMutex
43
+ lastPingTime time.Time
44
+ allCounts map [string ]int
45
+ aggregateCount int
46
+ lggr logr.Logger
47
47
}
48
48
49
49
func newQueuePinger (
@@ -57,15 +57,15 @@ func newQueuePinger(
57
57
) (* queuePinger , error ) {
58
58
pingMut := new (sync.RWMutex )
59
59
pinger := & queuePinger {
60
- getEndpointsFn : getEndpointsFn ,
61
- interceptorNS : ns ,
62
- interceptorSvcName : svcName ,
63
- interceptorDeplName : deplName ,
64
- adminPort : adminPort ,
65
- pingMut : pingMut ,
66
- lggr : lggr ,
67
- allCounts : map [string ]int {},
68
- aggregateCount : 0 ,
60
+ getEndpointsFn : getEndpointsFn ,
61
+ interceptorNS : ns ,
62
+ interceptorSvcName : svcName ,
63
+ interceptorServiceName : deplName ,
64
+ adminPort : adminPort ,
65
+ pingMut : pingMut ,
66
+ lggr : lggr ,
67
+ allCounts : map [string ]int {},
68
+ aggregateCount : 0 ,
69
69
}
70
70
return pinger , pinger .fetchAndSaveCounts (ctx )
71
71
}
@@ -74,14 +74,14 @@ func newQueuePinger(
74
74
func (q * queuePinger ) start (
75
75
ctx context.Context ,
76
76
ticker * time.Ticker ,
77
- deplCache k8s.DeploymentCache ,
77
+ endpCache k8s.EndpointsCache ,
78
78
) error {
79
- deployWatchIface , err := deplCache .Watch (q .interceptorNS , q .interceptorDeplName )
79
+ endpoWatchIface , err := endpCache .Watch (q .interceptorNS , q .interceptorServiceName )
80
80
if err != nil {
81
81
return err
82
82
}
83
- deployEvtChan := deployWatchIface .ResultChan ()
84
- defer deployWatchIface .Stop ()
83
+ endpEvtChan := endpoWatchIface .ResultChan ()
84
+ defer endpoWatchIface .Stop ()
85
85
86
86
lggr := q .lggr .WithName ("scaler.queuePinger.start" )
87
87
defer ticker .Stop ()
@@ -102,13 +102,13 @@ func (q *queuePinger) start(
102
102
return fmt .Errorf ("error getting request counts: %w" , err )
103
103
}
104
104
// handle changes to the interceptor fleet
105
- // Deployment
106
- case <- deployEvtChan :
105
+ // Endpoints
106
+ case <- endpEvtChan :
107
107
err := q .fetchAndSaveCounts (ctx )
108
108
if err != nil {
109
109
lggr .Error (
110
110
err ,
111
- "getting request counts after interceptor deployment event" ,
111
+ "getting request counts after interceptor endpoints event" ,
112
112
)
113
113
}
114
114
}
0 commit comments