diff --git a/deploy/05-metrics_service.yaml b/deploy/05-metrics_service.yaml deleted file mode 100644 index 1ca7afa5..00000000 --- a/deploy/05-metrics_service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - name: configure-goalert-operator - name: configure-goalert-operator-metrics - namespace: configure-goalert-operator-operator -spec: - selector: - name: configure-goalert-operator - ports: - - name: metrics - port: 8080 - protocol: TCP - targetPort: 8080 diff --git a/main.go b/main.go index 9a08123e..34af8291 100644 --- a/main.go +++ b/main.go @@ -17,11 +17,13 @@ limitations under the License. package main import ( + "context" "flag" + "os" + "github.com/openshift/configure-goalert-operator/config" "github.com/openshift/configure-goalert-operator/pkg/localmetrics" "github.com/openshift/operator-custom-metrics/pkg/metrics" - "os" // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.) // to ensure that exec-entrypoint and run can make use of them. @@ -55,10 +57,8 @@ func init() { } func main() { - var metricsAddr string var enableLeaderElection bool var probeAddr string - flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.") flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") flag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+ @@ -73,7 +73,7 @@ func main() { mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ Scheme: scheme, - MetricsBindAddress: metricsAddr, + MetricsBindAddress: "0", Port: 9443, HealthProbeBindAddress: probeAddr, LeaderElection: enableLeaderElection, @@ -120,7 +120,7 @@ func main() { WithRoute(). GetConfig() - if err = metrics.ConfigureMetrics(ctrl.SetupSignalHandler(), *metricsServer); err != nil { + if err = metrics.ConfigureMetrics(context.TODO(), *metricsServer); err != nil { setupLog.Error(err, "failed to configure custom metrics") os.Exit(1) }