Skip to content
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

Add ListenerConfig for metrics #1

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/metrics/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ type Options struct {
// TLSOpts is used to allow configuring the TLS config used for the server.
// This also allows providing a certificate via GetCertificate.
TLSOpts []func(*tls.Config)

// ListenConfig contains options for listening to an address on the metric server.
// Note: This does not work with SecureServing=true
ListenConfig net.ListenConfig
}

// Filter is a func that is added around metrics and extra handlers on the metrics server.
Expand Down Expand Up @@ -249,7 +253,7 @@ func (s *defaultServer) Start(ctx context.Context) error {

func (s *defaultServer) createListener(ctx context.Context, log logr.Logger) (net.Listener, error) {
if !s.options.SecureServing {
return net.Listen("tcp", s.options.BindAddress)
return s.options.ListenConfig.Listen(context.Background(), "tcp", s.options.BindAddress)
}

cfg := &tls.Config{ //nolint:gosec
Expand Down