From 6810cc6aa819b1387175b26baea3a4c257e912b2 Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Sat, 3 Mar 2018 15:19:42 +0000 Subject: [PATCH] Barbican: use endpoints section and lookups to set port This PS moves barbican to use the endpoints section and lookups to set the port it serves on. Change-Id: Ic48382b978259333edc35cda3f2294703a39fce4 --- barbican/templates/configmap-etc.yaml | 6 +++++- barbican/templates/deployment-api.yaml | 5 +++-- barbican/templates/service-api.yaml | 2 +- barbican/values.yaml | 4 +++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/barbican/templates/configmap-etc.yaml b/barbican/templates/configmap-etc.yaml index 9688041cf9..881775feeb 100644 --- a/barbican/templates/configmap-etc.yaml +++ b/barbican/templates/configmap-etc.yaml @@ -66,8 +66,12 @@ limitations under the License. {{- tuple "key_manager" "public" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | trimSuffix $barbicanPath | set .Values.conf.barbican.DEFAULT "host_href" | quote | trunc 0 -}} {{- end -}} +{{- if empty .Values.conf.barbican.barbican_api.bind_port -}} +{{- tuple "key_manager" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | set .Values.conf.barbican.barbican_api "bind_port" | quote | trunc 0 -}} +{{- end -}} + {{- if empty .Values.conf.barbican_api.uwsgi.socket -}} -{{- printf ":%1.f" .Values.conf.barbican.barbican_api.bind_port | set .Values.conf.barbican_api.uwsgi "socket" | quote | trunc 0 -}} +{{- printf ":%s" ( tuple "key_manager" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" ) | set .Values.conf.barbican_api.uwsgi "socket" | quote | trunc 0 -}} {{- end -}} --- diff --git a/barbican/templates/deployment-api.yaml b/barbican/templates/deployment-api.yaml index 27cb680443..fbcfcce069 100644 --- a/barbican/templates/deployment-api.yaml +++ b/barbican/templates/deployment-api.yaml @@ -63,10 +63,11 @@ spec: - /tmp/barbican.sh - stop ports: - - containerPort: {{ .Values.conf.barbican.barbican_api.bind_port }} + - name: b-api + containerPort: {{ tuple "key_manager" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} readinessProbe: tcpSocket: - port: {{ .Values.conf.barbican.barbican_api.bind_port }} + port: {{ tuple "key_manager" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} volumeMounts: - name: etcbarbican mountPath: /etc/barbican diff --git a/barbican/templates/service-api.yaml b/barbican/templates/service-api.yaml index 2bdebdd4f3..7c79810a7e 100644 --- a/barbican/templates/service-api.yaml +++ b/barbican/templates/service-api.yaml @@ -24,7 +24,7 @@ metadata: spec: ports: - name: b-api - port: {{ .Values.conf.barbican.barbican_api.bind_port }} + port: {{ tuple "key-manager" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} {{ if .Values.network.api.node_port.enabled }} nodePort: {{ .Values.network.api.node_port.port }} {{ end }} diff --git a/barbican/values.yaml b/barbican/values.yaml index 0fe9fdc889..8d1a5271b4 100644 --- a/barbican/values.yaml +++ b/barbican/values.yaml @@ -392,7 +392,9 @@ conf: database: max_retries: -1 barbican_api: - bind_port: 9311 + #NOTE(portdirect): the bind port should not be defined, and is manipulated + # via the endpoints section. + bind_port: null # Names of secrets used by bootstrap and environmental checks secrets: