Skip to content

Commit 52ffac4

Browse files
committed
Reapply "Drop obsolete go collector in favor of controller-runtime" (#499)
This reverts commit 9f48634. Breaking back-and-forth in controller-runtime. This adapts to kubernetes-sigs/controller-runtime#3070
1 parent be1e631 commit 52ffac4

File tree

2 files changed

+0
-12
lines changed
  • cmd/sharder/app
  • webhosting-operator/cmd/webhosting-operator

2 files changed

+0
-12
lines changed

cmd/sharder/app/app.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"fmt"
2222

2323
"github.com/go-logr/logr"
24-
"github.com/prometheus/client_golang/prometheus/collectors"
2524
"github.com/spf13/cobra"
2625
"github.com/spf13/pflag"
2726
"go.uber.org/automaxprocs/maxprocs"
@@ -32,7 +31,6 @@ import (
3231
logf "sigs.k8s.io/controller-runtime/pkg/log"
3332
"sigs.k8s.io/controller-runtime/pkg/log/zap"
3433
"sigs.k8s.io/controller-runtime/pkg/manager"
35-
"sigs.k8s.io/controller-runtime/pkg/metrics"
3634

3735
"github.com/timebertt/kubernetes-controller-sharding/pkg/controller"
3836
healthzutils "github.com/timebertt/kubernetes-controller-sharding/pkg/utils/healthz"
@@ -92,10 +90,6 @@ func run(ctx context.Context, log logr.Logger, opts *options) error {
9290
log.Error(err, "Failed to set GOMAXPROCS")
9391
}
9492

95-
// replace deprecated legacy go collector
96-
metrics.Registry.Unregister(collectors.NewGoCollector())
97-
metrics.Registry.MustRegister(collectors.NewGoCollector(collectors.WithGoCollectorRuntimeMetrics(collectors.MetricsAll)))
98-
9993
log.Info("Setting up manager")
10094
mgr, err := manager.New(opts.restConfig, opts.managerOptions)
10195
if err != nil {

webhosting-operator/cmd/webhosting-operator/main.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
goruntime "runtime"
2525
"strconv"
2626

27-
"github.com/prometheus/client_golang/prometheus/collectors"
2827
"go.uber.org/automaxprocs/maxprocs"
2928
"go.uber.org/zap/zapcore"
3029
appsv1 "k8s.io/api/apps/v1"
@@ -43,7 +42,6 @@ import (
4342
"sigs.k8s.io/controller-runtime/pkg/client"
4443
"sigs.k8s.io/controller-runtime/pkg/healthz"
4544
"sigs.k8s.io/controller-runtime/pkg/log/zap"
46-
"sigs.k8s.io/controller-runtime/pkg/metrics"
4745
"sigs.k8s.io/controller-runtime/pkg/metrics/filters"
4846
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
4947

@@ -102,10 +100,6 @@ func main() {
102100
setupLog.Error(err, "Failed to set GOMAXPROCS")
103101
}
104102

105-
// replace deprecated legacy go collector
106-
metrics.Registry.Unregister(collectors.NewGoCollector())
107-
metrics.Registry.MustRegister(collectors.NewGoCollector(collectors.WithGoCollectorRuntimeMetrics(collectors.MetricsAll)))
108-
109103
mgr, err := ctrl.NewManager(opts.restConfig, opts.managerOptions)
110104
if err != nil {
111105
setupLog.Error(err, "unable to start manager")

0 commit comments

Comments
 (0)