Skip to content

Commit

Permalink
Set default for satisfy annotation to nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Kursell committed Feb 26, 2019
1 parent 166dd1a commit 28d99c6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
5 changes: 3 additions & 2 deletions internal/ingress/annotations/satisfy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ func NewParser(r resolver.Resolver) parser.IngressAnnotation {
// Parse parses annotation contained in the ingress
func (s satisfy) Parse(ing *extensions.Ingress) (interface{}, error) {
satisfy, err := parser.GetStringAnnotation("satisfy", ing)
if err != nil || satisfy != "any" {
satisfy = "all"

if err != nil || (satisfy != "any" && satisfy != "all") {
satisfy = ""
}

return satisfy, nil
Expand Down
3 changes: 2 additions & 1 deletion internal/ingress/annotations/satisfy/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ func TestSatisfyParser(t *testing.T) {
data := map[string]string{
"any": "any",
"all": "all",
"invalid": "all",
"invalid": "",
"": "",
}

annotations := map[string]string{}
Expand Down
10 changes: 4 additions & 6 deletions test/e2e/annotations/satisfy.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,13 @@ var _ = framework.IngressNginxDescribe("Annotations - SATISFY", func() {
annotationKey := "nginx.ingress.kubernetes.io/satisfy"

annotations := map[string]string{
"any": "any",
"all": "all",
"invalid": "all",
"any": "any",
"all": "all",
}

results := map[string]string{
"any": "satisfy any",
"all": "satisfy all",
"invalid": "satisfy all",
"any": "satisfy any",
"all": "satisfy all",
}

initAnnotations := map[string]string{
Expand Down

0 comments on commit 28d99c6

Please sign in to comment.