Doesn't fail if proxy-ssl-name annotation is not specified

This commit is contained in:
schaefec 2019-10-16 15:35:49 +01:00 committed by Laszlo Janosi
parent 141ea59b7f
commit 0ab2e72e95
2 changed files with 8 additions and 10 deletions

View file

@ -45,11 +45,11 @@ var (
// and the configured VerifyDepth // and the configured VerifyDepth
type Config struct { type Config struct {
resolver.AuthSSLCert resolver.AuthSSLCert
Ciphers string `json:"ciphers"` Ciphers string `json:"ciphers"`
Protocols string `json:"protocols"` Protocols string `json:"protocols"`
ProxySSLName string `json:"proxySSLName"` ProxySSLName string `json:"proxySSLName"`
Verify string `json:"verify"` Verify string `json:"verify"`
VerifyDepth int `json:"verifyDepth"` VerifyDepth int `json:"verifyDepth"`
} }
// Equal tests for equality between two Config types // Equal tests for equality between two Config types
@ -146,8 +146,7 @@ func (p proxySSL) Parse(ing *networking.Ingress) (interface{}, error) {
config.ProxySSLName, err = parser.GetStringAnnotation("proxy-ssl-name", ing) config.ProxySSLName, err = parser.GetStringAnnotation("proxy-ssl-name", ing)
if err != nil { if err != nil {
e := errors.Wrap(err, "error obtaining proxy-ssl-name") config.ProxySSLName = ""
return &Config{}, ing_errors.LocationDenied{Reason: e}
} }
config.Verify, err = parser.GetStringAnnotation("proxy-ssl-verify", ing) config.Verify, err = parser.GetStringAnnotation("proxy-ssl-verify", ing)

View file

@ -94,7 +94,6 @@ func TestAnnotations(t *testing.T) {
data[parser.GetAnnotationWithPrefix("proxy-ssl-session-reuse")] = "off" data[parser.GetAnnotationWithPrefix("proxy-ssl-session-reuse")] = "off"
data[parser.GetAnnotationWithPrefix("proxy-ssl-verify")] = "on" data[parser.GetAnnotationWithPrefix("proxy-ssl-verify")] = "on"
data[parser.GetAnnotationWithPrefix("proxy-ssl-verify-depth")] = "3" data[parser.GetAnnotationWithPrefix("proxy-ssl-verify-depth")] = "3"
data[parser.GetAnnotationWithPrefix("proxy-ssl-name")] = "testname.namespace"
ing.SetAnnotations(data) ing.SetAnnotations(data)
@ -129,8 +128,8 @@ func TestAnnotations(t *testing.T) {
if u.VerifyDepth != 3 { if u.VerifyDepth != 3 {
t.Errorf("expected %v but got %v", 3, u.VerifyDepth) t.Errorf("expected %v but got %v", 3, u.VerifyDepth)
} }
if u.ProxySSLName != "testname.namespace" { if u.ProxySSLName != "$host" {
t.Errorf("expected %v but got %v", "testname.namespace", u.ProxySSLName) t.Errorf("expected %v but got %v", "$host", u.ProxySSLName)
} }
} }