Only set mirror source when a target is configured (#5055)
This commit is contained in:
parent
77586dd83b
commit
281139d1a7
3 changed files with 3 additions and 2 deletions
|
@ -82,6 +82,7 @@ func (a mirror) Parse(ing *networking.Ingress) (interface{}, error) {
|
|||
config.Target, err = parser.GetStringAnnotation("mirror-target", ing)
|
||||
if err != nil {
|
||||
config.Target = ""
|
||||
config.Source = ""
|
||||
}
|
||||
|
||||
return config, nil
|
||||
|
|
|
@ -47,7 +47,7 @@ func TestParse(t *testing.T) {
|
|||
Target: "https://test.env.com/$request_uri",
|
||||
}},
|
||||
{map[string]string{requestBody: "off"}, &Config{
|
||||
Source: ngxURI,
|
||||
Source: "",
|
||||
RequestBody: "off",
|
||||
Target: "",
|
||||
}},
|
||||
|
|
|
@ -69,7 +69,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Mirror", func() {
|
|||
|
||||
It("should disable mirror-request-body", func() {
|
||||
annotations := map[string]string{
|
||||
"nginx.ingress.kubernetes.io/mirror-uri": "http://localhost/mirror",
|
||||
"nginx.ingress.kubernetes.io/mirror-target": "http://localhost/mirror",
|
||||
"nginx.ingress.kubernetes.io/mirror-request-body": "off",
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue