Skip to content

Commit 5b7783f

Browse files
committed
Fix Operation names for subresources
1 parent 5620b07 commit 5b7783f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

staging/src/k8s.io/apiserver/pkg/endpoints/installer.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,14 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
575575

576576
routes := []*restful.RouteBuilder{}
577577

578+
// If there is a subresource, kind should be the parent's kind.
579+
if hasSubresource {
580+
fqParentKind, err := a.getResourceKind(resource, a.group.Storage[resource])
581+
if err != nil {
582+
return nil, err
583+
}
584+
kind = fqParentKind.Kind
585+
}
578586
switch action.Verb {
579587
case "GET": // Get a resource.
580588
var handler restful.RouteFunction

staging/src/k8s.io/apiserver/pkg/endpoints/openapi/openapi.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ func GetOperationIDAndTags(r *restful.Route) (string, []string, error) {
6363
op := r.Operation
6464
path := r.Path
6565
var tags []string
66-
// TODO: This is hacky, figure out where this name conflict is created and fix it at the root.
67-
if strings.HasPrefix(path, "/apis/extensions/v1beta1/namespaces/{namespace}/") && strings.HasSuffix(op, "ScaleScale") {
68-
op = op[:len(op)-10] + strings.Title(strings.Split(path[48:], "/")[0]) + "Scale"
69-
}
7066
prefix, exists := verbs.GetPrefix(op)
7167
if !exists {
7268
return op, tags, fmt.Errorf("operation names should start with a verb. Cannot determine operation verb from %v", op)

0 commit comments

Comments
 (0)