@@ -42,13 +42,16 @@ type ProxierHealthUpdater interface {
42
42
// Updated should be called when the proxier has successfully updated the service
43
43
// rules to reflect the current state.
44
44
Updated ()
45
+
46
+ // Run starts the healthz http server and returns.
47
+ Run ()
45
48
}
46
49
47
- var _ ProxierHealthUpdater = & ProxierHealthServer {}
50
+ var _ ProxierHealthUpdater = & proxierHealthServer {}
48
51
49
- // ProxierHealthServer returns 200 "OK" by default. It verifies that the delay between
52
+ // proxierHealthServer returns 200 "OK" by default. It verifies that the delay between
50
53
// QueuedUpdate() calls and Updated() calls never exceeds healthTimeout.
51
- type ProxierHealthServer struct {
54
+ type proxierHealthServer struct {
52
55
listener listener
53
56
httpFactory httpServerFactory
54
57
clock clock.Clock
@@ -63,12 +66,12 @@ type ProxierHealthServer struct {
63
66
}
64
67
65
68
// NewProxierHealthServer returns a proxier health http server.
66
- func NewProxierHealthServer (addr string , healthTimeout time.Duration , recorder record.EventRecorder , nodeRef * v1.ObjectReference ) * ProxierHealthServer {
69
+ func NewProxierHealthServer (addr string , healthTimeout time.Duration , recorder record.EventRecorder , nodeRef * v1.ObjectReference ) ProxierHealthUpdater {
67
70
return newProxierHealthServer (stdNetListener {}, stdHTTPServerFactory {}, clock.RealClock {}, addr , healthTimeout , recorder , nodeRef )
68
71
}
69
72
70
- func newProxierHealthServer (listener listener , httpServerFactory httpServerFactory , c clock.Clock , addr string , healthTimeout time.Duration , recorder record.EventRecorder , nodeRef * v1.ObjectReference ) * ProxierHealthServer {
71
- return & ProxierHealthServer {
73
+ func newProxierHealthServer (listener listener , httpServerFactory httpServerFactory , c clock.Clock , addr string , healthTimeout time.Duration , recorder record.EventRecorder , nodeRef * v1.ObjectReference ) * proxierHealthServer {
74
+ return & proxierHealthServer {
72
75
listener : listener ,
73
76
httpFactory : httpServerFactory ,
74
77
clock : c ,
@@ -80,17 +83,17 @@ func newProxierHealthServer(listener listener, httpServerFactory httpServerFacto
80
83
}
81
84
82
85
// Updated updates the lastUpdated timestamp.
83
- func (hs * ProxierHealthServer ) Updated () {
86
+ func (hs * proxierHealthServer ) Updated () {
84
87
hs .lastUpdated .Store (hs .clock .Now ())
85
88
}
86
89
87
90
// QueuedUpdate updates the lastQueued timestamp.
88
- func (hs * ProxierHealthServer ) QueuedUpdate () {
91
+ func (hs * proxierHealthServer ) QueuedUpdate () {
89
92
hs .lastQueued .Store (hs .clock .Now ())
90
93
}
91
94
92
95
// Run starts the healthz http server and returns.
93
- func (hs * ProxierHealthServer ) Run () {
96
+ func (hs * proxierHealthServer ) Run () {
94
97
serveMux := http .NewServeMux ()
95
98
serveMux .Handle ("/healthz" , healthzHandler {hs : hs })
96
99
server := hs .httpFactory .New (hs .addr , serveMux )
@@ -117,7 +120,7 @@ func (hs *ProxierHealthServer) Run() {
117
120
}
118
121
119
122
type healthzHandler struct {
120
- hs * ProxierHealthServer
123
+ hs * proxierHealthServer
121
124
}
122
125
123
126
func (h healthzHandler ) ServeHTTP (resp http.ResponseWriter , req * http.Request ) {
0 commit comments