Add configuration options for Vault UI service (#285)
* Add configuration options for Vault UI service - Configure to select active Vault pod only - Configure to not publish unready address * Create active label only on HA
This commit is contained in:
parent
f0c073e3ee
commit
5dc29f6c84
3 changed files with 61 additions and 8 deletions
|
@ -2,11 +2,6 @@
|
||||||
{{- if ne .mode "external" }}
|
{{- if ne .mode "external" }}
|
||||||
{{- if and (ne .mode "") (eq (.Values.global.enabled | toString) "true") }}
|
{{- if and (ne .mode "") (eq (.Values.global.enabled | toString) "true") }}
|
||||||
{{- if eq (.Values.ui.enabled | toString) "true" }}
|
{{- if eq (.Values.ui.enabled | toString) "true" }}
|
||||||
# Headless service for Vault server DNS entries. This service should only
|
|
||||||
# point to Vault servers. For access to an agent, one should assume that
|
|
||||||
# the agent is installed locally on the node and the NODE_IP should be used.
|
|
||||||
# If the node can't run a Vault agent, then this service can be used to
|
|
||||||
# communicate directly to a server agent.
|
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
|
@ -23,7 +18,10 @@ spec:
|
||||||
app.kubernetes.io/name: {{ include "vault.name" . }}
|
app.kubernetes.io/name: {{ include "vault.name" . }}
|
||||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
component: server
|
component: server
|
||||||
publishNotReadyAddresses: true
|
{{- if and (.Values.ui.activeVaultPodOnly) (eq .mode "ha") }}
|
||||||
|
vault-active: "true"
|
||||||
|
{{- end }}
|
||||||
|
publishNotReadyAddresses: {{ .Values.ui.publishNotReadyAddresses }}
|
||||||
ports:
|
ports:
|
||||||
- name: {{ include "vault.scheme" . }}
|
- name: {{ include "vault.scheme" . }}
|
||||||
port: {{ .Values.ui.externalPort }}
|
port: {{ .Values.ui.externalPort }}
|
||||||
|
@ -43,5 +41,5 @@ spec:
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{ end }}
|
{{- end }}
|
||||||
{{ end }}
|
{{- end }}
|
||||||
|
|
|
@ -248,3 +248,55 @@ load _helpers
|
||||||
yq -r '.spec.ports[0].name' | tee /dev/stderr)
|
yq -r '.spec.ports[0].name' | tee /dev/stderr)
|
||||||
[ "${actual}" = "https" ]
|
[ "${actual}" = "https" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "ui/Service: publishNotReadyAddresses set true by default" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
--show-only templates/ui-service.yaml \
|
||||||
|
--set 'ui.enabled=true' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.publishNotReadyAddresses' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "true" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "ui/Service: publishNotReadyAddresses can be set to false" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
--show-only templates/ui-service.yaml \
|
||||||
|
--set 'ui.enabled=true' \
|
||||||
|
--set 'ui.publishNotReadyAddresses=false' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.publishNotReadyAddresses' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = 'false' ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "ui/Service: active pod only selector not set by default" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
--show-only templates/ui-service.yaml \
|
||||||
|
--set 'ui.enabled=true' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.selector["vault-active"]' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "null" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "ui/Service: active pod only selector can be set on HA" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
--show-only templates/ui-service.yaml \
|
||||||
|
--set 'ui.enabled=true' \
|
||||||
|
--set 'ui.activeVaultPodOnly=true' \
|
||||||
|
--set 'server.dev.enabled=true' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.selector["vault-active"]' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = 'null' ]
|
||||||
|
|
||||||
|
local actual=$(helm template \
|
||||||
|
--show-only templates/ui-service.yaml \
|
||||||
|
--set 'ui.enabled=true' \
|
||||||
|
--set 'ui.activeVaultPodOnly=true' \
|
||||||
|
--set 'server.ha.enabled=true' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.selector["vault-active"]' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = 'true' ]
|
||||||
|
}
|
||||||
|
|
|
@ -525,6 +525,9 @@ ui:
|
||||||
# example, setting this to "LoadBalancer" will create an external load
|
# example, setting this to "LoadBalancer" will create an external load
|
||||||
# balancer (for supported K8S installations) to access the UI.
|
# balancer (for supported K8S installations) to access the UI.
|
||||||
enabled: false
|
enabled: false
|
||||||
|
publishNotReadyAddresses: true
|
||||||
|
# The service should only contain selectors for active Vault pod
|
||||||
|
activeVaultPodOnly: false
|
||||||
serviceType: "ClusterIP"
|
serviceType: "ClusterIP"
|
||||||
serviceNodePort: null
|
serviceNodePort: null
|
||||||
externalPort: 8200
|
externalPort: 8200
|
||||||
|
|
Loading…
Reference in a new issue