Merge pull request #1953 from CharlesQQ/karmada-agent-metrics
feat: agent add metrics-bind-address flag
This commit is contained in:
commit
5c3336e84c
|
@ -143,6 +143,7 @@ func run(ctx context.Context, karmadaConfig karmadactl.KarmadaConfig, opts *opti
|
||||||
LeaderElectionID: fmt.Sprintf("karmada-agent-%s", opts.ClusterName),
|
LeaderElectionID: fmt.Sprintf("karmada-agent-%s", opts.ClusterName),
|
||||||
LeaderElectionNamespace: opts.LeaderElection.ResourceNamespace,
|
LeaderElectionNamespace: opts.LeaderElection.ResourceNamespace,
|
||||||
LeaderElectionResourceLock: opts.LeaderElection.ResourceLock,
|
LeaderElectionResourceLock: opts.LeaderElection.ResourceLock,
|
||||||
|
MetricsBindAddress: opts.MetricsBindAddress,
|
||||||
Controller: v1alpha1.ControllerConfigurationSpec{
|
Controller: v1alpha1.ControllerConfigurationSpec{
|
||||||
GroupKindConcurrency: map[string]int{
|
GroupKindConcurrency: map[string]int{
|
||||||
workv1alpha1.SchemeGroupVersion.WithKind("Work").GroupKind().String(): opts.ConcurrentWorkSyncs,
|
workv1alpha1.SchemeGroupVersion.WithKind("Work").GroupKind().String(): opts.ConcurrentWorkSyncs,
|
||||||
|
|
|
@ -64,6 +64,11 @@ type Options struct {
|
||||||
// ConcurrentWorkSyncs is the number of work objects that are
|
// ConcurrentWorkSyncs is the number of work objects that are
|
||||||
// allowed to sync concurrently.
|
// allowed to sync concurrently.
|
||||||
ConcurrentWorkSyncs int
|
ConcurrentWorkSyncs int
|
||||||
|
// 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
|
||||||
|
|
||||||
RateLimiterOpts ratelimiterflag.Options
|
RateLimiterOpts ratelimiterflag.Options
|
||||||
}
|
}
|
||||||
|
@ -111,5 +116,6 @@ func (o *Options) AddFlags(fs *pflag.FlagSet, allControllers []string) {
|
||||||
fs.DurationVar(&o.ResyncPeriod.Duration, "resync-period", 0, "Base frequency the informers are resynced.")
|
fs.DurationVar(&o.ResyncPeriod.Duration, "resync-period", 0, "Base frequency the informers are resynced.")
|
||||||
fs.IntVar(&o.ConcurrentClusterSyncs, "concurrent-cluster-syncs", 5, "The number of Clusters that are allowed to sync concurrently.")
|
fs.IntVar(&o.ConcurrentClusterSyncs, "concurrent-cluster-syncs", 5, "The number of Clusters that are allowed to sync concurrently.")
|
||||||
fs.IntVar(&o.ConcurrentWorkSyncs, "concurrent-work-syncs", 5, "The number of Works that are allowed to sync concurrently.")
|
fs.IntVar(&o.ConcurrentWorkSyncs, "concurrent-work-syncs", 5, "The number of Works that are allowed to sync concurrently.")
|
||||||
|
fs.StringVar(&o.MetricsBindAddress, "metrics-bind-address", ":8080", "The TCP address that the controller should bind to for serving prometheus metrics(e.g. 127.0.0.1:8088, :8088)")
|
||||||
o.RateLimiterOpts.AddFlags(fs)
|
o.RateLimiterOpts.AddFlags(fs)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue