mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
Remove unused selflink parameters from ContextBasedNaming
This commit is contained in:
parent
0ad588b27b
commit
1e0b9c6e20
@ -19,7 +19,6 @@ package apiserver
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"path"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
@ -814,14 +813,6 @@ func (r *crdHandler) getOrCreateServingInfoFor(uid types.UID, name string) (*crd
|
||||
replicasPathInCustomResource,
|
||||
)
|
||||
|
||||
selfLinkPrefix := ""
|
||||
switch crd.Spec.Scope {
|
||||
case apiextensionsv1.ClusterScoped:
|
||||
selfLinkPrefix = "/" + path.Join("apis", crd.Spec.Group, v.Name) + "/" + crd.Status.AcceptedNames.Plural + "/"
|
||||
case apiextensionsv1.NamespaceScoped:
|
||||
selfLinkPrefix = "/" + path.Join("apis", crd.Spec.Group, v.Name, "namespaces") + "/"
|
||||
}
|
||||
|
||||
clusterScoped := crd.Spec.Scope == apiextensionsv1.ClusterScoped
|
||||
|
||||
// CRDs explicitly do not support protobuf, but some objects returned by the API server do
|
||||
@ -843,9 +834,8 @@ func (r *crdHandler) getOrCreateServingInfoFor(uid types.UID, name string) (*crd
|
||||
|
||||
requestScopes[v.Name] = &handlers.RequestScope{
|
||||
Namer: handlers.ContextBasedNaming{
|
||||
Namer: meta.NewAccessor(),
|
||||
ClusterScoped: clusterScoped,
|
||||
SelfLinkPathPrefix: selfLinkPrefix,
|
||||
Namer: meta.NewAccessor(),
|
||||
ClusterScoped: clusterScoped,
|
||||
},
|
||||
Serializer: negotiatedSerializer,
|
||||
ParameterCodec: parameterCodec,
|
||||
@ -896,10 +886,8 @@ func (r *crdHandler) getOrCreateServingInfoFor(uid types.UID, name string) (*crd
|
||||
scaleScope.Serializer = serializer.NewCodecFactory(scaleConverter.Scheme())
|
||||
scaleScope.Kind = autoscalingv1.SchemeGroupVersion.WithKind("Scale")
|
||||
scaleScope.Namer = handlers.ContextBasedNaming{
|
||||
Namer: meta.NewAccessor(),
|
||||
ClusterScoped: clusterScoped,
|
||||
SelfLinkPathPrefix: selfLinkPrefix,
|
||||
SelfLinkPathSuffix: "/scale",
|
||||
Namer: meta.NewAccessor(),
|
||||
ClusterScoped: clusterScoped,
|
||||
}
|
||||
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.ServerSideApply) && subresources != nil && subresources.Scale != nil {
|
||||
@ -921,10 +909,8 @@ func (r *crdHandler) getOrCreateServingInfoFor(uid types.UID, name string) (*crd
|
||||
statusScope := *requestScopes[v.Name]
|
||||
statusScope.Subresource = "status"
|
||||
statusScope.Namer = handlers.ContextBasedNaming{
|
||||
Namer: meta.NewAccessor(),
|
||||
ClusterScoped: clusterScoped,
|
||||
SelfLinkPathPrefix: selfLinkPrefix,
|
||||
SelfLinkPathSuffix: "/status",
|
||||
Namer: meta.NewAccessor(),
|
||||
ClusterScoped: clusterScoped,
|
||||
}
|
||||
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.ServerSideApply) && subresources != nil && subresources.Status != nil {
|
||||
|
@ -41,9 +41,6 @@ type ScopeNamer interface {
|
||||
type ContextBasedNaming struct {
|
||||
Namer runtime.Namer
|
||||
ClusterScoped bool
|
||||
|
||||
SelfLinkPathPrefix string
|
||||
SelfLinkPathSuffix string
|
||||
}
|
||||
|
||||
// ContextBasedNaming implements ScopeNamer
|
||||
|
@ -19,7 +19,6 @@ package endpoints
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
gpath "path"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
@ -428,10 +427,8 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
|
||||
apiResource.Namespaced = false
|
||||
apiResource.Kind = resourceKind
|
||||
namer := handlers.ContextBasedNaming{
|
||||
Namer: a.group.Namer,
|
||||
ClusterScoped: true,
|
||||
SelfLinkPathPrefix: gpath.Join(a.prefix, resource) + "/",
|
||||
SelfLinkPathSuffix: suffix,
|
||||
Namer: a.group.Namer,
|
||||
ClusterScoped: true,
|
||||
}
|
||||
|
||||
// Handler for standard REST verbs (GET, PUT, POST and DELETE).
|
||||
@ -477,10 +474,8 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
|
||||
apiResource.Namespaced = true
|
||||
apiResource.Kind = resourceKind
|
||||
namer := handlers.ContextBasedNaming{
|
||||
Namer: a.group.Namer,
|
||||
ClusterScoped: false,
|
||||
SelfLinkPathPrefix: gpath.Join(a.prefix, namespaceParamName) + "/",
|
||||
SelfLinkPathSuffix: itemPathSuffix,
|
||||
Namer: a.group.Namer,
|
||||
ClusterScoped: false,
|
||||
}
|
||||
|
||||
actions = appendIf(actions, action{"LIST", resourcePath, resourceParams, namer, false}, isLister)
|
||||
|
Loading…
Reference in New Issue
Block a user