mirror of https://github.com/k3s-io/k3s
Allow override of "kubernetes" endpoint port
parent
d50088fcfa
commit
ae595d76e6
|
@ -217,6 +217,8 @@ type SecureServingInfo struct {
|
|||
// HTTP2MaxStreamsPerConnection is the limit that the api server imposes on each client.
|
||||
// A value of zero means to use the default provided by golang's HTTP/2 support.
|
||||
HTTP2MaxStreamsPerConnection int
|
||||
|
||||
AdvertisePort int
|
||||
}
|
||||
|
||||
type AuthenticationInfo struct {
|
||||
|
@ -537,6 +539,9 @@ func (s *SecureServingInfo) HostPort() (string, int, error) {
|
|||
if err != nil {
|
||||
return "", 0, fmt.Errorf("invalid non-numeric port %q", portStr)
|
||||
}
|
||||
if s.AdvertisePort != 0 {
|
||||
port = s.AdvertisePort
|
||||
}
|
||||
return host, port, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -66,6 +66,8 @@ type SecureServingOptions struct {
|
|||
// HTTP2MaxStreamsPerConnection is the limit that the api server imposes on each client.
|
||||
// A value of zero means to use the default provided by golang's HTTP/2 support.
|
||||
HTTP2MaxStreamsPerConnection int
|
||||
|
||||
AdvertisePort int
|
||||
}
|
||||
|
||||
type CertKey struct {
|
||||
|
@ -153,6 +155,8 @@ func (s *SecureServingOptions) AddFlags(fs *pflag.FlagSet) {
|
|||
}
|
||||
fs.IntVar(&s.BindPort, "secure-port", s.BindPort, desc)
|
||||
|
||||
fs.IntVar(&s.AdvertisePort, "advertise-port", s.AdvertisePort, "The port that will be advertised as kubernetes endpoints")
|
||||
|
||||
fs.StringVar(&s.ServerCert.CertDirectory, "cert-dir", s.ServerCert.CertDirectory, ""+
|
||||
"The directory where the TLS certs are located. "+
|
||||
"If --tls-cert-file and --tls-private-key-file are provided, this flag will be ignored.")
|
||||
|
@ -265,6 +269,8 @@ func (s *SecureServingOptions) ApplyTo(config **server.SecureServingInfo) error
|
|||
return err
|
||||
}
|
||||
|
||||
c.AdvertisePort = s.AdvertisePort
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue