Custom value of agent port (#489)
* configure the agent port * add unit test * remove default * remove default * Update values.yaml Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com>
This commit is contained in:
parent
dc696bb1f3
commit
d8c2d2058c
5 changed files with 62 additions and 4 deletions
|
@ -53,7 +53,7 @@ spec:
|
|||
{{- end }}
|
||||
env:
|
||||
- name: AGENT_INJECT_LISTEN
|
||||
value: ":8080"
|
||||
value: {{ printf ":%v" .Values.injector.port }}
|
||||
- name: AGENT_INJECT_LOG_LEVEL
|
||||
value: {{ .Values.injector.logLevel | default "info" }}
|
||||
- name: AGENT_INJECT_VAULT_ADDR
|
||||
|
@ -104,7 +104,7 @@ spec:
|
|||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health/ready
|
||||
port: 8080
|
||||
port: {{ .Values.injector.port }}
|
||||
scheme: HTTPS
|
||||
failureThreshold: 2
|
||||
initialDelaySeconds: 5
|
||||
|
@ -114,7 +114,7 @@ spec:
|
|||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health/ready
|
||||
port: 8080
|
||||
port: {{ .Values.injector.port }}
|
||||
scheme: HTTPS
|
||||
failureThreshold: 2
|
||||
initialDelaySeconds: 5
|
||||
|
|
|
@ -12,7 +12,7 @@ metadata:
|
|||
spec:
|
||||
ports:
|
||||
- port: 443
|
||||
targetPort: 8080
|
||||
targetPort: {{ .Values.injector.port }}
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ include "vault.name" . }}-agent-injector
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
|
|
|
@ -422,6 +422,42 @@ load _helpers
|
|||
[ "${actual}" = "bar" ]
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# agent port
|
||||
|
||||
@test "injector/deployment: default agentPort" {
|
||||
cd `chart_dir`
|
||||
local object=$(helm template \
|
||||
--show-only templates/injector-deployment.yaml \
|
||||
. | tee /dev/stderr |
|
||||
yq -r '.spec.template.spec.containers[0].env' | tee /dev/stderr)
|
||||
|
||||
local actual=$(echo $object |
|
||||
yq -r '.[0].name' | tee /dev/stderr)
|
||||
[ "${actual}" = "AGENT_INJECT_LISTEN" ]
|
||||
|
||||
local actual=$(echo $object |
|
||||
yq -r '.[0].value' | tee /dev/stderr)
|
||||
[ "${actual}" = ":8080" ]
|
||||
}
|
||||
|
||||
@test "injector/deployment: custom agentPort" {
|
||||
cd `chart_dir`
|
||||
local object=$(helm template \
|
||||
--show-only templates/injector-deployment.yaml \
|
||||
--set 'injector.port=8443' \
|
||||
. | tee /dev/stderr |
|
||||
yq -r '.spec.template.spec.containers[0].env' | tee /dev/stderr)
|
||||
|
||||
local actual=$(echo $object |
|
||||
yq -r '.[0].name' | tee /dev/stderr)
|
||||
[ "${actual}" = "AGENT_INJECT_LISTEN" ]
|
||||
|
||||
local actual=$(echo $object |
|
||||
yq -r '.[0].value' | tee /dev/stderr)
|
||||
[ "${actual}" = ":8443" ]
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# affinity
|
||||
|
||||
|
|
|
@ -18,6 +18,25 @@ load _helpers
|
|||
[ "${actual}" = "true" ]
|
||||
}
|
||||
|
||||
@test "injector/Service: service with default port" {
|
||||
cd `chart_dir`
|
||||
local actual=$(helm template \
|
||||
--show-only templates/injector-service.yaml \
|
||||
. | tee /dev/stderr |
|
||||
yq -r '.spec.ports[0].targetPort' | tee /dev/stderr)
|
||||
[ "${actual}" = "8080" ]
|
||||
}
|
||||
|
||||
@test "injector/Service: service with custom port" {
|
||||
cd `chart_dir`
|
||||
local actual=$(helm template \
|
||||
--show-only templates/injector-service.yaml \
|
||||
--set 'injector.port=8443' \
|
||||
. | tee /dev/stderr |
|
||||
yq -r '.spec.ports[0].targetPort' | tee /dev/stderr)
|
||||
[ "${actual}" = "8443" ]
|
||||
}
|
||||
|
||||
@test "injector/Service: disable with global.enabled false" {
|
||||
cd `chart_dir`
|
||||
local actual=$( (helm template \
|
||||
|
|
|
@ -29,6 +29,9 @@ injector:
|
|||
|
||||
replicas: 1
|
||||
|
||||
# Configures the port the injector should listen on
|
||||
port: 8080
|
||||
|
||||
# If multiple replicas are specified, by default a leader-elector side-car
|
||||
# will be created so that only one injector attempts to create TLS certificates.
|
||||
leaderElector:
|
||||
|
|
Loading…
Reference in a new issue