@@ -327,7 +327,34 @@ func (o *Options) Complete(ctx context.Context, rootDir string) (*CompletedOptio
327327 o .GenericControlPlane .ServiceAccountSigningKeyFile = o .Controllers .SAController .ServiceAccountKeyFile
328328 }
329329
330- completedGenericOptions , err := o .GenericControlPlane .Complete (ctx , nil , nil )
330+ // o.GenericControlPlane.Complete creates self-signed certificates
331+ // with the advertise address by default. This can cause spurious
332+ // errors if the server binds on multiple interfaces.
333+ possibleIPs := []net.IP {
334+ o .GenericControlPlane .GenericServerRunOptions .AdvertiseAddress ,
335+ o .GenericControlPlane .SecureServing .BindAddress ,
336+ o .GenericControlPlane .SecureServing .ExternalAddress ,
337+ }
338+ if o .GenericControlPlane .SecureServing .Listener != nil {
339+ host , _ , err := net .SplitHostPort (o .GenericControlPlane .SecureServing .Listener .Addr ().String ())
340+ if err != nil {
341+ return nil , err
342+ }
343+ possibleIPs = append (possibleIPs , net .ParseIP (host ))
344+ }
345+
346+ alternateIPs := []net.IP {}
347+ alternateDNS := []string {}
348+
349+ for _ , ip := range possibleIPs {
350+ if ip == nil || ip .IsUnspecified () {
351+ continue
352+ }
353+ alternateIPs = append (alternateIPs , ip )
354+ alternateDNS = append (alternateDNS , ip .String ())
355+ }
356+
357+ completedGenericOptions , err := o .GenericControlPlane .Complete (ctx , alternateDNS , alternateIPs )
331358 if err != nil {
332359 return nil , err
333360 }
0 commit comments