-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# This is a combination of 14 commits.
# This is the 1st commit message: Add service for terminating-gateways # This is the commit message #2: Add gateway-kind:terminating to deployment # This is the commit message #3: Add registration path for terminating gateways # This is the commit message #4: Add BATS tests # This is the commit message #5: Remove registration from terminating gateways deployment # This is the commit message #6: Set ports AFAIK in service # This is the commit message #7: Begin setting values for endpoints controller # This is the commit message #8: Copy values from deployment to endpoints controller (as comment) # This is the commit message #9: Use connect-init instead of acl-init # This is the commit message #10: Remove guards from term gw service (they will get hit by the deployment) # This is the commit message #11: Range over gateways to produce a service for each deployment # This is the commit message #12: Add test for multiple gateways # This is the commit message #13: Remove the format script # This is the commit message #14: Note which parts of the config have been set
- Loading branch information
Thomas Eckert
committed
Sep 8, 2022
1 parent
8ad1b3d
commit 38ccc4c
Showing
4 changed files
with
199 additions
and
43 deletions.
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{{- if and .Values.terminatingGateways.enabled }} | ||
|
||
{{- $root := . }} | ||
{{- $defaults := .Values.terminatingGateways.defaults }} | ||
|
||
{{- range .Values.terminatingGateways.gateways }} | ||
|
||
{{- $service := .service }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ template "consul.fullname" $root }}-{{ .name }} | ||
namespace: {{ $root.Release.Namespace }} | ||
labels: | ||
app: {{ template "consul.name" $root }} | ||
chart: {{ template "consul.chart" $root }} | ||
heritage: {{ $root.Release.Service }} | ||
release: {{ $root.Release.Name }} | ||
component: terminating-gateways | ||
spec: | ||
selector: | ||
app: {{ template "consul.name" $root }} | ||
release: "{{ $root.Release.Name }}" | ||
component: terminating-gateways | ||
ports: | ||
- name: gateway | ||
port: 80 # TODO what should this be set to? | ||
targetPort: 8443 | ||
type: ClusterIP | ||
--- | ||
{{- end }} | ||
{{- end }} |
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,49 @@ | ||
#!/usr/bin/env bats | ||
|
||
load _helpers | ||
|
||
@test "terminatingGateways/Service: disabled by default" { | ||
cd `chart_dir` | ||
assert_empty helm template \ | ||
-s templates/terminating-gateways-service.yaml \ | ||
. | ||
} | ||
|
||
@test "terminatingGateways/Service: enabled with terminatingGateways and connectInject enabled" { | ||
cd `chart_dir` | ||
local object=$(helm template \ | ||
-s templates/terminating-gateways-service.yaml \ | ||
--set 'terminatingGateways.enabled=true' \ | ||
--set 'connectInject.enabled=true' \ | ||
. | tee /dev/stderr | | ||
yq -s '.[0]' | tee /dev/stderr) | ||
|
||
local actual=$(echo $object | yq '. | length > 0' | tee /dev/stderr) | ||
[ "${actual}" = "true" ] | ||
} | ||
|
||
#-------------------------------------------------------------------- | ||
# multiple gateways | ||
|
||
@test "terminatingGateways/Service: multiple gateways" { | ||
cd `chart_dir` | ||
local object=$(helm template \ | ||
-s templates/terminating-gateways-service.yaml \ | ||
--set 'terminatingGateways.enabled=true' \ | ||
--set 'connectInject.enabled=true' \ | ||
--set 'terminatingGateways.gateways[0].name=gateway1' \ | ||
--set 'terminatingGateways.gateways[1].name=gateway2' \ | ||
. | tee /dev/stderr | | ||
yq -s -r '.' | tee /dev/stderr) | ||
|
||
local actual=$(echo $object | yq -r '.[0].metadata.name' | tee /dev/stderr) | ||
[ "${actual}" = "release-name-consul-gateway1" ] | ||
|
||
local actual=$(echo $object | yq -r '.[1].metadata.name' | tee /dev/stderr) | ||
[ "${actual}" = "release-name-consul-gateway2" ] | ||
|
||
local actual=$(echo "$object" | | ||
yq -r '.[2] | length > 0' | tee /dev/stderr) | ||
[ "${actual}" = "false" ] | ||
} | ||
|
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