Add metrics-addr to expose prometheus metrics
Signed-off-by: pigletfly <wangbing.adam@gmail.com>
This commit is contained in:
parent
2c35bffb40
commit
98ae69139f
|
@ -83,6 +83,7 @@ func Run(ctx context.Context, opts *options.Options) error {
|
|||
LeaderElectionResourceLock: opts.LeaderElection.ResourceLock,
|
||||
HealthProbeBindAddress: net.JoinHostPort(opts.BindAddress, strconv.Itoa(opts.SecurePort)),
|
||||
LivenessEndpointName: "/healthz",
|
||||
MetricsBindAddress: opts.MetricsBindAddress,
|
||||
})
|
||||
if err != nil {
|
||||
klog.Errorf("failed to build controller manager: %v", err)
|
||||
|
|
|
@ -74,6 +74,11 @@ type Options struct {
|
|||
// ResyncPeriod is the base frequency the informers are resynced.
|
||||
// Defaults to 0, which means the created informer will never do resyncs.
|
||||
ResyncPeriod metav1.Duration
|
||||
// MetricsBindAddress is the TCP address that the controller should bind to
|
||||
// for serving prometheus metrics.
|
||||
// It can be set to "0" to disable the metrics serving.
|
||||
// Defaults to ":8080".
|
||||
MetricsBindAddress string
|
||||
}
|
||||
|
||||
// NewOptions builds an empty options.
|
||||
|
@ -126,4 +131,5 @@ func (o *Options) AddFlags(flags *pflag.FlagSet, allControllers []string) {
|
|||
flags.IntVar(&o.KubeAPIBurst, "kube-api-burst", 60, "Burst to use while talking with karmada-apiserver. Doesn't cover events and node heartbeat apis which rate limiting is controlled by a different set of flags.")
|
||||
flags.DurationVar(&o.ClusterCacheSyncTimeout.Duration, "cluster-cache-sync-timeout", util.CacheSyncTimeout, "Timeout period waiting for cluster cache to sync.")
|
||||
flags.DurationVar(&o.ResyncPeriod.Duration, "resync-period", 0, "Base frequency the informers are resynced.")
|
||||
flags.StringVar(&o.MetricsBindAddress, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue