opdev / opcap

Apache License 2.0
3 stars 15 forks source link

Don't fetch pod logs if containers never run #345

Closed madorn closed 1 year ago

madorn commented 1 year ago

example operator: vfunction-server-operator

This operator's image can't be pulled. result is ImagePullBackOff but despite no running containers we attempt https://github.com/opdev/opcap/blob/main/internal/capability/debug.go#L162

This results in the following error:

{"level":"error","ts":1674248067.5618343,"caller":"logger/logger.go:62","message":"error in audit: couldn't collect debug data: couldn't get pod logs: error in opening stream: container \"vfunction-server-operator\" in pod \"vfunction-server-operator-cb95b6dff-d9rb4\" is waiting to start: trying and failing to pull image","stacktrace":"github.com/opdev/opcap/internal/logger.Errorf\n\t/home/vagrant/opcap/internal/logger/logger.go:62\ngithub.com/opdev/opcap/internal/capability.RunAudits\n\t/home/vagrant/opcap/internal/capability/auditor.go:221\ngithub.com/opdev/opcap/cmd.runAudits\n\t/home/vagrant/opcap/cmd/check.go:78\ngithub.com/opdev/opcap/cmd.checkRunE\n\t/home/vagrant/opcap/cmd/check.go:73\ngithub.com/spf13/cobra.(*Command).execute\n\t/home/vagrant/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:916\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/home/vagrant/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:1044\ngithub.com/spf13/cobra.(*Command).Execute\n\t/home/vagrant/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:968\ngithub.com/spf13/cobra.(*Command).ExecuteContext\n\t/home/vagrant/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:961\ngithub.com/opdev/opcap/cmd.Execute\n\t/home/vagrant/opcap/cmd/root.go:44\nmain.main\n\t/home/vagrant/opcap/main.go:17\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:250"}

Everything stops here - we don't get a report and the namespace stays in Active status.

We then move on to the next operator.

Maybe we don't fetch logs if status.containerStatuses.state.waiting

madorn commented 1 year ago

same thing with fusion-analytics-operator

yashoza19 commented 1 year ago

same thing with smilecdr-operator