Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of Add validation for apigw creation with no routes into release/1.15.x #16679

Merged
Prev Previous commit
Next Next commit
backport of commit 65b82cb
  • Loading branch information
missylbytes committed Mar 16, 2023
commit 87b968b754d5cc75aaad59459ae6d9b0aad14fbe
3 changes: 3 additions & 0 deletions .changelog/16649.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
gateways: Adds validation to ensure the API Gateway has a listener defined when created
```
5 changes: 2 additions & 3 deletions agent/structs/config_entry_gateways.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package structs

import (
"errors"
"fmt"
"regexp"
"sort"
Expand Down Expand Up @@ -771,7 +770,7 @@ func (e *APIGatewayConfigEntry) Validate() error {
}

if len(e.Listeners) == 0 {
return errors.New("api gateway must have at least one listener")
return fmt.Errorf("api gateway must have at least one listener")
}
if err := e.validateListenerNames(); err != nil {
return err
Expand Down Expand Up @@ -830,7 +829,7 @@ func (e *APIGatewayConfigEntry) validateListeners() error {
}
if listener.Port <= 0 || listener.Port > 65535 {
return fmt.Errorf("listener port %d not in the range 1-65535", listener.Port)
}
}| api-gateway | `mesh:write` |
if strings.ContainsRune(strings.TrimPrefix(listener.Hostname, wildcardPrefix), '*') {
return fmt.Errorf("host %q is not valid, a wildcard specifier is only allowed as the left-most label", listener.Hostname)
}
Expand Down
1 change: 1 addition & 0 deletions website/content/commands/config/delete.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ are not supported from commands, but may be from the corresponding HTTP endpoint

| Config Entry Kind | Required ACL |
| ------------------- | ------------------ |
| api-gateway | `mesh:write` |
| ingress-gateway | `operator:write` |
| proxy-defaults | `operator:write` |
| service-defaults | `service:write` |
Expand Down
1 change: 1 addition & 0 deletions website/content/commands/config/list.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ are not supported from commands, but may be from the corresponding HTTP endpoint

| Config Entry Kind | Required ACL |
| ------------------- | ----------------- |
| api-gateway | `mesh:read` |
| ingress-gateway | `service:read` |
| proxy-defaults | `<none>` |
| service-defaults | `service:read` |
Expand Down
1 change: 1 addition & 0 deletions website/content/commands/config/read.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ are not supported from commands, but may be from the corresponding HTTP endpoint

| Config Entry Kind | Required ACL |
| ------------------- | ----------------- |
| api-gateway | `mesh:read` |
| ingress-gateway | `service:read` |
| proxy-defaults | `<none>` |
| service-defaults | `service:read` |
Expand Down
1 change: 1 addition & 0 deletions website/content/commands/config/write.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ are not supported from commands, but may be from the corresponding HTTP endpoint

| Config Entry Kind | Required ACL |
| ------------------- | ------------------ |
| api-gateway | `mesh:write` |
| ingress-gateway | `operator:write` |
| proxy-defaults | `operator:write` |
| service-defaults | `service:write` |
Expand Down