Skip to content

Commit 109f1c4

Browse files
committed
Clean up kube-proxy.
These are based on recommendation from [staticcheck](http://staticcheck.io/). - Removes dead type/function along with the import that the function introduced. - Removes unused struct fields. - Removes select nested in a tight for loop, the select does not have a default, so it will be blocking.
1 parent 8f5a62a commit 109f1c4

File tree

4 files changed

+3
-17
lines changed

4 files changed

+3
-17
lines changed

cmd/kube-proxy/app/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ go_test(
163163
],
164164
embed = [":go_default_library"],
165165
deps = [
166-
"//pkg/apis/core:go_default_library",
167166
"//pkg/proxy/apis/config:go_default_library",
168167
"//pkg/util/configz:go_default_library",
169168
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",

cmd/kube-proxy/app/server.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,9 @@ func (o *Options) runLoop() error {
332332
}()
333333

334334
for {
335-
select {
336-
case err := <-o.errCh:
337-
if err != nil {
338-
return err
339-
}
335+
err := <-o.errCh
336+
if err != nil {
337+
return err
340338
}
341339
}
342340
}

cmd/kube-proxy/app/server_others_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import (
2929
func Test_getProxyMode(t *testing.T) {
3030
var cases = []struct {
3131
flag string
32-
annotationKey string
33-
annotationVal string
3432
iptablesVersion string
3533
ipsetVersion string
3634
kmods []string

cmd/kube-proxy/app/server_test.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,11 @@ import (
3333
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3434
"k8s.io/apimachinery/pkg/util/diff"
3535
componentbaseconfig "k8s.io/component-base/config"
36-
api "k8s.io/kubernetes/pkg/apis/core"
3736
kubeproxyconfig "k8s.io/kubernetes/pkg/proxy/apis/config"
3837
"k8s.io/kubernetes/pkg/util/configz"
3938
utilpointer "k8s.io/utils/pointer"
4039
)
4140

42-
type fakeNodeInterface struct {
43-
node api.Node
44-
}
45-
46-
func (fake *fakeNodeInterface) Get(hostname string, options metav1.GetOptions) (*api.Node, error) {
47-
return &fake.node, nil
48-
}
49-
5041
type fakeIPTablesVersioner struct {
5142
version string // what to return
5243
err error // what to return

0 commit comments

Comments
 (0)