Skip to content

Commit 29ec87f

Browse files
committed
apiserver: add localhost to alternateDNS for IPv6
apiserver adds localhost to the alternateDNS field if the bind address is 0.0.0.0. This PR considers the IPv6 unspecified address too.
1 parent 16c2ae4 commit 29ec87f

File tree

1 file changed

+1
-2
lines changed
  • staging/src/k8s.io/apiserver/pkg/server/options

1 file changed

+1
-2
lines changed

staging/src/k8s.io/apiserver/pkg/server/options/serving.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,7 @@ func (s *SecureServingOptions) MaybeDefaultWithSelfSignedCerts(publicAddress str
287287

288288
if !canReadCertAndKey {
289289
// add either the bind address or localhost to the valid alternates
290-
bindIP := s.BindAddress.String()
291-
if bindIP == "0.0.0.0" {
290+
if s.BindAddress.IsUnspecified() {
292291
alternateDNS = append(alternateDNS, "localhost")
293292
} else {
294293
alternateIPs = append(alternateIPs, s.BindAddress)

0 commit comments

Comments
 (0)