-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collect metrics #505
Collect metrics #505
Changes from all commits
ea6e9f2
3bd031b
1c5b327
24458fb
701f224
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,20 +19,29 @@ package options | |
|
||
import ( | ||
"github.com/spf13/pflag" | ||
|
||
utilerrors "k8s.io/apimachinery/pkg/util/errors" | ||
apiserveroptions "k8s.io/apiserver/pkg/server/options" | ||
clientset "k8s.io/client-go/kubernetes" | ||
|
||
"k8s.io/component-base/logs" | ||
|
||
"sigs.k8s.io/descheduler/pkg/apis/componentconfig" | ||
"sigs.k8s.io/descheduler/pkg/apis/componentconfig/v1alpha1" | ||
deschedulerscheme "sigs.k8s.io/descheduler/pkg/descheduler/scheme" | ||
) | ||
|
||
const ( | ||
DefaultDeschedulerPort = 10258 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you mention in somewhere that port There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added some comments into |
||
) | ||
|
||
// DeschedulerServer configuration | ||
type DeschedulerServer struct { | ||
componentconfig.DeschedulerConfiguration | ||
Client clientset.Interface | ||
Logs *logs.Options | ||
|
||
Client clientset.Interface | ||
Logs *logs.Options | ||
SecureServing *apiserveroptions.SecureServingOptionsWithLoopback | ||
DisableMetrics bool | ||
} | ||
|
||
// NewDeschedulerServer creates a new DeschedulerServer with default parameters | ||
|
@@ -41,9 +50,14 @@ func NewDeschedulerServer() (*DeschedulerServer, error) { | |
if err != nil { | ||
return nil, err | ||
} | ||
|
||
secureServing := apiserveroptions.NewSecureServingOptions().WithLoopback() | ||
secureServing.BindPort = DefaultDeschedulerPort | ||
|
||
return &DeschedulerServer{ | ||
DeschedulerConfiguration: *cfg, | ||
Logs: logs.NewOptions(), | ||
SecureServing: secureServing, | ||
}, nil | ||
} | ||
|
||
|
@@ -77,4 +91,7 @@ func (rs *DeschedulerServer) AddFlags(fs *pflag.FlagSet) { | |
fs.IntVar(&rs.MaxNoOfPodsToEvictPerNode, "max-pods-to-evict-per-node", rs.MaxNoOfPodsToEvictPerNode, "DEPRECATED: limits the maximum number of pods to be evicted per node by descheduler") | ||
// evict-local-storage-pods allows eviction of pods that are using local storage. This is false by default. | ||
fs.BoolVar(&rs.EvictLocalStoragePods, "evict-local-storage-pods", rs.EvictLocalStoragePods, "DEPRECATED: enables evicting pods using local storage by descheduler") | ||
fs.BoolVar(&rs.DisableMetrics, "disable-metrics", rs.DisableMetrics, "Disables metrics. The metrics are by default served through https://localhost:10258/metrics. Secure address, resp. port can be changed through --bind-address, resp. --secure-port flags.") | ||
|
||
rs.SecureServing.AddFlags(fs) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update the table of contents too? (we should add a verify script for that...)
Other than that, lgtm
/approve
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done