Skip to content

Commit 3db00ee

Browse files
committed
set loggers in 'up local' and test code
1 parent bf6e67a commit 3db00ee

File tree

2 files changed

+7
-0
lines changed
  • commands/operator-sdk/cmd/up
  • test/ansible-operator/cmd/ansible-operator

2 files changed

+7
-0
lines changed

commands/operator-sdk/cmd/up/local.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import (
3838
"github.com/spf13/cobra"
3939
"sigs.k8s.io/controller-runtime/pkg/client/config"
4040
"sigs.k8s.io/controller-runtime/pkg/manager"
41+
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
4142
)
4243

4344
func NewLocalCmd() *cobra.Command {
@@ -131,6 +132,9 @@ func upLocal() {
131132
func upLocalAnsible() {
132133
// Set the kubeconfig that the manager will be able to grab
133134
os.Setenv(k8sutil.KubeConfigEnvVar, kubeConfig)
135+
136+
logf.SetLogger(logf.ZapLogger(false))
137+
134138
mgr, err := manager.New(config.GetConfigOrDie(), manager.Options{Namespace: namespace})
135139
if err != nil {
136140
log.Fatal(err)

test/ansible-operator/cmd/ansible-operator/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
log "github.com/sirupsen/logrus"
2828
"sigs.k8s.io/controller-runtime/pkg/client/config"
2929
"sigs.k8s.io/controller-runtime/pkg/manager"
30+
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
3031
)
3132

3233
func printVersion() {
@@ -38,6 +39,8 @@ func printVersion() {
3839
func main() {
3940
flag.Parse()
4041

42+
logf.SetLogger(logf.ZapLogger(false))
43+
4144
namespace, err := k8sutil.GetWatchNamespace()
4245
if err != nil {
4346
log.Fatalf("failed to get watch namespace: (%v)", err)

0 commit comments

Comments
 (0)