mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Remove unused selflink parameters from ContextBasedNaming
This commit is contained in:
parent
0ad588b27b
commit
1e0b9c6e20
@ -19,7 +19,6 @@ package apiserver
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@ -814,14 +813,6 @@ func (r *crdHandler) getOrCreateServingInfoFor(uid types.UID, name string) (*crd
|
|||||||
replicasPathInCustomResource,
|
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
|
clusterScoped := crd.Spec.Scope == apiextensionsv1.ClusterScoped
|
||||||
|
|
||||||
// CRDs explicitly do not support protobuf, but some objects returned by the API server do
|
// CRDs explicitly do not support protobuf, but some objects returned by the API server do
|
||||||
@ -845,7 +836,6 @@ func (r *crdHandler) getOrCreateServingInfoFor(uid types.UID, name string) (*crd
|
|||||||
Namer: handlers.ContextBasedNaming{
|
Namer: handlers.ContextBasedNaming{
|
||||||
Namer: meta.NewAccessor(),
|
Namer: meta.NewAccessor(),
|
||||||
ClusterScoped: clusterScoped,
|
ClusterScoped: clusterScoped,
|
||||||
SelfLinkPathPrefix: selfLinkPrefix,
|
|
||||||
},
|
},
|
||||||
Serializer: negotiatedSerializer,
|
Serializer: negotiatedSerializer,
|
||||||
ParameterCodec: parameterCodec,
|
ParameterCodec: parameterCodec,
|
||||||
@ -898,8 +888,6 @@ func (r *crdHandler) getOrCreateServingInfoFor(uid types.UID, name string) (*crd
|
|||||||
scaleScope.Namer = handlers.ContextBasedNaming{
|
scaleScope.Namer = handlers.ContextBasedNaming{
|
||||||
Namer: meta.NewAccessor(),
|
Namer: meta.NewAccessor(),
|
||||||
ClusterScoped: clusterScoped,
|
ClusterScoped: clusterScoped,
|
||||||
SelfLinkPathPrefix: selfLinkPrefix,
|
|
||||||
SelfLinkPathSuffix: "/scale",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if utilfeature.DefaultFeatureGate.Enabled(features.ServerSideApply) && subresources != nil && subresources.Scale != nil {
|
if utilfeature.DefaultFeatureGate.Enabled(features.ServerSideApply) && subresources != nil && subresources.Scale != nil {
|
||||||
@ -923,8 +911,6 @@ func (r *crdHandler) getOrCreateServingInfoFor(uid types.UID, name string) (*crd
|
|||||||
statusScope.Namer = handlers.ContextBasedNaming{
|
statusScope.Namer = handlers.ContextBasedNaming{
|
||||||
Namer: meta.NewAccessor(),
|
Namer: meta.NewAccessor(),
|
||||||
ClusterScoped: clusterScoped,
|
ClusterScoped: clusterScoped,
|
||||||
SelfLinkPathPrefix: selfLinkPrefix,
|
|
||||||
SelfLinkPathSuffix: "/status",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if utilfeature.DefaultFeatureGate.Enabled(features.ServerSideApply) && subresources != nil && subresources.Status != nil {
|
if utilfeature.DefaultFeatureGate.Enabled(features.ServerSideApply) && subresources != nil && subresources.Status != nil {
|
||||||
|
@ -41,9 +41,6 @@ type ScopeNamer interface {
|
|||||||
type ContextBasedNaming struct {
|
type ContextBasedNaming struct {
|
||||||
Namer runtime.Namer
|
Namer runtime.Namer
|
||||||
ClusterScoped bool
|
ClusterScoped bool
|
||||||
|
|
||||||
SelfLinkPathPrefix string
|
|
||||||
SelfLinkPathSuffix string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContextBasedNaming implements ScopeNamer
|
// ContextBasedNaming implements ScopeNamer
|
||||||
|
@ -19,7 +19,6 @@ package endpoints
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
gpath "path"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
@ -430,8 +429,6 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
|
|||||||
namer := handlers.ContextBasedNaming{
|
namer := handlers.ContextBasedNaming{
|
||||||
Namer: a.group.Namer,
|
Namer: a.group.Namer,
|
||||||
ClusterScoped: true,
|
ClusterScoped: true,
|
||||||
SelfLinkPathPrefix: gpath.Join(a.prefix, resource) + "/",
|
|
||||||
SelfLinkPathSuffix: suffix,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handler for standard REST verbs (GET, PUT, POST and DELETE).
|
// Handler for standard REST verbs (GET, PUT, POST and DELETE).
|
||||||
@ -479,8 +476,6 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
|
|||||||
namer := handlers.ContextBasedNaming{
|
namer := handlers.ContextBasedNaming{
|
||||||
Namer: a.group.Namer,
|
Namer: a.group.Namer,
|
||||||
ClusterScoped: false,
|
ClusterScoped: false,
|
||||||
SelfLinkPathPrefix: gpath.Join(a.prefix, namespaceParamName) + "/",
|
|
||||||
SelfLinkPathSuffix: itemPathSuffix,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
actions = appendIf(actions, action{"LIST", resourcePath, resourceParams, namer, false}, isLister)
|
actions = appendIf(actions, action{"LIST", resourcePath, resourceParams, namer, false}, isLister)
|
||||||
|
Loading…
Reference in New Issue
Block a user