From ef177b5e5707455e1be268a51c0a4a03b9bffa46 Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Sat, 3 Mar 2018 18:31:01 +0000 Subject: [PATCH] Congress: use endpoints section and lookups to set port This PS moves congress to use the endpoints section and lookups to set the port it serves on. This PS also fixed the pod name to match other openstack-helm deployments Change-Id: I89c8d6c8b09df3aa0123c50fdd9e4850c275b85f --- congress/templates/configmap-etc.yaml | 3 +++ congress/templates/deployment-api.yaml | 9 +++++---- congress/templates/service-api.yaml | 2 +- congress/values.yaml | 4 +++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/congress/templates/configmap-etc.yaml b/congress/templates/configmap-etc.yaml index bf9c5a8ab7..ebd3fe0873 100644 --- a/congress/templates/configmap-etc.yaml +++ b/congress/templates/configmap-etc.yaml @@ -56,6 +56,9 @@ limitations under the License. {{- set .Values.conf.congress.keystone_authtoken "password" .Values.endpoints.identity.auth.congress.password | quote | trunc 0 -}} {{- end -}} +{{- if empty .Values.conf.congress.DEFAULT.bind_port -}} +{{- tuple "policy" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | set .Values.conf.congress.DEFAULT "bind_port" | quote | trunc 0 -}} +{{- end -}} --- apiVersion: v1 diff --git a/congress/templates/deployment-api.yaml b/congress/templates/deployment-api.yaml index d90285fa70..999ac559df 100644 --- a/congress/templates/deployment-api.yaml +++ b/congress/templates/deployment-api.yaml @@ -18,13 +18,13 @@ limitations under the License. {{- $envAll := . }} {{- $dependencies := .Values.dependencies.static.api }} -{{- $serviceAccountName := "congress-api-dep" }} +{{- $serviceAccountName := "congress-api" }} {{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} --- apiVersion: extensions/v1beta1 kind: Deployment metadata: - name: congress-api-dep + name: congress-api spec: replicas: {{ .Values.pod.replicas.api }} {{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} @@ -50,10 +50,11 @@ spec: - /tmp/congress-api.sh - start ports: - - containerPort: {{ .Values.conf.congress.DEFAULT.bind_port }} + - name: c-api + containerPort: {{ tuple "policy" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} readinessProbe: tcpSocket: - port: {{ .Values.conf.congress.DEFAULT.bind_port }} + port: {{ tuple "policy" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} volumeMounts: - name: etccongress mountPath: /etc/congress diff --git a/congress/templates/service-api.yaml b/congress/templates/service-api.yaml index ad43561c03..c5fb510687 100644 --- a/congress/templates/service-api.yaml +++ b/congress/templates/service-api.yaml @@ -24,7 +24,7 @@ metadata: spec: ports: - name: c-api - port: {{ .Values.conf.congress.DEFAULT.bind_port }} + port: {{ tuple "policy" "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/congress/values.yaml b/congress/values.yaml index a28c8f0861..5209aafba1 100644 --- a/congress/values.yaml +++ b/congress/values.yaml @@ -281,7 +281,9 @@ policy: conf: congress: DEFAULT: - bind_port: 1789 + #NOTE(portdirect): the bind port should not be defined, and is manipulated + # via the endpoints section. + bind_port: null drivers: congress.datasources.neutronv2_driver.NeutronV2Driver,congress.datasources.glancev2_driver.GlanceV2Driver,congress.datasources.nova_driver.NovaDriver,congress.datasources.keystonev3_driver.KeystoneV3Driver,congress.datasources.cinder_driver.CinderDriver,congress.datasources.swift_driver.SwiftDriver,congress.datasources.plexxi_driver.PlexxiDriver,congress.datasources.vCenter_driver.VCenterDriver,congress.datasources.murano_driver.MuranoDriver,congress.datasources.ironic_driver.IronicDriver,congress.datasources.heatv1_driver.HeatV1Driver,congress.datasources.doctor_driver.DoctorDriver,congress.datasources.ceilometer_driver.CeilometerDriver replicated_policy_engine: False datasource_sync_period: 30