mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Simplify 'kubectl edit' logic
edit: make editFn operate on arguments regardless of mode edit: simplify short-circuiting logic when re-editing a file containing an error edit: factor out visitor building edit: use resource builder to get results from edited file
This commit is contained in:
@@ -221,6 +221,20 @@ func TestEdit(t *testing.T) {
|
||||
Client: fake.CreateHTTPClient(reqResp),
|
||||
}, nil
|
||||
}
|
||||
tf.UnstructuredClientForMappingFunc = func(mapping *meta.RESTMapping) (resource.RESTClient, error) {
|
||||
versionedAPIPath := ""
|
||||
if mapping.GroupVersionKind.Group == "" {
|
||||
versionedAPIPath = "/api/" + mapping.GroupVersionKind.Version
|
||||
} else {
|
||||
versionedAPIPath = "/apis/" + mapping.GroupVersionKind.Group + "/" + mapping.GroupVersionKind.Version
|
||||
}
|
||||
return &fake.RESTClient{
|
||||
APIRegistry: api.Registry,
|
||||
VersionedAPIPath: versionedAPIPath,
|
||||
NegotiatedSerializer: unstructuredSerializer,
|
||||
Client: fake.CreateHTTPClient(reqResp),
|
||||
}, nil
|
||||
}
|
||||
|
||||
if len(testcase.Namespace) > 0 {
|
||||
tf.Namespace = testcase.Namespace
|
||||
|
||||
Reference in New Issue
Block a user