Skip to content

Commit

Permalink
Merge pull request kubernetes#3891 from nikhiljindal/Operation
Browse files Browse the repository at this point in the history
Deleting OperationHandler for handling /operation endpoint on server
  • Loading branch information
bgrant0607 committed Jan 29, 2015
2 parents 9bfdfa0 + 521728e commit fcb1cd3
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 43 deletions.
5 changes: 1 addition & 4 deletions pkg/apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func addParamIf(b *restful.RouteBuilder, parameter *restful.Parameter, shouldAdd
return b.Param(parameter)
}

// InstallREST registers the REST handlers (storage, watch, and operations) into a restful Container.
// InstallREST registers the REST handlers (storage, watch, proxy and redirect) into a restful Container.
// It is expected that the provided path root prefix will serve all operations. Root MUST NOT end
// in a slash. A restful WebService is created for the group and version.
func (g *APIGroupVersion) InstallREST(container *restful.Container, mux Mux, root string, version string) error {
Expand All @@ -210,7 +210,6 @@ func (g *APIGroupVersion) InstallREST(container *restful.Container, mux Mux, roo
}
proxyHandler := &ProxyHandler{prefix + "/proxy/", g.handler.storage, g.handler.codec}
redirectHandler := &RedirectHandler{g.handler.storage, g.handler.codec}
opHandler := &OperationHandler{g.handler.ops, g.handler.codec}

// Create a new WebService for this APIGroupVersion at the specified path prefix
// TODO: Pass in more descriptive documentation
Expand Down Expand Up @@ -269,8 +268,6 @@ func (g *APIGroupVersion) InstallREST(container *restful.Container, mux Mux, roo
mux.Handle(prefix+"/watch/", http.StripPrefix(prefix+"/watch/", watchHandler))
mux.Handle(prefix+"/proxy/", http.StripPrefix(prefix+"/proxy/", proxyHandler))
mux.Handle(prefix+"/redirect/", http.StripPrefix(prefix+"/redirect/", redirectHandler))
mux.Handle(prefix+"/operations", http.StripPrefix(prefix+"/operations", opHandler))
mux.Handle(prefix+"/operations/", http.StripPrefix(prefix+"/operations/", opHandler))

container.Add(ws)

Expand Down
35 changes: 0 additions & 35 deletions pkg/apiserver/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,16 @@ limitations under the License.
package apiserver

import (
"net/http"
"sort"
"strconv"
"sync"
"sync/atomic"
"time"

"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
)

type OperationHandler struct {
ops *Operations
codec runtime.Codec
}

func (h *OperationHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
parts := splitPath(req.URL.Path)
if len(parts) > 1 || req.Method != "GET" {
notFound(w, req)
return
}
if len(parts) == 0 {
// List outstanding operations.
list := h.ops.List()
writeJSON(http.StatusOK, h.codec, list, w)
return
}

op := h.ops.Get(parts[0])
if op == nil {
notFound(w, req)
return
}

result, complete := op.StatusOrResult()
obj := result.Object
if complete {
writeJSON(http.StatusOK, h.codec, obj, w)
} else {
writeJSON(http.StatusAccepted, h.codec, obj, w)
}
}

// Operation represents an ongoing action which the server is performing.
type Operation struct {
ID string
Expand Down
4 changes: 0 additions & 4 deletions test/integration/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,6 @@ func getTestRequests() []struct {
{"GET", "/api/v1beta1/foo/a", "", code404},
{"DELETE", "/api/v1beta1/foo" + timeoutFlag, "", code404},

// Operations
{"GET", "/api/v1beta1/operations", "", code200},
{"GET", "/api/v1beta1/operations/1234567890", "", code404},

// Special verbs on nodes
// TODO: Will become 405 once these are converted to go-restful
{"GET", "/api/v1beta1/proxy/minions/a", "", code404},
Expand Down

0 comments on commit fcb1cd3

Please sign in to comment.