mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
fix: upon DNS refresh() failure use previous values (#17561)
DNS refresh() in-case of MinIO can safely re-use the previous values on bare-metal setups, since bare-metal arrangements do not change DNS in any manner commonly. This PR simplifies that, we only ever need DNS caching on bare-metal setups. - On containerized setups do not enable DNS caching at all, as it may have adverse effects on the overall effectiveness of k8s DNS systems. k8s DNS systems are dynamic and expect applications to avoid managing DNS caching themselves, instead provide a cleaner container native caching implementations that must be used. - update IsDocker() detection, including podman runtime - move to minio/dnscache fork for a simpler package
This commit is contained in:
@@ -21,13 +21,11 @@ import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"net"
|
||||
"net/http"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/minio/pkg/certs"
|
||||
"github.com/rs/dnscache"
|
||||
)
|
||||
|
||||
// tlsClientSessionCacheSize is the cache size for client sessions.
|
||||
@@ -35,11 +33,8 @@ var tlsClientSessionCacheSize = 100
|
||||
|
||||
// ConnSettings - contains connection settings.
|
||||
type ConnSettings struct {
|
||||
// If this is non-nil, DNSCache and DialTimeout are ignored.
|
||||
DialContext func(ctx context.Context, network, addr string) (net.Conn, error)
|
||||
|
||||
// Dial settings, used if DialContext is nil.
|
||||
DNSCache *dnscache.Resolver
|
||||
DialContext DialContext // Custom dialContext, DialTimeout is ignored if this is already setup.
|
||||
LookupHost LookupHost // Custom lookupHost, is nil on containerized deployments.
|
||||
DialTimeout time.Duration
|
||||
|
||||
// TLS Settings
|
||||
@@ -57,7 +52,7 @@ type ConnSettings struct {
|
||||
func (s ConnSettings) getDefaultTransport() *http.Transport {
|
||||
dialContext := s.DialContext
|
||||
if dialContext == nil {
|
||||
dialContext = DialContextWithDNSCache(s.DNSCache, NewInternodeDialContext(s.DialTimeout, s.TCPOptions))
|
||||
dialContext = DialContextWithLookupHost(s.LookupHost, NewInternodeDialContext(s.DialTimeout, s.TCPOptions))
|
||||
}
|
||||
|
||||
tlsClientConfig := tls.Config{
|
||||
|
||||
Reference in New Issue
Block a user