mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 12:07:47 +00:00
run grep-sed
This commit is contained in:
parent
29d3351b69
commit
654ceb6e5a
@ -667,7 +667,7 @@ func runPatchTest(c *client.Client) {
|
|||||||
glog.Fatalf("Failed creating patchservice: %v", err)
|
glog.Fatalf("Failed creating patchservice: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
patchBodies := map[string]map[api.PatchType]struct {
|
patchBodies := map[string]map[unversioned.PatchType]struct {
|
||||||
AddLabelBody []byte
|
AddLabelBody []byte
|
||||||
RemoveLabelBody []byte
|
RemoveLabelBody []byte
|
||||||
RemoveAllLabelsBody []byte
|
RemoveAllLabelsBody []byte
|
||||||
@ -693,7 +693,7 @@ func runPatchTest(c *client.Client) {
|
|||||||
|
|
||||||
pb := patchBodies[c.APIVersion()]
|
pb := patchBodies[c.APIVersion()]
|
||||||
|
|
||||||
execPatch := func(pt api.PatchType, body []byte) error {
|
execPatch := func(pt unversioned.PatchType, body []byte) error {
|
||||||
return c.Patch(pt).
|
return c.Patch(pt).
|
||||||
Resource(resource).
|
Resource(resource).
|
||||||
Namespace(api.NamespaceDefault).
|
Namespace(api.NamespaceDefault).
|
||||||
|
@ -481,7 +481,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
|
|||||||
Operation("patch"+namespaced+kind+strings.Title(subresource)).
|
Operation("patch"+namespaced+kind+strings.Title(subresource)).
|
||||||
Produces(append(storageMeta.ProducesMIMETypes(action.Verb), "application/json")...).
|
Produces(append(storageMeta.ProducesMIMETypes(action.Verb), "application/json")...).
|
||||||
Returns(http.StatusOK, "OK", versionedObject).
|
Returns(http.StatusOK, "OK", versionedObject).
|
||||||
Reads(api.Patch{}).
|
Reads(unversioned.Patch{}).
|
||||||
Writes(versionedObject)
|
Writes(versionedObject)
|
||||||
addParams(route, action.Params)
|
addParams(route, action.Params)
|
||||||
ws.Route(route)
|
ws.Route(route)
|
||||||
|
@ -41,6 +41,6 @@ func IndexHandler(container *restful.Container, muxHelper *MuxHelper) func(http.
|
|||||||
// Extract the paths handled using mux handler.
|
// Extract the paths handled using mux handler.
|
||||||
handledPaths = append(handledPaths, muxHelper.RegisteredPaths...)
|
handledPaths = append(handledPaths, muxHelper.RegisteredPaths...)
|
||||||
sort.Strings(handledPaths)
|
sort.Strings(handledPaths)
|
||||||
writeRawJSON(status, api.RootPaths{Paths: handledPaths}, w)
|
writeRawJSON(status, unversioned.RootPaths{Paths: handledPaths}, w)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ func PatchResource(r rest.Patcher, scope RequestScope, typer runtime.ObjectTyper
|
|||||||
if idx := strings.Index(contentType, ";"); idx > 0 {
|
if idx := strings.Index(contentType, ";"); idx > 0 {
|
||||||
contentType = contentType[:idx]
|
contentType = contentType[:idx]
|
||||||
}
|
}
|
||||||
patchType := api.PatchType(contentType)
|
patchType := unversioned.PatchType(contentType)
|
||||||
|
|
||||||
patchJS, err := readBody(req.Request)
|
patchJS, err := readBody(req.Request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -432,7 +432,7 @@ func PatchResource(r rest.Patcher, scope RequestScope, typer runtime.ObjectTyper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// patchResource divides PatchResource for easier unit testing
|
// patchResource divides PatchResource for easier unit testing
|
||||||
func patchResource(ctx api.Context, timeout time.Duration, versionedObj runtime.Object, patcher rest.Patcher, name string, patchType api.PatchType, patchJS []byte, namer ScopeNamer, codec runtime.Codec) (runtime.Object, error) {
|
func patchResource(ctx api.Context, timeout time.Duration, versionedObj runtime.Object, patcher rest.Patcher, name string, patchType unversioned.PatchType, patchJS []byte, namer ScopeNamer, codec runtime.Codec) (runtime.Object, error) {
|
||||||
namespace := api.NamespaceValue(ctx)
|
namespace := api.NamespaceValue(ctx)
|
||||||
|
|
||||||
original, err := patcher.Get(ctx, name)
|
original, err := patcher.Get(ctx, name)
|
||||||
@ -806,7 +806,7 @@ func setListSelfLink(obj runtime.Object, req *restful.Request, namer ScopeNamer)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getPatchedJS(patchType api.PatchType, originalJS, patchJS []byte, obj runtime.Object) ([]byte, error) {
|
func getPatchedJS(patchType unversioned.PatchType, originalJS, patchJS []byte, obj runtime.Object) ([]byte, error) {
|
||||||
switch patchType {
|
switch patchType {
|
||||||
case api.JSONPatchType:
|
case api.JSONPatchType:
|
||||||
patchObj, err := jsonpatch.DecodePatch(patchJS)
|
patchObj, err := jsonpatch.DecodePatch(patchJS)
|
||||||
|
@ -169,7 +169,7 @@ func (tc *patchTestCase) Run(t *testing.T) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, patchType := range []api.PatchType{api.JSONPatchType, api.MergePatchType, api.StrategicMergePatchType} {
|
for _, patchType := range []unversioned.PatchType{api.JSONPatchType, api.MergePatchType, api.StrategicMergePatchType} {
|
||||||
// TODO SUPPORT THIS!
|
// TODO SUPPORT THIS!
|
||||||
if patchType == api.JSONPatchType {
|
if patchType == api.JSONPatchType {
|
||||||
continue
|
continue
|
||||||
|
@ -51,7 +51,7 @@ func (c *RESTClient) Put() *unversioned.Request {
|
|||||||
return unversioned.NewRequest(c, "PUT", &url.URL{Host: "localhost"}, testapi.Default.Version(), c.Codec)
|
return unversioned.NewRequest(c, "PUT", &url.URL{Host: "localhost"}, testapi.Default.Version(), c.Codec)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *RESTClient) Patch(_ api.PatchType) *unversioned.Request {
|
func (c *RESTClient) Patch(_ unversioned.PatchType) *unversioned.Request {
|
||||||
return unversioned.NewRequest(c, "PATCH", &url.URL{Host: "localhost"}, testapi.Default.Version(), c.Codec)
|
return unversioned.NewRequest(c, "PATCH", &url.URL{Host: "localhost"}, testapi.Default.Version(), c.Codec)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ func (c *RESTClient) Put() *Request {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Patch begins a PATCH request. Short for c.Verb("Patch").
|
// Patch begins a PATCH request. Short for c.Verb("Patch").
|
||||||
func (c *RESTClient) Patch(pt api.PatchType) *Request {
|
func (c *RESTClient) Patch(pt unversioned.PatchType) *Request {
|
||||||
return c.Verb("PATCH").SetHeader("Content-Type", string(pt))
|
return c.Verb("PATCH").SetHeader("Content-Type", string(pt))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
type RESTClient interface {
|
type RESTClient interface {
|
||||||
Get() *client.Request
|
Get() *client.Request
|
||||||
Post() *client.Request
|
Post() *client.Request
|
||||||
Patch(api.PatchType) *client.Request
|
Patch(unversioned.PatchType) *client.Request
|
||||||
Delete() *client.Request
|
Delete() *client.Request
|
||||||
Put() *client.Request
|
Put() *client.Request
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ func (m *Helper) Create(namespace string, modify bool, data []byte) (runtime.Obj
|
|||||||
func (m *Helper) createResource(c RESTClient, resource, namespace string, data []byte) (runtime.Object, error) {
|
func (m *Helper) createResource(c RESTClient, resource, namespace string, data []byte) (runtime.Object, error) {
|
||||||
return c.Post().NamespaceIfScoped(namespace, m.NamespaceScoped).Resource(resource).Body(data).Do().Get()
|
return c.Post().NamespaceIfScoped(namespace, m.NamespaceScoped).Resource(resource).Body(data).Do().Get()
|
||||||
}
|
}
|
||||||
func (m *Helper) Patch(namespace, name string, pt api.PatchType, data []byte) (runtime.Object, error) {
|
func (m *Helper) Patch(namespace, name string, pt unversioned.PatchType, data []byte) (runtime.Object, error) {
|
||||||
return m.RESTClient.Patch(pt).
|
return m.RESTClient.Patch(pt).
|
||||||
NamespaceIfScoped(namespace, m.NamespaceScoped).
|
NamespaceIfScoped(namespace, m.NamespaceScoped).
|
||||||
Resource(m.Resource).
|
Resource(m.Resource).
|
||||||
|
@ -27,7 +27,7 @@ import (
|
|||||||
type RESTClient interface {
|
type RESTClient interface {
|
||||||
Get() *client.Request
|
Get() *client.Request
|
||||||
Post() *client.Request
|
Post() *client.Request
|
||||||
Patch(api.PatchType) *client.Request
|
Patch(unversioned.PatchType) *client.Request
|
||||||
Delete() *client.Request
|
Delete() *client.Request
|
||||||
Put() *client.Request
|
Put() *client.Request
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user