Merge branch 'v1.5' into master
This commit is contained in:
commit
c8446c2dc8
40 changed files with 493 additions and 234 deletions
|
@ -202,17 +202,17 @@ func route(name string, rule string) func(*types.Route) string {
|
|||
}
|
||||
}
|
||||
|
||||
func tlsConfigurations(opts ...func(*tls.Configuration)) func(*types.Configuration) {
|
||||
func tlsesSection(opts ...func(*tls.Configuration)) func(*types.Configuration) {
|
||||
return func(c *types.Configuration) {
|
||||
for _, opt := range opts {
|
||||
tlsConf := &tls.Configuration{}
|
||||
opt(tlsConf)
|
||||
c.TLSConfiguration = append(c.TLSConfiguration, tlsConf)
|
||||
c.TLS = append(c.TLS, tlsConf)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func tlsConfiguration(opts ...func(*tls.Configuration)) func(*tls.Configuration) {
|
||||
func tlsSection(opts ...func(*tls.Configuration)) func(*tls.Configuration) {
|
||||
return func(c *tls.Configuration) {
|
||||
for _, opt := range opts {
|
||||
opt(c)
|
||||
|
@ -281,8 +281,8 @@ func TestBuildConfiguration(t *testing.T) {
|
|||
),
|
||||
),
|
||||
),
|
||||
tlsConfigurations(
|
||||
tlsConfiguration(
|
||||
tlsesSection(
|
||||
tlsSection(
|
||||
tlsEntryPoints("https"),
|
||||
certificate("certificate", "key"),
|
||||
),
|
||||
|
@ -375,7 +375,7 @@ func sampleConfiguration() *types.Configuration {
|
|||
},
|
||||
},
|
||||
},
|
||||
TLSConfiguration: []*tls.Configuration{
|
||||
TLS: []*tls.Configuration{
|
||||
{
|
||||
EntryPoints: []string{"https"},
|
||||
Certificate: &tls.Certificate{
|
||||
|
|
|
@ -175,12 +175,12 @@ func (p *Provider) loadIngresses(k8sClient Client) (*types.Configuration, error)
|
|||
continue
|
||||
}
|
||||
|
||||
tlsConfigs, err := getTLSConfigurations(i, k8sClient)
|
||||
tlsSection, err := getTLS(i, k8sClient)
|
||||
if err != nil {
|
||||
log.Errorf("Error configuring TLS for ingress %s/%s: %v", i.Namespace, i.Name, err)
|
||||
continue
|
||||
}
|
||||
templateObjects.TLSConfiguration = append(templateObjects.TLSConfiguration, tlsConfigs...)
|
||||
templateObjects.TLS = append(templateObjects.TLS, tlsSection...)
|
||||
|
||||
for _, r := range i.Spec.Rules {
|
||||
if r.HTTP == nil {
|
||||
|
@ -449,7 +449,7 @@ func loadAuthCredentials(namespace, secretName string, k8sClient Client) ([]stri
|
|||
return creds, nil
|
||||
}
|
||||
|
||||
func getTLSConfigurations(ingress *v1beta1.Ingress, k8sClient Client) ([]*tls.Configuration, error) {
|
||||
func getTLS(ingress *v1beta1.Ingress, k8sClient Client) ([]*tls.Configuration, error) {
|
||||
var tlsConfigs []*tls.Configuration
|
||||
|
||||
for _, t := range ingress.Spec.TLS {
|
||||
|
|
|
@ -1323,8 +1323,8 @@ func TestTLSSecretLoad(t *testing.T) {
|
|||
),
|
||||
),
|
||||
),
|
||||
tlsConfigurations(
|
||||
tlsConfiguration(
|
||||
tlsesSection(
|
||||
tlsSection(
|
||||
tlsEntryPoints("ep1", "ep2"),
|
||||
certificate(
|
||||
"-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----",
|
||||
|
@ -1336,7 +1336,7 @@ func TestTLSSecretLoad(t *testing.T) {
|
|||
assert.Equal(t, expected, actual)
|
||||
}
|
||||
|
||||
func TestGetTLSConfigurations(t *testing.T) {
|
||||
func TestGetTLS(t *testing.T) {
|
||||
testIngressWithoutHostname := buildIngress(
|
||||
iNamespace("testing"),
|
||||
iRules(
|
||||
|
@ -1503,7 +1503,7 @@ func TestGetTLSConfigurations(t *testing.T) {
|
|||
t.Run(test.desc, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tlsConfigs, err := getTLSConfigurations(test.ingress, test.client)
|
||||
tlsConfigs, err := getTLS(test.ingress, test.client)
|
||||
|
||||
if test.errResult != "" {
|
||||
assert.EqualError(t, err, test.errResult)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue