Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup lint errors in the pkg/kubelet/server/... directory #48313

Merged
merged 1 commit into from
Jul 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion pkg/kubelet/server/portforward/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ type websocketStreamPair struct {
// request over a websocket connection
type websocketStreamHandler struct {
conn *wsstream.Conn
ports []int32
streamPairs []*websocketStreamPair
pod string
uid types.UID
Expand Down
4 changes: 2 additions & 2 deletions pkg/kubelet/server/remotecommand/httpstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ func handleResizeEvents(stream io.Reader, channel chan<- remotecommand.TerminalS
}
}

func v1WriteStatusFunc(stream io.WriteCloser) func(status *apierrors.StatusError) error {
func v1WriteStatusFunc(stream io.Writer) func(status *apierrors.StatusError) error {
return func(status *apierrors.StatusError) error {
if status.Status().Status == metav1.StatusSuccess {
return nil // send error messages
Expand All @@ -435,7 +435,7 @@ func v1WriteStatusFunc(stream io.WriteCloser) func(status *apierrors.StatusError

// v4WriteStatusFunc returns a WriteStatusFunc that marshals a given api Status
// as json in the error channel.
func v4WriteStatusFunc(stream io.WriteCloser) func(status *apierrors.StatusError) error {
func v4WriteStatusFunc(stream io.Writer) func(status *apierrors.StatusError) error {
return func(status *apierrors.StatusError) error {
bs, err := json.Marshal(status.Status())
if err != nil {
Expand Down
8 changes: 3 additions & 5 deletions pkg/kubelet/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ func (s *Server) InstallDefaultHandlers() {
healthz.PingHealthz,
healthz.NamedCheck("syncloop", s.syncLoopHealthCheck),
)
var ws *restful.WebService
ws = new(restful.WebService)
ws := new(restful.WebService)
ws.
Path("/pods").
Produces(restful.MIME_JSON)
Expand Down Expand Up @@ -296,9 +295,8 @@ const pprofBasePath = "/debug/pprof/"
// InstallDebuggingHandlers registers the HTTP request patterns that serve logs or run commands/containers
func (s *Server) InstallDebuggingHandlers(criHandler http.Handler) {
glog.Infof("Adding debug handlers to kubelet server.")
var ws *restful.WebService

ws = new(restful.WebService)
ws := new(restful.WebService)
ws.
Path("/run")
ws.Route(ws.POST("/{podNamespace}/{podID}/{containerName}").
Expand Down Expand Up @@ -429,7 +427,7 @@ func (s *Server) syncLoopHealthCheck(req *http.Request) error {
}
enterLoopTime := s.host.LatestLoopEntryTime()
if !enterLoopTime.IsZero() && time.Now().After(enterLoopTime.Add(duration)) {
return fmt.Errorf("Sync Loop took longer than expected.")
return fmt.Errorf("sync Loop took longer than expected")
}
return nil
}
Expand Down
15 changes: 0 additions & 15 deletions pkg/kubelet/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,21 +248,6 @@ func newServerTest() *serverTestFramework {
return fw
}

// encodeJSON returns obj marshalled as a JSON string, panicing on any errors
func encodeJSON(obj interface{}) string {
data, err := json.Marshal(obj)
if err != nil {
panic(err)
}
return string(data)
}

func readResp(resp *http.Response) (string, error) {
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
return string(body), err
}

// A helper function to return the correct pod name.
func getPodName(name, namespace string) string {
if namespace == "" {
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubelet/server/server_websocket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func TestServeWSPortForward(t *testing.T) {
}

if test.containerData != "" {
channel, data, err = wsRead(ws)
_, data, err = wsRead(ws)
if err != nil {
t.Fatalf("%d: unexpected error reading container data: %v", i, err)
}
Expand Down
7 changes: 0 additions & 7 deletions pkg/kubelet/server/stats/summary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,6 @@ func checkMemoryStats(t *testing.T, label string, seed int, info v2.ContainerInf
}
}

func checkFsStats(t *testing.T, capacity uint64, Available uint64, inodes uint64, inodesFree uint64, fs *kubestats.FsStats) {
assert.EqualValues(t, capacity, *fs.CapacityBytes)
assert.EqualValues(t, Available, *fs.AvailableBytes)
assert.EqualValues(t, inodesFree, *fs.InodesFree)
assert.EqualValues(t, inodes, *fs.Inodes)
}

func TestCustomMetrics(t *testing.T) {
spec := []v1.MetricSpec{
{
Expand Down