Skip to content

Commit

Permalink
Merge pull request #4235 from aledbf/lint
Browse files Browse the repository at this point in the history
Add new lints
  • Loading branch information
k8s-ci-robot authored Jun 29, 2019
2 parents bb776c4 + 0fb34f7 commit 7c6ffea
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cmd/plugin/lints/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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,
},
}
}

Expand Down Expand Up @@ -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
}

0 comments on commit 7c6ffea

Please sign in to comment.