Skip to content

Commit

Permalink
Add plugin lint for this change
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Kursell committed Mar 29, 2019
1 parent fdd445c commit 6cbfd4c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/plugin/lints/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,24 @@ func GetIngressLints() []IngressLint {
message: "Contains an annotation with the prefix 'nginx.com'. This is a prefix for https://github.com/nginxinc/kubernetes-ingress",
f: annotationPrefixIsNginxCom,
},
{
message: "The x-forwarded-prefix annotation value is a boolean instead of a string",
issue: 3786,
version: "0.24.0",
f: xForwardedPrefixIsBool,
},
}
}

func xForwardedPrefixIsBool(ing v1beta1.Ingress) bool {
for name, val := range ing.Annotations {
if strings.HasSuffix(name, "/x-forwarded-prefix") && (val == "true" || val == "false") {
return true
}
}
return false
}

func annotationPrefixIsNginxCom(ing v1beta1.Ingress) bool {
for name := range ing.Annotations {
if strings.HasPrefix(name, "nginx.com/") {
Expand Down

0 comments on commit 6cbfd4c

Please sign in to comment.