Skip to content

Commit 9b9e742

Browse files
committed
fix leader election stack trace
fixes #11 Signed-off-by: Markus Blaschke <mblaschke82@gmail.com>
1 parent 00da062 commit 9b9e742

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

autopilot/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ import (
2222
_ "k8s.io/client-go/plugin/pkg/client/auth"
2323
"k8s.io/client-go/rest"
2424
"k8s.io/client-go/tools/clientcmd"
25+
"sigs.k8s.io/controller-runtime/pkg/log"
26+
27+
"github.com/go-logr/zapr"
2528

2629
"github.com/webdevopos/azure-k8s-autopilot/config"
2730
"github.com/webdevopos/azure-k8s-autopilot/k8s"
@@ -160,6 +163,8 @@ func (r *AzureK8sAutopilot) initK8s() {
160163
if err != nil {
161164
panic(err.Error())
162165
}
166+
167+
log.SetLogger(zapr.NewLogger(r.Logger.Desugar()))
163168
}
164169

165170
func (r *AzureK8sAutopilot) initMetricsGeneral() {

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ require (
77
github.com/KimMachineGun/automemlimit v0.6.1
88
github.com/containrrr/shoutrrr v0.8.0
99
github.com/dustin/go-humanize v1.0.1
10+
github.com/go-logr/zapr v1.3.0
1011
github.com/jessevdk/go-flags v1.6.1
1112
github.com/jinzhu/copier v0.4.0
1213
github.com/operator-framework/operator-lib v0.15.0
@@ -20,6 +21,7 @@ require (
2021
k8s.io/api v0.31.1
2122
k8s.io/apimachinery v0.31.1
2223
k8s.io/client-go v0.31.1
24+
sigs.k8s.io/controller-runtime v0.19.0
2325
)
2426

2527
require (
@@ -89,7 +91,6 @@ require (
8991
k8s.io/klog/v2 v2.130.1 // indirect
9092
k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38 // indirect
9193
k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3 // indirect
92-
sigs.k8s.io/controller-runtime v0.19.0 // indirect
9394
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
9495
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
9596
sigs.k8s.io/yaml v1.4.0 // indirect

0 commit comments

Comments
 (0)