-
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.
Revert "Merge branch 'main' into curtbushko/agentless-metrics-merging"
- Loading branch information
1 parent
062fc11
commit f3863bb
Showing
13 changed files
with
466 additions
and
108 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
Copyright (c) 2018 HashiCorp, Inc. | ||
|
||
Mozilla Public License, version 2.0 | ||
|
||
1. Definitions | ||
|
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
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,45 @@ | ||
{{- $serverEnabled := (or (and (ne (.Values.server.enabled | toString) "-") .Values.server.enabled) (and (eq (.Values.server.enabled | toString) "-") .Values.global.enabled)) -}} | ||
{{- if (and .Values.global.adminPartitions.enabled $serverEnabled) }} | ||
# Service with an external IP for clients in non-default Admin Partitions | ||
# to discover Consul servers. This service should only point to Consul servers. | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ template "consul.fullname" . }}-partition | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
app: {{ template "consul.name" . }} | ||
chart: {{ template "consul.chart" . }} | ||
heritage: {{ .Release.Service }} | ||
release: {{ .Release.Name }} | ||
component: server | ||
annotations: | ||
{{- if .Values.global.adminPartitions.service.annotations }} | ||
{{ tpl .Values.global.adminPartitions.service.annotations . | nindent 4 | trim }} | ||
{{- end }} | ||
spec: | ||
type: "{{ .Values.global.adminPartitions.service.type }}" | ||
ports: | ||
- name: https | ||
port: 8501 | ||
targetPort: 8501 | ||
{{ if (and (eq .Values.global.adminPartitions.service.type "NodePort") .Values.global.adminPartitions.service.nodePort.https) }} | ||
nodePort: {{ .Values.global.adminPartitions.service.nodePort.https }} | ||
{{- end }} | ||
- name: serflan | ||
port: 8301 | ||
targetPort: 8301 | ||
{{ if (and (eq .Values.global.adminPartitions.service.type "NodePort") .Values.global.adminPartitions.service.nodePort.serf) }} | ||
nodePort: {{ .Values.global.adminPartitions.service.nodePort.serf }} | ||
{{- end }} | ||
- name: server | ||
port: 8300 | ||
targetPort: 8300 | ||
{{ if (and (eq .Values.global.adminPartitions.service.type "NodePort") .Values.global.adminPartitions.service.nodePort.rpc) }} | ||
nodePort: {{ .Values.global.adminPartitions.service.nodePort.rpc }} | ||
{{- end }} | ||
selector: | ||
app: {{ template "consul.name" . }} | ||
release: "{{ .Release.Name }}" | ||
component: server | ||
{{- 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
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,141 @@ | ||
#!/usr/bin/env bats | ||
|
||
load _helpers | ||
|
||
@test "partition/Service: disabled by default" { | ||
cd `chart_dir` | ||
assert_empty helm template \ | ||
-s templates/partition-service.yaml \ | ||
. | ||
} | ||
|
||
@test "partition/Service: enable with global.enabled false" { | ||
cd `chart_dir` | ||
local actual=$(helm template \ | ||
-s templates/partition-service.yaml \ | ||
--set 'global.enabled=false' \ | ||
--set 'server.enabled=true' \ | ||
--set 'global.adminPartitions.enabled=true' \ | ||
--set 'global.enableConsulNamespaces=true' \ | ||
. | tee /dev/stderr | | ||
yq 'length > 0' | tee /dev/stderr) | ||
[ "${actual}" = "true" ] | ||
} | ||
|
||
@test "partition/Service: disable with adminPartitions.enabled" { | ||
cd `chart_dir` | ||
assert_empty helm template \ | ||
-s templates/partition-service.yaml \ | ||
--set 'global.adminPartitions.enabled=false' \ | ||
. | ||
} | ||
|
||
@test "partition/Service: disable with server.enabled" { | ||
cd `chart_dir` | ||
assert_empty helm template \ | ||
-s templates/partition-service.yaml \ | ||
--set 'global.adminPartitions.enabled=true' \ | ||
--set 'global.enableConsulNamespaces=true' \ | ||
--set 'server.enabled=false' \ | ||
. | ||
} | ||
|
||
@test "partition/Service: disable with global.enabled" { | ||
cd `chart_dir` | ||
assert_empty helm template \ | ||
-s templates/partition-service.yaml \ | ||
--set 'global.enabled=false' \ | ||
. | ||
} | ||
|
||
#-------------------------------------------------------------------- | ||
# annotations | ||
|
||
@test "partition/Service: no annotations by default" { | ||
cd `chart_dir` | ||
local actual=$(helm template \ | ||
-s templates/partition-service.yaml \ | ||
--set 'global.adminPartitions.enabled=true' \ | ||
--set 'global.enableConsulNamespaces=true' \ | ||
. | tee /dev/stderr | | ||
yq -r '.metadata.annotations | length' | tee /dev/stderr) | ||
[ "${actual}" = "0" ] | ||
} | ||
|
||
@test "partition/Service: can set annotations" { | ||
cd `chart_dir` | ||
local actual=$(helm template \ | ||
-s templates/partition-service.yaml \ | ||
--set 'global.adminPartitions.enabled=true' \ | ||
--set 'global.adminPartitions.service.annotations=key: value' \ | ||
--set 'global.enableConsulNamespaces=true' \ | ||
. | tee /dev/stderr | | ||
yq -r '.metadata.annotations.key' | tee /dev/stderr) | ||
[ "${actual}" = "value" ] | ||
} | ||
|
||
#-------------------------------------------------------------------- | ||
# nodePort | ||
|
||
@test "partition/Service: RPC node port can be set" { | ||
cd `chart_dir` | ||
local actual=$(helm template \ | ||
-s templates/partition-service.yaml \ | ||
--set 'global.adminPartitions.enabled=true' \ | ||
--set 'global.adminPartitions.service.type=NodePort' \ | ||
--set 'global.adminPartitions.service.nodePort.rpc=4443' \ | ||
--set 'global.enableConsulNamespaces=true' \ | ||
. | tee /dev/stderr | | ||
yq -r '.spec.ports[] | select(.name == "server") | .nodePort' | tee /dev/stderr) | ||
[ "${actual}" == "4443" ] | ||
} | ||
|
||
@test "partition/Service: Serf node port can be set" { | ||
cd `chart_dir` | ||
local actual=$(helm template \ | ||
-s templates/partition-service.yaml \ | ||
--set 'global.adminPartitions.enabled=true' \ | ||
--set 'global.adminPartitions.service.type=NodePort' \ | ||
--set 'global.adminPartitions.service.nodePort.serf=4444' \ | ||
--set 'global.enableConsulNamespaces=true' \ | ||
. | tee /dev/stderr | | ||
yq -r '.spec.ports[] | select(.name == "serflan") | .nodePort' | tee /dev/stderr) | ||
[ "${actual}" == "4444" ] | ||
} | ||
|
||
@test "partition/Service: HTTPS node port can be set" { | ||
cd `chart_dir` | ||
local actual=$(helm template \ | ||
-s templates/partition-service.yaml \ | ||
--set 'global.adminPartitions.enabled=true' \ | ||
--set 'global.adminPartitions.service.type=NodePort' \ | ||
--set 'global.adminPartitions.service.nodePort.https=4444' \ | ||
--set 'global.enableConsulNamespaces=true' \ | ||
. | tee /dev/stderr | | ||
yq -r '.spec.ports[] | select(.name == "https") | .nodePort' | tee /dev/stderr) | ||
[ "${actual}" == "4444" ] | ||
} | ||
|
||
@test "partition/Service: RPC, Serf and HTTPS node ports can be set" { | ||
cd `chart_dir` | ||
local ports=$(helm template \ | ||
-s templates/partition-service.yaml \ | ||
--set 'global.adminPartitions.enabled=true' \ | ||
--set 'global.adminPartitions.service.type=NodePort' \ | ||
--set 'global.adminPartitions.service.nodePort.rpc=4443' \ | ||
--set 'global.adminPartitions.service.nodePort.https=4444' \ | ||
--set 'global.adminPartitions.service.nodePort.serf=4445' \ | ||
--set 'global.enableConsulNamespaces=true' \ | ||
. | tee /dev/stderr | | ||
yq -r '.spec.ports[]' | tee /dev/stderr) | ||
|
||
local actual | ||
actual=$(echo $ports | jq -r 'select(.name == "server") | .nodePort' | tee /dev/stderr) | ||
[ "${actual}" == "4443" ] | ||
|
||
actual=$(echo $ports | jq -r 'select(.name == "https") | .nodePort' | tee /dev/stderr) | ||
[ "${actual}" == "4444" ] | ||
|
||
actual=$(echo $ports | jq -r 'select(.name == "serflan") | .nodePort' | tee /dev/stderr) | ||
[ "${actual}" == "4445" ] | ||
} |
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
Oops, something went wrong.