Skip to content

Commit

Permalink
Destination host cannot be * (istio#13222)
Browse files Browse the repository at this point in the history
* destination host cannot be *

* fix test
  • Loading branch information
frankbu authored and rshriram committed Apr 11, 2019
1 parent e7f9fd6 commit cccb01e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pilot/pkg/model/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2027,7 +2027,12 @@ func validateDestination(destination *networking.Destination) (errs error) {
return
}

errs = appendErrors(errs, ValidateWildcardDomain(destination.Host))
host := destination.Host
if host == "*" {
errs = appendErrors(errs, fmt.Errorf("invalid destintation host %s", host))
} else {
errs = appendErrors(errs, ValidateWildcardDomain(host))
}
if destination.Subset != "" {
errs = appendErrors(errs, validateSubsetName(destination.Subset))
}
Expand Down
2 changes: 1 addition & 1 deletion pilot/pkg/model/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2312,7 +2312,7 @@ func TestValidateRouteDestination(t *testing.T) {
}}, valid: true},
{name: "wildcard", routes: []*networking.RouteDestination{&networking.RouteDestination{
Destination: &networking.Destination{Host: "*"},
}}, valid: true},
}}, valid: false},
{name: "bad wildcard", routes: []*networking.RouteDestination{&networking.RouteDestination{
Destination: &networking.Destination{Host: "foo.*"},
}}, valid: false},
Expand Down

0 comments on commit cccb01e

Please sign in to comment.