-
Notifications
You must be signed in to change notification settings - Fork 326
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
Support WAN Address Annotations #3420
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
fa23cee
Add wanAddress configuration to the configmap
t-eckert ef14297
Set the annotations on the mesh gateway CRD
t-eckert 5ef1cde
Patch through the annotations from the Mesh Gateway
t-eckert 36e3dc8
Fix Job -> ConfigMap
t-eckert 97715ac
Use JSON to compare annotations
t-eckert 6f67b43
Add annotations to deployment test
t-eckert 1ff149a
Fix checking annotations in helm tests
t-eckert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,18 +2,20 @@ | |
|
||
load _helpers | ||
|
||
target=templates/gateway-resources-configmap.yaml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚀 |
||
|
||
@test "gateway-resources/ConfigMap: disabled with connectInject.enabled=false" { | ||
cd `chart_dir` | ||
assert_empty helm template \ | ||
-s templates/gateway-resources-configmap.yaml \ | ||
-s $target \ | ||
--set 'connectInject.enabled=false' \ | ||
. | ||
} | ||
|
||
@test "gateway-resources/ConfigMap: enabled with connectInject.enabled=true" { | ||
cd `chart_dir` | ||
local actual=$(helm template \ | ||
-s templates/gateway-resources-configmap.yaml \ | ||
-s $target \ | ||
--set 'connectInject.enabled=true' \ | ||
. | tee /dev/stderr | | ||
yq 'length > 0' | tee /dev/stderr) | ||
|
@@ -23,7 +25,7 @@ load _helpers | |
@test "gateway-resources/ConfigMap: contains resources configuration as JSON" { | ||
cd `chart_dir` | ||
local resources=$(helm template \ | ||
-s templates/gateway-resources-configmap.yaml \ | ||
-s $target \ | ||
--set 'connectInject.enabled=true' \ | ||
--set 'connectInject.apiGateway.managedGatewayClass.resources.requests.memory=200Mi' \ | ||
--set 'connectInject.apiGateway.managedGatewayClass.resources.requests.cpu=200m' \ | ||
|
@@ -48,7 +50,7 @@ load _helpers | |
@test "gateway-resources/ConfigMap: does not contain config.yaml resources without .global.experiments equal to resource-apis" { | ||
cd `chart_dir` | ||
local resources=$(helm template \ | ||
-s templates/gateway-resources-configmap.yaml \ | ||
-s $target \ | ||
--set 'connectInject.enabled=true' \ | ||
--set 'ui.enabled=false' \ | ||
. | tee /dev/stderr | | ||
|
@@ -60,7 +62,7 @@ load _helpers | |
@test "gateway-resources/ConfigMap: contains config.yaml resources with .global.experiments equal to resource-apis" { | ||
cd `chart_dir` | ||
local resources=$(helm template \ | ||
-s templates/gateway-resources-configmap.yaml \ | ||
-s $target \ | ||
--set 'connectInject.enabled=true' \ | ||
--set 'meshGateway.enabled=true' \ | ||
--set 'global.experiments[0]=resource-apis' \ | ||
|
@@ -70,3 +72,76 @@ load _helpers | |
|
||
[ "$resources" != null ] | ||
} | ||
|
||
|
||
#-------------------------------------------------------------------- | ||
# Mesh Gateway WAN Address configuration | ||
|
||
@test "gateway-resources/ConfigMap: Mesh Gateway WAN Address default annotations" { | ||
cd `chart_dir` | ||
local annotations=$(helm template \ | ||
-s $target \ | ||
--set 'connectInject.enabled=true' \ | ||
--set 'meshGateway.enabled=true' \ | ||
--set 'global.experiments[0]=resource-apis' \ | ||
--set 'ui.enabled=false' \ | ||
. | tee /dev/stderr | | ||
yq -r '.data["config.yaml"]' | yq -r '.meshGateways[0].metadata.annotations' | tee /dev/stderr) | ||
|
||
local actual=$(echo "$annotations" | jq -r '.["consul.hashicorp.com/gateway-wan-address-source"]') | ||
[ "${actual}" = 'Service' ] | ||
|
||
local actual=$(echo "$annotations" | jq -r '.["consul.hashicorp.com/gateway-wan-port"]') | ||
[ "${actual}" = '443' ] | ||
|
||
local actual=$(echo "$annotations" | jq -r '.["consul.hashicorp.com/gateway-wan-address-static"]') | ||
[ "${actual}" = '' ] | ||
} | ||
|
||
@test "gateway-resources/ConfigMap: Mesh Gateway WAN Address NodePort annotations" { | ||
cd `chart_dir` | ||
local annotations=$(helm template \ | ||
-s $target \ | ||
--set 'connectInject.enabled=true' \ | ||
--set 'meshGateway.enabled=true' \ | ||
--set 'global.experiments[0]=resource-apis' \ | ||
--set 'ui.enabled=false' \ | ||
--set 'meshGateway.wanAddress.source=Service' \ | ||
--set 'meshGateway.service.type=NodePort' \ | ||
--set 'meshGateway.service.nodePort=30000' \ | ||
. | tee /dev/stderr | | ||
yq -r '.data["config.yaml"]' | yq -r '.meshGateways[0].metadata.annotations' | tee /dev/stderr) | ||
|
||
local actual=$(echo "$annotations" | jq -r '.["consul.hashicorp.com/gateway-wan-address-source"]') | ||
[ "${actual}" = 'Service' ] | ||
|
||
local actual=$(echo "$annotations" | jq -r '.["consul.hashicorp.com/gateway-wan-port"]') | ||
[ "${actual}" = '30000' ] | ||
|
||
local actual=$(echo "$annotations" | jq -r '.["consul.hashicorp.com/gateway-wan-address-static"]') | ||
[ "${actual}" = '' ] | ||
} | ||
|
||
@test "gateway-resources/ConfigMap: Mesh Gateway WAN Address static configuration" { | ||
cd `chart_dir` | ||
local annotations=$(helm template \ | ||
-s $target \ | ||
--set 'connectInject.enabled=true' \ | ||
--set 'meshGateway.enabled=true' \ | ||
--set 'global.experiments[0]=resource-apis' \ | ||
--set 'ui.enabled=false' \ | ||
--set 'meshGateway.wanAddress.source=Static' \ | ||
--set 'meshGateway.wanAddress.static=127.0.0.1' \ | ||
. | tee /dev/stderr | | ||
yq -r '.data["config.yaml"]' | yq -r '.meshGateways[0].metadata.annotations' | tee /dev/stderr) | ||
|
||
local actual=$(echo "$annotations" | jq -r '.["consul.hashicorp.com/gateway-wan-address-source"]') | ||
[ "${actual}" = 'Static' ] | ||
|
||
local actual=$(echo "$annotations" | jq -r '.["consul.hashicorp.com/gateway-wan-port"]') | ||
[ "${actual}" = '443' ] | ||
|
||
local actual=$(echo "$annotations" | jq -r '.["consul.hashicorp.com/gateway-wan-address-static"]') | ||
[ "${actual}" = '127.0.0.1' ] | ||
} | ||
|
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added validation here that will block the invalid config of a "Static" address with no address set.