mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-05-28 04:04:39 -04:00
Merge pull request #137591 from pacoxu/kubeadm-etcd-version
kubectl: only print default cotnainer if there are multi containers
This commit is contained in:
commit
9cfdbc0d6e
1 changed files with 1 additions and 1 deletions
|
|
@ -78,7 +78,7 @@ func FindOrDefaultContainerByName(pod *v1.Pod, name string, quiet bool, warn io.
|
|||
|
||||
// fallback to pick the first container to maintain existing behavior
|
||||
container := &pod.Spec.Containers[0]
|
||||
if !quiet {
|
||||
if !quiet && (len(pod.Spec.Containers) > 1 || len(pod.Spec.InitContainers) > 0 || len(pod.Spec.EphemeralContainers) > 0) {
|
||||
fmt.Fprintf(warn, "Defaulted container %q out of: %s\n", container.Name, AllContainerNames(pod)) // nolint:errcheck
|
||||
}
|
||||
klog.V(4).Infof("Using the first container in a pod: %s", container.Name)
|
||||
|
|
|
|||
Loading…
Reference in a new issue