-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* kind of running * WIP * Unskip test and setup so it works correctly * revert typo * Move tokens into constants * Adds test scenario for adding a second gateway policy to a gateway, should and will fail * linter * Add case for multiple routes on listener with only one defining JWT configuration * Multiple routes referencing the same external ref * Add check for route referencing route extension outside of local namespace failing --------- Co-authored-by: Melisa Griffin <melisa.griffin@hashicorp.com>
- Loading branch information
1 parent
d09fc3d
commit 6a3d0ab
Showing
13 changed files
with
348 additions
and
73 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
acceptance/tests/fixtures/cases/api-gateways/jwt-auth/external-ref-other-ns.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
apiVersion: consul.hashicorp.com/v1alpha1 | ||
kind: RouteAuthFilter | ||
metadata: | ||
name: route-jwt-auth-filter-other | ||
namespace: other | ||
spec: | ||
jwt: | ||
providers: | ||
- name: "local" | ||
verifyClaims: | ||
- path: | ||
- role | ||
value: doctor |
25 changes: 25 additions & 0 deletions
25
...e/tests/fixtures/cases/api-gateways/jwt-auth/extraGatewayPolicy/extra-gateway-policy.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
# This is used to show that a gateway cannot have more than one gateway policy attached to it | ||
apiVersion: consul.hashicorp.com/v1alpha1 | ||
kind: GatewayPolicy | ||
metadata: | ||
name: bad-policy | ||
spec: | ||
targetRef: | ||
name: gateway | ||
sectionName: http-auth | ||
group: gateway.networking.k8s.io/v1beta1 | ||
kind: Gateway | ||
override: | ||
jwt: | ||
providers: | ||
- name: "local" | ||
default: | ||
jwt: | ||
providers: | ||
- name: "local" | ||
verifyClaims: | ||
- path: | ||
- role | ||
value: pet |
7 changes: 7 additions & 0 deletions
7
acceptance/tests/fixtures/cases/api-gateways/jwt-auth/extraGatewayPolicy/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
resources: | ||
- extra-gateway-policy.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
acceptance/tests/fixtures/cases/api-gateways/jwt-auth/httproute-invalid-external-ref.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: http-route-auth-invalid | ||
spec: | ||
parentRefs: | ||
- name: gateway | ||
sectionName: http-invalid-attach | ||
rules: | ||
- matches: | ||
- path: | ||
type: PathPrefix | ||
value: "/admin" | ||
backendRefs: | ||
- name: static-server | ||
port: 8080 | ||
filters: | ||
- type: ExtensionRef | ||
extensionRef: | ||
group: consul.hashicorp.com | ||
kind: RouteAuthFilter | ||
name: route-jwt-auth-filter-other | ||
- matches: | ||
- path: | ||
type: PathPrefix | ||
value: "/pet" | ||
backendRefs: | ||
- name: static-server | ||
port: 8080 |
26 changes: 26 additions & 0 deletions
26
...ptance/tests/fixtures/cases/api-gateways/jwt-auth/httproute-no-auth-on-auth-listener.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: http-route-no-auth-on-auth-listener | ||
spec: | ||
parentRefs: | ||
- name: gateway | ||
sectionName: http-auth | ||
rules: | ||
- matches: | ||
- path: | ||
type: PathPrefix | ||
value: "/admin-no-auth" | ||
backendRefs: | ||
- name: static-server | ||
port: 8080 | ||
- matches: | ||
- path: | ||
type: PathPrefix | ||
value: "/pet-no-auth" | ||
backendRefs: | ||
- name: static-server | ||
port: 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ spec: | |
value: "/v1" | ||
backendRefs: | ||
- name: static-server | ||
port: 80 | ||
port: 8080 |
32 changes: 32 additions & 0 deletions
32
acceptance/tests/fixtures/cases/api-gateways/jwt-auth/httproute2-auth.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: http-route2-auth | ||
spec: | ||
parentRefs: | ||
- name: gateway | ||
sectionName: http-auth | ||
rules: | ||
- matches: | ||
- path: | ||
type: PathPrefix | ||
value: "/admin-2" | ||
backendRefs: | ||
- name: static-server | ||
port: 8080 | ||
filters: | ||
- type: ExtensionRef | ||
extensionRef: | ||
group: consul.hashicorp.com | ||
kind: RouteAuthFilter | ||
name: route-jwt-auth-filter | ||
- matches: | ||
- path: | ||
type: PathPrefix | ||
value: "/pet-2" | ||
backendRefs: | ||
- name: static-server | ||
port: 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 11 additions & 5 deletions
16
acceptance/tests/fixtures/cases/api-gateways/jwt-auth/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
resources: | ||
- ../../../bases/api-gateway | ||
- ../../static-server-inject | ||
- ./httproute.yaml | ||
- ./jwt-provider.yaml | ||
- httproute-auth.yaml | ||
- httproute-invalid-external-ref.yaml | ||
- httproute2-auth.yaml | ||
- httproute-no-auth-on-auth-listener.yaml | ||
- jwt-provider.yaml | ||
- jwt-route-filter.yaml | ||
- gateway-policy.yaml | ||
|
||
|
||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
patches: | ||
- patch: httproute-no-auth.yaml | ||
- path: httproute.yaml | ||
- path: api-gateway.yaml |