Fix kubectl log for single-container pods

This commit is contained in:
Jeff Lowdermilk
2015-03-27 12:26:00 -07:00
parent e4fc45c26f
commit 243de3a472
2 changed files with 5 additions and 1 deletions

View File

@@ -100,6 +100,10 @@ func RunLog(f *Factory, out io.Writer, cmd *cobra.Command, args []string) error
var container string
if len(args) == 1 {
if len(pod.Spec.Containers) != 1 {
return fmt.Errorf("POD %s has more than one container; please specify the container to print logs for", pod.ObjectMeta.Name)
}
container = pod.Spec.Containers[0].Name
} else {
container = args[1]
}