mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-27 05:04:52 +00:00
Fix staticcheck failures for pkg/proxy/...
Errors from staticcheck: pkg/proxy/healthcheck/proxier_health.go:55:2: field port is unused (U1000) pkg/proxy/healthcheck/proxier_health.go:162:20: printf-style function with dynamic format string and no further arguments should use print-style function instead (SA1006) pkg/proxy/healthcheck/service_health.go:166:20: printf-style function with dynamic format string and no further arguments should use print-style function instead (SA1006) pkg/proxy/iptables/proxier.go:737:2: this value of args is never used (SA4006) pkg/proxy/iptables/proxier.go:737:15: this result of append is never used, except maybe in other appends (SA4010) pkg/proxy/iptables/proxier.go:1287:28: this result of append is never used, except maybe in other appends (SA4010) pkg/proxy/userspace/proxysocket.go:293:3: this value of n is never used (SA4006) pkg/proxy/winkernel/metrics.go:74:6: func sinceInMicroseconds is unused (U1000) pkg/proxy/winkernel/metrics.go:79:6: func sinceInSeconds is unused (U1000) pkg/proxy/winuserspace/proxier.go:94:2: field portMapMutex is unused (U1000) pkg/proxy/winuserspace/proxier.go:118:2: field owner is unused (U1000) pkg/proxy/winuserspace/proxier.go:119:2: field socket is unused (U1000) pkg/proxy/winuserspace/proxysocket.go:620:4: this value of n is never used (SA4006)
This commit is contained in:
@@ -21,6 +21,7 @@ go_library(
|
||||
"//pkg/proxy/apis/config:go_default_library",
|
||||
"//pkg/proxy/config:go_default_library",
|
||||
"//pkg/proxy/healthcheck:go_default_library",
|
||||
"//pkg/proxy/metrics:go_default_library",
|
||||
"//pkg/util/async:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||
|
@@ -18,7 +18,6 @@ package winkernel
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"k8s.io/component-base/metrics"
|
||||
"k8s.io/component-base/metrics/legacyregistry"
|
||||
@@ -69,13 +68,3 @@ func RegisterMetrics() {
|
||||
legacyregistry.MustRegister(SyncProxyRulesLastTimestamp)
|
||||
})
|
||||
}
|
||||
|
||||
// Gets the time since the specified start in microseconds.
|
||||
func sinceInMicroseconds(start time.Time) float64 {
|
||||
return float64(time.Since(start).Nanoseconds() / time.Microsecond.Nanoseconds())
|
||||
}
|
||||
|
||||
// Gets the time since the specified start in seconds.
|
||||
func sinceInSeconds(start time.Time) float64 {
|
||||
return time.Since(start).Seconds()
|
||||
}
|
||||
|
@@ -47,6 +47,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/proxy/apis/config"
|
||||
proxyconfig "k8s.io/kubernetes/pkg/proxy/config"
|
||||
"k8s.io/kubernetes/pkg/proxy/healthcheck"
|
||||
"k8s.io/kubernetes/pkg/proxy/metrics"
|
||||
"k8s.io/kubernetes/pkg/util/async"
|
||||
)
|
||||
|
||||
@@ -1000,8 +1001,8 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
|
||||
start := time.Now()
|
||||
defer func() {
|
||||
SyncProxyRulesLatency.Observe(sinceInSeconds(start))
|
||||
DeprecatedSyncProxyRulesLatency.Observe(sinceInMicroseconds(start))
|
||||
SyncProxyRulesLatency.Observe(metrics.SinceInSeconds(start))
|
||||
DeprecatedSyncProxyRulesLatency.Observe(metrics.SinceInMicroseconds(start))
|
||||
klog.V(4).Infof("syncProxyRules took %v", time.Since(start))
|
||||
}()
|
||||
// don't sync rules till we've received services and endpoints
|
||||
|
Reference in New Issue
Block a user