-
Kubernetes Submit Queue authored
Automatic merge from submit-queue (batch tested with PRs 41145, 38771, 41003, 41089, 40365) Add `kubectl attach` support for multiple types To address this issue: https://github.com/kubernetes/kubernetes/issues/24857 the new `kubectl attach` will contain three scenarios depend on args: 1. `kubectl attach POD` : if only one argument provided, we assume it's a pod name 2. `kubectl attach TYPE NAME` : if two arguments provided, we assume first one is resource we [supported](https://github.com/shiywang/kubernetes/blob/4770162fd3fd0d65ff95348c71683cf4c717141a/pkg/kubectl/cmd/util/factory_object_mapping.go#L285), the second resource's name. 3. `kubectl attach TYPE/NAME` : one argument provided and arg[0] must contain `/`, ditto Is there any other scenarios I haven't consider in ? for now the first scenario is compatible with changed before, also `make test` pass
✅ will write some unit test to test second and third scenario, if you guys think i'm doing the right way. @pwittrock @kargakis @fabianofranz @ymqytw @AdoHece998a9f