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:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user