@@ -60,7 +60,9 @@ import (
60
60
"k8s.io/component-base/metrics/prometheus/slis"
61
61
"k8s.io/component-base/version"
62
62
"k8s.io/component-base/version/verflag"
63
+ zpagesfeatures "k8s.io/component-base/zpages/features"
63
64
"k8s.io/component-base/zpages/flagz"
65
+ "k8s.io/component-base/zpages/statusz"
64
66
nodeutil "k8s.io/component-helpers/node/util"
65
67
"k8s.io/klog/v2"
66
68
api "k8s.io/kubernetes/pkg/apis/core"
@@ -78,6 +80,11 @@ import (
78
80
netutils "k8s.io/utils/net"
79
81
)
80
82
83
+ const (
84
+ // kubeProxy defines variable used internally when referring to kube-proxy component
85
+ kubeProxy = "kube-proxy"
86
+ )
87
+
81
88
func init () {
82
89
utilruntime .Must (metricsfeatures .AddFeatureGates (utilfeature .DefaultMutableFeatureGate ))
83
90
utilruntime .Must (logsapi .AddFeatureGates (utilfeature .DefaultMutableFeatureGate ))
@@ -93,7 +100,7 @@ func NewProxyCommand() *cobra.Command {
93
100
opts := NewOptions ()
94
101
95
102
cmd := & cobra.Command {
96
- Use : "kube-proxy" ,
103
+ Use : kubeProxy ,
97
104
Long : `The Kubernetes network proxy runs on each node. This
98
105
reflects services as defined in the Kubernetes API on each node and can do simple
99
106
TCP, UDP, and SCTP stream forwarding or round robin TCP, UDP, and SCTP forwarding across a set of backends.
@@ -214,7 +221,7 @@ func newProxyServer(ctx context.Context, config *kubeproxyconfig.KubeProxyConfig
214
221
}
215
222
216
223
s .Broadcaster = events .NewBroadcaster (& events.EventSinkImpl {Interface : s .Client .EventsV1 ()})
217
- s .Recorder = s .Broadcaster .NewRecorder (proxyconfigscheme .Scheme , "kube-proxy" )
224
+ s .Recorder = s .Broadcaster .NewRecorder (proxyconfigscheme .Scheme , kubeProxy )
218
225
219
226
s .NodeRef = & v1.ObjectReference {
220
227
Kind : "Node" ,
@@ -443,7 +450,7 @@ func serveMetrics(ctx context.Context, bindAddress string, proxyMode kubeproxyco
443
450
return
444
451
}
445
452
446
- proxyMux := mux .NewPathRecorderMux ("kube-proxy" )
453
+ proxyMux := mux .NewPathRecorderMux (kubeProxy )
447
454
healthz .InstallHandler (proxyMux )
448
455
slis.SLIMetricsWithReset {}.Install (proxyMux )
449
456
@@ -466,6 +473,10 @@ func serveMetrics(ctx context.Context, bindAddress string, proxyMode kubeproxyco
466
473
flagz .Install (proxyMux , "kube-proxy" , flagzReader )
467
474
}
468
475
476
+ if utilfeature .DefaultFeatureGate .Enabled (zpagesfeatures .ComponentStatusz ) {
477
+ statusz .Install (proxyMux , kubeProxy , statusz .NewRegistry ())
478
+ }
479
+
469
480
fn := func () {
470
481
var err error
471
482
defer func () {
0 commit comments