Merge pull request #15666 from spowelljr/gapAuthLogs

Add gcp-auth to logs output if enabled
pull/15668/head
Medya Ghazizadeh 2023-01-18 17:13:28 -08:00 committed by GitHub
commit 7cf876c24e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -30,6 +30,7 @@ import (
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/audit"
"k8s.io/minikube/pkg/minikube/bootstrapper"
"k8s.io/minikube/pkg/minikube/command"
@ -265,7 +266,11 @@ func OutputOffline(lines int, logOutput *os.File) {
// logCommands returns a list of commands that would be run to receive the anticipated logs
func logCommands(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg config.ClusterConfig, length int, follow bool) map[string]string {
cmds := bs.LogCommands(cfg, bootstrapper.LogOptions{Lines: length, Follow: follow})
for _, pod := range importantPods {
pods := importantPods
if assets.Addons["gcp-auth"].IsEnabled(&cfg) {
pods = append(pods, "gcp-auth")
}
for _, pod := range pods {
ids, err := r.ListContainers(cruntime.ListContainersOptions{Name: pod})
if err != nil {
klog.Errorf("Failed to list containers for %q: %v", pod, err)