lxm commented on a change in pull request #779:
URL:
https://github.com/apache/apisix-ingress-controller/pull/779#discussion_r762570713
##########
File path: pkg/kube/translation/ingress.go
##########
@@ -87,29 +94,49 @@ func (t *translator) translateIngressV1(ing
*networkingv1.Ingress) (*TranslateCo
ctx.addUpstream(ups)
}
uris := []string{pathRule.Path}
- if pathRule.PathType != nil && *pathRule.PathType ==
networkingv1.PathTypePrefix {
- // As per the specification of Ingress path
matching rule:
- // if the last element of the path is a
substring of the
- // last element in request path, it is not a
match, e.g. /foo/bar
- // matches /foo/bar/baz, but does not match
/foo/barbaz.
- // While in APISIX, /foo/bar matches both
/foo/bar/baz and
- // /foo/barbaz.
- // In order to be conformant with Ingress
specification, here
- // we create two paths here, the first is the
path itself
- // (exact match), the other is path + "/*"
(prefix match).
- prefix := pathRule.Path
- if strings.HasSuffix(prefix, "/") {
- prefix += "*"
- } else {
- prefix += "/*"
+ var nginxVars []configv2alpha1.ApisixRouteHTTPMatchExpr
+ if pathRule.PathType != nil {
+ if *pathRule.PathType ==
networkingv1.PathTypePrefix {
+ // As per the specification of Ingress
path matching rule:
+ // if the last element of the path is a
substring of the
+ // last element in request path, it is
not a match, e.g. /foo/bar
+ // matches /foo/bar/baz, but does not
match /foo/barbaz.
+ // While in APISIX, /foo/bar matches
both /foo/bar/baz and
+ // /foo/barbaz.
+ // In order to be conformant with
Ingress specification, here
+ // we create two paths here, the first
is the path itself
+ // (exact match), the other is path +
"/*" (prefix match).
+ prefix := pathRule.Path
+ if strings.HasSuffix(prefix, "/") {
+ prefix += "*"
+ } else {
+ prefix += "/*"
+ }
+ uris = append(uris, prefix)
+ } else if *pathRule.PathType ==
networkingv1.PathTypeImplementationSpecific && useRegex {
+ nginxVars = append(nginxVars,
configv2alpha1.ApisixRouteHTTPMatchExpr{
+ Subject:
configv2alpha1.ApisixRouteHTTPMatchExprSubject{
+ Scope:
configv2alpha1.ScopePath,
+ },
+ Op:
configv2alpha1.OpRegexMatch,
+ Value: &pathRule.Path,
Review comment:
currently, the apisix-ingress-controller will not validate all the
ingress resource being created? Maybe valiate the ingress resource should be
another feature.
On the other hand, a issue in kubernetes projects
https://github.com/kubernetes/kubernetes/issues/90210
the validation was removed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]