Merge pull request #4235 from aledbf/lint

Add new lints
This commit is contained in:
Kubernetes Prow Robot 2019-06-29 14:27:20 -07:00 committed by GitHub
commit 7c6ffeaeac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -61,6 +61,8 @@ func (lint IngressLint) Version() string {
// GetIngressLints returns all of the lints for ingresses
func GetIngressLints() []IngressLint {
return []IngressLint{
removedAnnotation("secure-backends", 3203, "0.21.0"),
removedAnnotation("grpc-backend", 3203, "0.21.0"),
removedAnnotation("add-base-url", 3174, "0.22.0"),
removedAnnotation("base-url-scheme", 3174, "0.22.0"),
removedAnnotation("session-cookie-hash", 3743, "0.24.0"),
@ -84,6 +86,10 @@ func GetIngressLints() []IngressLint {
version: "0.24.0",
f: xForwardedPrefixIsBool,
},
{
message: "Contains an configuration-snippet that contains a Satisfy directive.\nPlease use https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#satisfy",
f: satisfyDirective,
},
}
}
@ -138,3 +144,17 @@ func removedAnnotation(annotationName string, issueNumber int, version string) I
},
}
}
func satisfyDirective(ing networking.Ingress) bool {
for name, val := range ing.Annotations {
if strings.HasSuffix(name, "/configuration-snippet") {
if strings.Index(val, "satisfy") != -1 {
return true
}
return false
}
}
return false
}