Merge pull request #1341 from pigletfly/add-metrics-addr
Introduce `--metrics-bind-address` flag to `karmada-controller-manager`
This commit is contained in:
commit
ca2997293f
|
@ -83,6 +83,7 @@ func Run(ctx context.Context, opts *options.Options) error {
|
||||||
LeaderElectionResourceLock: opts.LeaderElection.ResourceLock,
|
LeaderElectionResourceLock: opts.LeaderElection.ResourceLock,
|
||||||
HealthProbeBindAddress: net.JoinHostPort(opts.BindAddress, strconv.Itoa(opts.SecurePort)),
|
HealthProbeBindAddress: net.JoinHostPort(opts.BindAddress, strconv.Itoa(opts.SecurePort)),
|
||||||
LivenessEndpointName: "/healthz",
|
LivenessEndpointName: "/healthz",
|
||||||
|
MetricsBindAddress: opts.MetricsBindAddress,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("failed to build controller manager: %v", err)
|
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.
|
// ResyncPeriod is the base frequency the informers are resynced.
|
||||||
// Defaults to 0, which means the created informer will never do resyncs.
|
// Defaults to 0, which means the created informer will never do resyncs.
|
||||||
ResyncPeriod metav1.Duration
|
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.
|
// 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.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.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.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