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 server options #2519

Merged
merged 6 commits into from Jan 31, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/metrics/server/server.go
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
tomelliot16 marked this conversation as resolved.
Show resolved Hide resolved
}

// 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)
tomelliot16 marked this conversation as resolved.
Show resolved Hide resolved
}

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