Add plugin lint for this change
This commit is contained in:
parent
fdd445cb2a
commit
6cbfd4c7d1
1 changed files with 15 additions and 0 deletions
|
@ -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",
|
message: "Contains an annotation with the prefix 'nginx.com'. This is a prefix for https://github.com/nginxinc/kubernetes-ingress",
|
||||||
f: annotationPrefixIsNginxCom,
|
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 {
|
func annotationPrefixIsNginxCom(ing v1beta1.Ingress) bool {
|
||||||
for name := range ing.Annotations {
|
for name := range ing.Annotations {
|
||||||
if strings.HasPrefix(name, "nginx.com/") {
|
if strings.HasPrefix(name, "nginx.com/") {
|
||||||
|
|
Loading…
Reference in a new issue