mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 10:19:50 +00:00
run grep-sed
This commit is contained in:
parent
cbb3deb182
commit
e3d984be27
@ -61,7 +61,7 @@ type documentable interface {
|
|||||||
var errEmptyName = errors.NewBadRequest("name must be provided")
|
var errEmptyName = errors.NewBadRequest("name must be provided")
|
||||||
|
|
||||||
// Installs handlers for API resources.
|
// Installs handlers for API resources.
|
||||||
func (a *APIInstaller) Install(ws *restful.WebService) (apiResources []api.APIResource, errors []error) {
|
func (a *APIInstaller) Install(ws *restful.WebService) (apiResources []unversioned.APIResource, errors []error) {
|
||||||
errors = make([]error, 0)
|
errors = make([]error, 0)
|
||||||
|
|
||||||
proxyHandler := (&ProxyHandler{a.prefix + "/proxy/", a.group.Storage, a.group.Codec, a.group.Context, a.info, a.proxyDialerFn})
|
proxyHandler := (&ProxyHandler{a.prefix + "/proxy/", a.group.Storage, a.group.Codec, a.group.Context, a.info, a.proxyDialerFn})
|
||||||
@ -100,7 +100,7 @@ func (a *APIInstaller) NewWebService() *restful.WebService {
|
|||||||
return ws
|
return ws
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storage, ws *restful.WebService, proxyHandler http.Handler) (*api.APIResource, error) {
|
func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storage, ws *restful.WebService, proxyHandler http.Handler) (*unversioned.APIResource, error) {
|
||||||
admit := a.group.Admit
|
admit := a.group.Admit
|
||||||
context := a.group.Context
|
context := a.group.Context
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
|
|||||||
params := []*restful.Parameter{}
|
params := []*restful.Parameter{}
|
||||||
actions := []action{}
|
actions := []action{}
|
||||||
|
|
||||||
var apiResource api.APIResource
|
var apiResource unversioned.APIResource
|
||||||
// Get the list of actions for the given scope.
|
// Get the list of actions for the given scope.
|
||||||
switch scope.Name() {
|
switch scope.Name() {
|
||||||
case meta.RESTScopeNameRoot:
|
case meta.RESTScopeNameRoot:
|
||||||
|
@ -46,7 +46,6 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/util/wsstream"
|
"k8s.io/kubernetes/pkg/util/wsstream"
|
||||||
"k8s.io/kubernetes/pkg/version"
|
"k8s.io/kubernetes/pkg/version"
|
||||||
|
|
||||||
"github.com/emicklei/go-restful"
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
)
|
)
|
||||||
@ -259,7 +258,7 @@ func AddApiWebService(container *restful.Container, apiPrefix string, versions [
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Adds a service to return the supported api versions at /apis.
|
// Adds a service to return the supported api versions at /apis.
|
||||||
func AddApisWebService(container *restful.Container, apiPrefix string, groups []api.APIGroup) {
|
func AddApisWebService(container *restful.Container, apiPrefix string, groups []unversioned.APIGroup) {
|
||||||
rootAPIHandler := RootAPIHandler(groups)
|
rootAPIHandler := RootAPIHandler(groups)
|
||||||
ws := new(restful.WebService)
|
ws := new(restful.WebService)
|
||||||
ws.Path(apiPrefix)
|
ws.Path(apiPrefix)
|
||||||
@ -274,7 +273,7 @@ func AddApisWebService(container *restful.Container, apiPrefix string, groups []
|
|||||||
|
|
||||||
// Adds a service to return the supported versions, preferred version, and name
|
// Adds a service to return the supported versions, preferred version, and name
|
||||||
// of a group. E.g., a such web service will be registered at /apis/extensions.
|
// of a group. E.g., a such web service will be registered at /apis/extensions.
|
||||||
func AddGroupWebService(container *restful.Container, path string, group api.APIGroup) {
|
func AddGroupWebService(container *restful.Container, path string, group unversioned.APIGroup) {
|
||||||
groupHandler := GroupHandler(group)
|
groupHandler := GroupHandler(group)
|
||||||
ws := new(restful.WebService)
|
ws := new(restful.WebService)
|
||||||
ws.Path(path)
|
ws.Path(path)
|
||||||
@ -289,7 +288,7 @@ func AddGroupWebService(container *restful.Container, path string, group api.API
|
|||||||
|
|
||||||
// Adds a service to return the supported resources, E.g., a such web service
|
// Adds a service to return the supported resources, E.g., a such web service
|
||||||
// will be registered at /apis/extensions/v1.
|
// will be registered at /apis/extensions/v1.
|
||||||
func AddSupportedResourcesWebService(ws *restful.WebService, groupVersion string, apiResources []api.APIResource) {
|
func AddSupportedResourcesWebService(ws *restful.WebService, groupVersion string, apiResources []unversioned.APIResource) {
|
||||||
resourceHandler := SupportedResourcesHandler(groupVersion, apiResources)
|
resourceHandler := SupportedResourcesHandler(groupVersion, apiResources)
|
||||||
ws.Route(ws.GET("/").To(resourceHandler).
|
ws.Route(ws.GET("/").To(resourceHandler).
|
||||||
Doc("get available resources").
|
Doc("get available resources").
|
||||||
@ -313,16 +312,16 @@ func APIVersionHandler(versions ...string) restful.RouteFunction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RootAPIHandler returns a handler which will list the provided groups and versions as available.
|
// RootAPIHandler returns a handler which will list the provided groups and versions as available.
|
||||||
func RootAPIHandler(groups []api.APIGroup) restful.RouteFunction {
|
func RootAPIHandler(groups []unversioned.APIGroup) restful.RouteFunction {
|
||||||
return func(req *restful.Request, resp *restful.Response) {
|
return func(req *restful.Request, resp *restful.Response) {
|
||||||
// TODO: use restful's Response methods
|
// TODO: use restful's Response methods
|
||||||
writeRawJSON(http.StatusOK, api.APIGroupList{Groups: groups}, resp.ResponseWriter)
|
writeRawJSON(http.StatusOK, unversioned.APIGroupList{Groups: groups}, resp.ResponseWriter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GroupHandler returns a handler which will return the api.GroupAndVersion of
|
// GroupHandler returns a handler which will return the api.GroupAndVersion of
|
||||||
// the group.
|
// the group.
|
||||||
func GroupHandler(group api.APIGroup) restful.RouteFunction {
|
func GroupHandler(group unversioned.APIGroup) restful.RouteFunction {
|
||||||
return func(req *restful.Request, resp *restful.Response) {
|
return func(req *restful.Request, resp *restful.Response) {
|
||||||
// TODO: use restful's Response methods
|
// TODO: use restful's Response methods
|
||||||
writeRawJSON(http.StatusOK, group, resp.ResponseWriter)
|
writeRawJSON(http.StatusOK, group, resp.ResponseWriter)
|
||||||
@ -330,10 +329,10 @@ func GroupHandler(group api.APIGroup) restful.RouteFunction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SupportedResourcesHandler returns a handler which will list the provided resources as available.
|
// SupportedResourcesHandler returns a handler which will list the provided resources as available.
|
||||||
func SupportedResourcesHandler(groupVersion string, apiResources []api.APIResource) restful.RouteFunction {
|
func SupportedResourcesHandler(groupVersion string, apiResources []unversioned.APIResource) restful.RouteFunction {
|
||||||
return func(req *restful.Request, resp *restful.Response) {
|
return func(req *restful.Request, resp *restful.Response) {
|
||||||
// TODO: use restful's Response methods
|
// TODO: use restful's Response methods
|
||||||
writeRawJSON(http.StatusOK, api.APIResourceList{GroupVersion: groupVersion, APIResources: apiResources}, resp.ResponseWriter)
|
writeRawJSON(http.StatusOK, unversioned.APIResourceList{GroupVersion: groupVersion, APIResources: apiResources}, resp.ResponseWriter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ func (m *Master) init(c *Config) {
|
|||||||
apiserver.InstallServiceErrorHandler(m.handlerContainer, m.newAPIRequestInfoResolver(), apiVersions)
|
apiserver.InstallServiceErrorHandler(m.handlerContainer, m.newAPIRequestInfoResolver(), apiVersions)
|
||||||
|
|
||||||
// allGroups records all supported groups at /apis
|
// allGroups records all supported groups at /apis
|
||||||
allGroups := []api.APIGroup{}
|
allGroups := []unversioned.APIGroup{}
|
||||||
if m.exp {
|
if m.exp {
|
||||||
m.thirdPartyStorage = c.StorageDestinations.APIGroups["extensions"].Default
|
m.thirdPartyStorage = c.StorageDestinations.APIGroups["extensions"].Default
|
||||||
m.thirdPartyResources = map[string]*thirdpartyresourcedataetcd.REST{}
|
m.thirdPartyResources = map[string]*thirdpartyresourcedataetcd.REST{}
|
||||||
@ -675,7 +675,7 @@ func (m *Master) init(c *Config) {
|
|||||||
if !found {
|
if !found {
|
||||||
glog.Fatalf("Couldn't find storage version of group %v", g.Group)
|
glog.Fatalf("Couldn't find storage version of group %v", g.Group)
|
||||||
}
|
}
|
||||||
group := api.APIGroup{
|
group := unversioned.APIGroup{
|
||||||
Name: g.Group,
|
Name: g.Group,
|
||||||
Versions: expAPIVersions,
|
Versions: expAPIVersions,
|
||||||
PreferredVersion: api.GroupVersion{GroupVersion: storageVersion, Version: apiutil.GetVersion(storageVersion)},
|
PreferredVersion: api.GroupVersion{GroupVersion: storageVersion, Version: apiutil.GetVersion(storageVersion)},
|
||||||
@ -995,7 +995,7 @@ func (m *Master) InstallThirdPartyResource(rsrc *expapi.ThirdPartyResource) erro
|
|||||||
GroupVersion: group + "/" + rsrc.Versions[0].Name,
|
GroupVersion: group + "/" + rsrc.Versions[0].Name,
|
||||||
Version: rsrc.Versions[0].Name,
|
Version: rsrc.Versions[0].Name,
|
||||||
}
|
}
|
||||||
apiGroup := api.APIGroup{
|
apiGroup := unversioned.APIGroup{
|
||||||
Name: group,
|
Name: group,
|
||||||
Versions: []api.GroupVersion{groupVersion},
|
Versions: []api.GroupVersion{groupVersion},
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ func TestDefaultAPIGroupVersion(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TestExpapi verifies that the unexported exapi creates
|
// TestExpapi verifies that the unexported exapi creates
|
||||||
// the an experimental api APIGroupVersion.
|
// the an experimental unversioned.APIGroupVersion.
|
||||||
func TestExpapi(t *testing.T) {
|
func TestExpapi(t *testing.T) {
|
||||||
master, config, assert := setUp(t)
|
master, config, assert := setUp(t)
|
||||||
|
|
||||||
@ -465,7 +465,7 @@ func TestDiscoveryAtAPIS(t *testing.T) {
|
|||||||
|
|
||||||
assert.Equal(http.StatusOK, resp.StatusCode)
|
assert.Equal(http.StatusOK, resp.StatusCode)
|
||||||
|
|
||||||
groupList := api.APIGroupList{}
|
groupList := unversioned.APIGroupList{}
|
||||||
assert.NoError(decodeResponse(resp, &groupList))
|
assert.NoError(decodeResponse(resp, &groupList))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user