kubectl/pkg/cmd/util/podcmd
Jian Li 3f7abd9859 cmd/kubectl: make 'kubectl logs' default to the first container when default container cannot be determined or found by annotations (#105964)
* cmd/kubectl: make 'kubectl logs' default to the first container.

While running 'kubectl logs <pod>', If '-c' is omited and the pod has more than one container, and no default container can be determined from annotations, this command shows an error message and exits. With this fix, it defaults to the first container in such scenarios and show its logs. This aligns behavior with what 'kubectl exec' does currently, and is more in line with KEP SIG-CLI 2227 design.

* fix unit test(forgotten)

* fix spelling typo

Kubernetes-commit: 0977a5d7cda59d5bd324bf2730846905e072fbbf
2022-01-07 09:40:41 +08:00
..
podcmd.go cmd/kubectl: make 'kubectl logs' default to the first container when default container cannot be determined or found by annotations (#105964) 2022-01-07 09:40:41 +08:00