kubectl attach support for multiple types

hot fix

add unit test and statefulSet

update example

remove package

change to ResourceNames

remove some code

remove strings

add fake testing func for AttachablePodForObject

minor change

add test.obj nil check

update testfile

gofmt

update

add fallthough

revert back
This commit is contained in:
shiywang
2017-01-24 22:28:52 +08:00
committed by Shiyang Wang
parent 01c45f7de1
commit 919cb19706
4 changed files with 133 additions and 49 deletions

View File

@@ -591,6 +591,19 @@ func (f *fakeAPIFactory) LogsForObject(object, options runtime.Object) (*restcli
}
}
func (f *fakeAPIFactory) AttachablePodForObject(object runtime.Object) (*api.Pod, error) {
switch t := object.(type) {
case *api.Pod:
return t, nil
default:
gvks, _, err := api.Scheme.ObjectKinds(object)
if err != nil {
return nil, err
}
return nil, fmt.Errorf("cannot attach to %v: not implemented", gvks[0])
}
}
func (f *fakeAPIFactory) Validator(validate bool, cacheDir string) (validation.Schema, error) {
return f.tf.Validator, f.tf.Err
}