From 61ba8ca0bc072035a5fd15301854b23eabec1e70 Mon Sep 17 00:00:00 2001 From: mbohlool Date: Thu, 20 Jul 2017 22:50:58 -0700 Subject: [PATCH] Fix Operation names for subresources --- staging/src/k8s.io/apiserver/pkg/endpoints/installer.go | 8 ++++++++ .../src/k8s.io/apiserver/pkg/endpoints/openapi/openapi.go | 4 ---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/installer.go b/staging/src/k8s.io/apiserver/pkg/endpoints/installer.go index ba1b15952fa..d740336f092 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/installer.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/installer.go @@ -577,6 +577,14 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag routes := []*restful.RouteBuilder{} + // If there is a subresource, kind should be the parent's kind. + if hasSubresource { + fqParentKind, err := a.getResourceKind(resource, a.group.Storage[resource]) + if err != nil { + return nil, err + } + kind = fqParentKind.Kind + } switch action.Verb { case "GET": // Get a resource. var handler restful.RouteFunction diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/openapi/openapi.go b/staging/src/k8s.io/apiserver/pkg/endpoints/openapi/openapi.go index 84e419c381b..352ebcb2ffd 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/openapi/openapi.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/openapi/openapi.go @@ -63,10 +63,6 @@ func GetOperationIDAndTags(r *restful.Route) (string, []string, error) { op := r.Operation path := r.Path var tags []string - // TODO: This is hacky, figure out where this name conflict is created and fix it at the root. - if strings.HasPrefix(path, "/apis/extensions/v1beta1/namespaces/{namespace}/") && strings.HasSuffix(op, "ScaleScale") { - op = op[:len(op)-10] + strings.Title(strings.Split(path[48:], "/")[0]) + "Scale" - } prefix, exists := verbs.GetPrefix(op) if !exists { return op, tags, fmt.Errorf("operation names should start with a verb. Cannot determine operation verb from %v", op)