Skip to content

Commit

Permalink
Try and get the right logger to vencon
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Wall <[email protected]>
  • Loading branch information
wallrj committed Nov 21, 2024
1 parent 124fe29 commit a7eae04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions pkg/agent/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
clientgocorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/client-go/tools/record"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/manager"

"github.com/jetstack/preflight/api"
"github.com/jetstack/preflight/pkg/client"
Expand Down Expand Up @@ -141,15 +140,14 @@ func Run(cmd *cobra.Command, args []string) (returnErr error) {
})
}

_, isVenConn := preflightClient.(*client.VenConnClient)
vcc, isVenConn := preflightClient.(*client.VenConnClient)
if isVenConn {
group.Go(func() error {
err := preflightClient.(manager.Runnable).Start(gctx)
err := vcc.Start(gctx)
if err != nil {
return fmt.Errorf("failed to start a controller-runtime component: %v", err)
return fmt.Errorf("failed to start the VenConnClient: %v", err)
}

// The agent must stop if the controller-runtime component stops.
// The agent must stop if the venafi-connection-lib client stops.
cancel()
return nil
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/logs/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func Initialize() error {
// to the global log logger. It can be removed when this is fixed upstream
// in vcert: https://github.com/Venafi/vcert/pull/512
vcertLog.SetPrefix("")

klog.EnableContextualLogging(true)
// The venafi-connection-lib client uses various controller-runtime packages
// which emit log messages. Make sure those log messages are not discarded.
ctrlruntimelog.SetLogger(klog.Background().WithValues("source", "controller-runtime"))
Expand Down

0 comments on commit a7eae04

Please sign in to comment.