@@ -35,14 +35,14 @@ const (
35
35
ToBeDeletedTaint = "ToBeDeletedByClusterAutoscaler"
36
36
)
37
37
38
- // ProxierHealthServer allows callers to:
38
+ // ProxyHealthServer allows callers to:
39
39
// 1. run a http server with /healthz and /livez endpoint handlers.
40
40
// 2. update healthz timestamps before and after synchronizing dataplane.
41
41
// 3. sync node status, for reporting unhealthy /healthz response
42
42
// if the node is marked for deletion by autoscaler.
43
43
// 4. get proxy health by verifying that the delay between QueuedUpdate()
44
44
// calls and Updated() calls exceeded healthTimeout or not.
45
- type ProxierHealthServer struct {
45
+ type ProxyHealthServer struct {
46
46
listener listener
47
47
httpFactory httpServerFactory
48
48
clock clock.Clock
@@ -56,13 +56,13 @@ type ProxierHealthServer struct {
56
56
nodeEligible bool
57
57
}
58
58
59
- // NewProxierHealthServer returns a proxier health http server.
60
- func NewProxierHealthServer (addr string , healthTimeout time.Duration ) * ProxierHealthServer {
61
- return newProxierHealthServer (stdNetListener {}, stdHTTPServerFactory {}, clock.RealClock {}, addr , healthTimeout )
59
+ // NewProxyHealthServer returns a proxy health http server.
60
+ func NewProxyHealthServer (addr string , healthTimeout time.Duration ) * ProxyHealthServer {
61
+ return newProxyHealthServer (stdNetListener {}, stdHTTPServerFactory {}, clock.RealClock {}, addr , healthTimeout )
62
62
}
63
63
64
- func newProxierHealthServer (listener listener , httpServerFactory httpServerFactory , c clock.Clock , addr string , healthTimeout time.Duration ) * ProxierHealthServer {
65
- return & ProxierHealthServer {
64
+ func newProxyHealthServer (listener listener , httpServerFactory httpServerFactory , c clock.Clock , addr string , healthTimeout time.Duration ) * ProxyHealthServer {
65
+ return & ProxyHealthServer {
66
66
listener : listener ,
67
67
httpFactory : httpServerFactory ,
68
68
clock : c ,
@@ -80,7 +80,7 @@ func newProxierHealthServer(listener listener, httpServerFactory httpServerFacto
80
80
81
81
// Updated should be called when the proxier of the given IP family has successfully updated
82
82
// the service rules to reflect the current state and should be considered healthy now.
83
- func (hs * ProxierHealthServer ) Updated (ipFamily v1.IPFamily ) {
83
+ func (hs * ProxyHealthServer ) Updated (ipFamily v1.IPFamily ) {
84
84
hs .lock .Lock ()
85
85
defer hs .lock .Unlock ()
86
86
delete (hs .oldestPendingQueuedMap , ipFamily )
@@ -92,7 +92,7 @@ func (hs *ProxierHealthServer) Updated(ipFamily v1.IPFamily) {
92
92
// indicates that the proxier for the given IP family has received changes but has not
93
93
// yet pushed them to its backend. If the proxier does not call Updated within the
94
94
// healthTimeout time then it will be considered unhealthy.
95
- func (hs * ProxierHealthServer ) QueuedUpdate (ipFamily v1.IPFamily ) {
95
+ func (hs * ProxyHealthServer ) QueuedUpdate (ipFamily v1.IPFamily ) {
96
96
hs .lock .Lock ()
97
97
defer hs .lock .Unlock ()
98
98
// Set oldestPendingQueuedMap[ipFamily] only if it's currently unset
@@ -103,12 +103,12 @@ func (hs *ProxierHealthServer) QueuedUpdate(ipFamily v1.IPFamily) {
103
103
104
104
// IsHealthy returns only the proxier's health state, following the same
105
105
// definition the HTTP server defines, but ignoring the state of the Node.
106
- func (hs * ProxierHealthServer ) IsHealthy () bool {
106
+ func (hs * ProxyHealthServer ) IsHealthy () bool {
107
107
isHealthy , _ := hs .isHealthy ()
108
108
return isHealthy
109
109
}
110
110
111
- func (hs * ProxierHealthServer ) isHealthy () (bool , time.Time ) {
111
+ func (hs * ProxyHealthServer ) isHealthy () (bool , time.Time ) {
112
112
hs .lock .RLock ()
113
113
defer hs .lock .RUnlock ()
114
114
@@ -138,7 +138,7 @@ func (hs *ProxierHealthServer) isHealthy() (bool, time.Time) {
138
138
139
139
// SyncNode syncs the node and determines if it is eligible or not. Eligible is
140
140
// defined as being: not tainted by ToBeDeletedTaint and not deleted.
141
- func (hs * ProxierHealthServer ) SyncNode (node * v1.Node ) {
141
+ func (hs * ProxyHealthServer ) SyncNode (node * v1.Node ) {
142
142
hs .lock .Lock ()
143
143
defer hs .lock .Unlock ()
144
144
@@ -155,35 +155,35 @@ func (hs *ProxierHealthServer) SyncNode(node *v1.Node) {
155
155
hs .nodeEligible = true
156
156
}
157
157
158
- // NodeEligible returns nodeEligible field of ProxierHealthServer .
159
- func (hs * ProxierHealthServer ) NodeEligible () bool {
158
+ // NodeEligible returns nodeEligible field of ProxyHealthServer .
159
+ func (hs * ProxyHealthServer ) NodeEligible () bool {
160
160
hs .lock .RLock ()
161
161
defer hs .lock .RUnlock ()
162
162
return hs .nodeEligible
163
163
}
164
164
165
165
// Run starts the healthz HTTP server and blocks until it exits.
166
- func (hs * ProxierHealthServer ) Run (ctx context.Context ) error {
166
+ func (hs * ProxyHealthServer ) Run (ctx context.Context ) error {
167
167
serveMux := http .NewServeMux ()
168
168
serveMux .Handle ("/healthz" , healthzHandler {hs : hs })
169
169
serveMux .Handle ("/livez" , livezHandler {hs : hs })
170
170
server := hs .httpFactory .New (serveMux )
171
171
172
172
listener , err := hs .listener .Listen (ctx , hs .addr )
173
173
if err != nil {
174
- return fmt .Errorf ("failed to start proxier healthz on %s: %v" , hs .addr , err )
174
+ return fmt .Errorf ("failed to start proxy healthz on %s: %v" , hs .addr , err )
175
175
}
176
176
177
177
klog .V (3 ).InfoS ("Starting healthz HTTP server" , "address" , hs .addr )
178
178
179
179
if err := server .Serve (listener ); err != nil {
180
- return fmt .Errorf ("proxier healthz closed with error: %v" , err )
180
+ return fmt .Errorf ("proxy healthz closed with error: %v" , err )
181
181
}
182
182
return nil
183
183
}
184
184
185
185
type healthzHandler struct {
186
- hs * ProxierHealthServer
186
+ hs * ProxyHealthServer
187
187
}
188
188
189
189
func (h healthzHandler ) ServeHTTP (resp http.ResponseWriter , req * http.Request ) {
@@ -211,7 +211,7 @@ func (h healthzHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
211
211
}
212
212
213
213
type livezHandler struct {
214
- hs * ProxierHealthServer
214
+ hs * ProxyHealthServer
215
215
}
216
216
217
217
func (h livezHandler ) ServeHTTP (resp http.ResponseWriter , req * http.Request ) {
0 commit comments