Merge 9b26b9a21a
into 92ddc6c670
This commit is contained in:
commit
fbd1f1cef8
3 changed files with 31 additions and 8 deletions
|
@ -203,7 +203,7 @@ http {
|
||||||
server_name {{ $server.Hostname }};
|
server_name {{ $server.Hostname }};
|
||||||
listen [::]:80{{ if $cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ if eq $index 0 }} ipv6only=off{{end}}{{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $backlogSize }}{{end}};
|
listen [::]:80{{ if $cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ if eq $index 0 }} ipv6only=off{{end}}{{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $backlogSize }}{{end}};
|
||||||
{{/* Listen on 442 because port 443 is used in the stream section */}}
|
{{/* Listen on 442 because port 443 is used in the stream section */}}
|
||||||
{{ if not (empty $server.SSLCertificate) }}listen 442 {{ if $cfg.UseProxyProtocol }}proxy_protocol{{ end }} ssl {{ if $cfg.UseHTTP2 }}http2{{ end }};
|
{{ if not (empty $server.SSLCertificate) }}listen 442 {{ if $cfg.UseProxyProtocol }}proxy_protocol{{ end }} {{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $backlogSize }}{{end}} ssl {{ if $cfg.UseHTTP2 }}http2{{ end }};
|
||||||
{{/* comment PEM sha is required to detect changes in the generated configuration and force a reload */}}
|
{{/* comment PEM sha is required to detect changes in the generated configuration and force a reload */}}
|
||||||
# PEM sha: {{ $server.SSLPemChecksum }}
|
# PEM sha: {{ $server.SSLPemChecksum }}
|
||||||
ssl_certificate {{ $server.SSLCertificate }};
|
ssl_certificate {{ $server.SSLCertificate }};
|
||||||
|
|
|
@ -47,6 +47,7 @@ import (
|
||||||
"k8s.io/ingress/core/pkg/ingress/resolver"
|
"k8s.io/ingress/core/pkg/ingress/resolver"
|
||||||
"k8s.io/ingress/core/pkg/ingress/status"
|
"k8s.io/ingress/core/pkg/ingress/status"
|
||||||
"k8s.io/ingress/core/pkg/k8s"
|
"k8s.io/ingress/core/pkg/k8s"
|
||||||
|
ssl "k8s.io/ingress/core/pkg/net/ssl"
|
||||||
local_strings "k8s.io/ingress/core/pkg/strings"
|
local_strings "k8s.io/ingress/core/pkg/strings"
|
||||||
"k8s.io/ingress/core/pkg/task"
|
"k8s.io/ingress/core/pkg/task"
|
||||||
)
|
)
|
||||||
|
@ -827,9 +828,30 @@ func (ic *GenericController) createServers(data []interface{}, upstreams map[str
|
||||||
|
|
||||||
dun := ic.getDefaultUpstream().Name
|
dun := ic.getDefaultUpstream().Name
|
||||||
|
|
||||||
|
// This adds the Default Certificate to Default Backend and also for vhosts missing the secret
|
||||||
|
var defaultPemFileName, defaultPemSHA string
|
||||||
|
defaultCertificate, err := ic.getPemCertificate(ic.cfg.DefaultSSLCertificate)
|
||||||
|
// If no default Certificate was supplied, tries to generate a new dumb one
|
||||||
|
if err != nil {
|
||||||
|
var cert *ingress.SSLCert
|
||||||
|
defCert, defKey := ssl.GetFakeSSLCert()
|
||||||
|
cert, err = ssl.AddOrUpdateCertAndKey("system-snake-oil-certificate", defCert, defKey, []byte{})
|
||||||
|
if err != nil {
|
||||||
|
glog.Fatalf("Error generating self signed certificate: %v", err)
|
||||||
|
} else {
|
||||||
|
defaultPemFileName = cert.PemFileName
|
||||||
|
defaultPemSHA = cert.PemSHA
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
defaultPemFileName = defaultCertificate.PemFileName
|
||||||
|
defaultPemSHA = defaultCertificate.PemSHA
|
||||||
|
}
|
||||||
|
|
||||||
// default server
|
// default server
|
||||||
servers[defServerName] = &ingress.Server{
|
servers[defServerName] = &ingress.Server{
|
||||||
Hostname: defServerName,
|
Hostname: defServerName,
|
||||||
|
SSLCertificate: defaultPemFileName,
|
||||||
|
SSLPemChecksum: defaultPemSHA,
|
||||||
Locations: []*ingress.Location{
|
Locations: []*ingress.Location{
|
||||||
{
|
{
|
||||||
Path: rootLocation,
|
Path: rootLocation,
|
||||||
|
@ -899,7 +921,8 @@ func (ic *GenericController) createServers(data []interface{}, upstreams map[str
|
||||||
servers[host].SSLPemChecksum = cert.PemSHA
|
servers[host].SSLPemChecksum = cert.PemSHA
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
glog.Warningf("secret %v does not exists", key)
|
servers[host].SSLCertificate = defaultPemFileName
|
||||||
|
servers[host].SSLPemChecksum = defaultPemSHA
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,14 +54,14 @@ func NewIngressController(backend ingress.Controller) *GenericController {
|
||||||
tcpConfigMapName = flags.String("tcp-services-configmap", "",
|
tcpConfigMapName = flags.String("tcp-services-configmap", "",
|
||||||
`Name of the ConfigMap that contains the definition of the TCP services to expose.
|
`Name of the ConfigMap that contains the definition of the TCP services to expose.
|
||||||
The key in the map indicates the external port to be used. The value is the name of the
|
The key in the map indicates the external port to be used. The value is the name of the
|
||||||
service with the format namespace/serviceName and the port of the service could be a
|
service with the format namespace/serviceName and the port of the service could be a
|
||||||
number of the name of the port.
|
number of the name of the port.
|
||||||
The ports 80 and 443 are not allowed as external ports. This ports are reserved for the backend`)
|
The ports 80 and 443 are not allowed as external ports. This ports are reserved for the backend`)
|
||||||
|
|
||||||
udpConfigMapName = flags.String("udp-services-configmap", "",
|
udpConfigMapName = flags.String("udp-services-configmap", "",
|
||||||
`Name of the ConfigMap that contains the definition of the UDP services to expose.
|
`Name of the ConfigMap that contains the definition of the UDP services to expose.
|
||||||
The key in the map indicates the external port to be used. The value is the name of the
|
The key in the map indicates the external port to be used. The value is the name of the
|
||||||
service with the format namespace/serviceName and the port of the service could be a
|
service with the format namespace/serviceName and the port of the service could be a
|
||||||
number of the name of the port.`)
|
number of the name of the port.`)
|
||||||
|
|
||||||
resyncPeriod = flags.Duration("sync-period", 60*time.Second,
|
resyncPeriod = flags.Duration("sync-period", 60*time.Second,
|
||||||
|
@ -74,13 +74,13 @@ func NewIngressController(backend ingress.Controller) *GenericController {
|
||||||
|
|
||||||
profiling = flags.Bool("profiling", true, `Enable profiling via web interface host:port/debug/pprof/`)
|
profiling = flags.Bool("profiling", true, `Enable profiling via web interface host:port/debug/pprof/`)
|
||||||
|
|
||||||
defSSLCertificate = flags.String("default-ssl-certificate", "", `Name of the secret
|
defSSLCertificate = flags.String("default-ssl-certificate", "", `Name of the secret
|
||||||
that contains a SSL certificate to be used as default for a HTTPS catch-all server`)
|
that contains a SSL certificate to be used as default for a HTTPS catch-all server`)
|
||||||
|
|
||||||
defHealthzURL = flags.String("health-check-path", "/healthz", `Defines
|
defHealthzURL = flags.String("health-check-path", "/healthz", `Defines
|
||||||
the URL to be used as health check inside in the default server in NGINX.`)
|
the URL to be used as health check inside in the default server in NGINX.`)
|
||||||
|
|
||||||
updateStatus = flags.Bool("update-status", true, `Indicates if the
|
updateStatus = flags.Bool("update-status", true, `Indicates if the
|
||||||
ingress controller should update the Ingress status IP/hostname. Default is true`)
|
ingress controller should update the Ingress status IP/hostname. Default is true`)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue