Skip to content

Commit

Permalink
Merge 65b82cb into backport/add-checks-apigw-creation-no-routes/perso…
Browse files Browse the repository at this point in the history
…nally-winning-foxhound
  • Loading branch information
hc-github-team-consul-core authored Mar 20, 2023
2 parents 07209ef + 65b82cb commit ceeddce
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 3 deletions.
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

0 comments on commit ceeddce

Please sign in to comment.