Gnocchi: use endpoints section and lookups to set port

This PS moves gnocchi to use the endpoints section and lookups to
set the port it serves on.

Change-Id: I509d2324d9d063bc382baa4c7676ef415de99907
This commit is contained in:
portdirect 2018-03-03 22:31:10 -05:00 committed by Pete Birley
parent 16c6d31155
commit e1a731dc67
7 changed files with 37 additions and 11 deletions

View File

@ -75,6 +75,14 @@ limitations under the License.
{{- uuidv4 | set .Values.conf.gnocchi.statsd "project_id" | quote | trunc 0 -}} {{- uuidv4 | set .Values.conf.gnocchi.statsd "project_id" | quote | trunc 0 -}}
{{- end -}} {{- end -}}
{{- if empty .Values.conf.gnocchi.api.port -}}
{{- tuple "metric" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | set .Values.conf.gnocchi.api "port" | quote | trunc 0 -}}
{{- end -}}
{{- if empty .Values.conf.gnocchi.statsd.port -}}
{{- tuple "metric_statsd" "internal" "statsd" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | set .Values.conf.gnocchi.statsd "port" | quote | trunc 0 -}}
{{- end -}}
{{- $envAll := . }} {{- $envAll := . }}
--- ---
apiVersion: v1 apiVersion: v1

View File

@ -67,7 +67,7 @@ spec:
- /tmp/gnocchi-statsd.sh - /tmp/gnocchi-statsd.sh
ports: ports:
- name: gn-stats - name: gn-stats
containerPort: {{ .Values.conf.gnocchi.statsd.port }} containerPort: {{ tuple "metric_statsd" "internal" "statsd" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
volumeMounts: volumeMounts:
- name: pod-etc-gnocchi - name: pod-etc-gnocchi
mountPath: /etc/gnocchi mountPath: /etc/gnocchi

View File

@ -79,10 +79,10 @@ spec:
- stop - stop
ports: ports:
- name: gn-api - name: gn-api
containerPort: {{ .Values.conf.gnocchi.api.port }} containerPort: {{ tuple "metric" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: {{ .Values.conf.gnocchi.api.port }} port: {{ tuple "metric" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
volumeMounts: volumeMounts:
- name: pod-etc-gnocchi - name: pod-etc-gnocchi
mountPath: /etc/gnocchi mountPath: /etc/gnocchi

View File

@ -14,13 +14,13 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
Listen 0.0.0.0:{{ .Values.conf.gnocchi.api.port }} Listen 0.0.0.0:{{ tuple "metric" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded
CustomLog /dev/stdout combined env=!forwarded CustomLog /dev/stdout combined env=!forwarded
CustomLog /dev/stdout proxy env=forwarded CustomLog /dev/stdout proxy env=forwarded
<VirtualHost *:{{ .Values.conf.gnocchi.api.port }}> <VirtualHost *:{{ tuple "metric" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}>
WSGIDaemonProcess gnocchi processes=1 threads=2 user=gnocchi group=gnocchi display-name=%{GROUP} WSGIDaemonProcess gnocchi processes=1 threads=2 user=gnocchi group=gnocchi display-name=%{GROUP}
WSGIProcessGroup gnocchi WSGIProcessGroup gnocchi
WSGIScriptAlias / "/var/lib/kolla/venv/lib/python2.7/site-packages/gnocchi/rest/app.wsgi" WSGIScriptAlias / "/var/lib/kolla/venv/lib/python2.7/site-packages/gnocchi/rest/app.wsgi"

View File

@ -24,7 +24,7 @@ metadata:
spec: spec:
ports: ports:
- name: gn-api - name: gn-api
port: {{ .Values.conf.gnocchi.api.port }} port: {{ tuple "metric" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
{{ if .Values.network.api.node_port.enabled }} {{ if .Values.network.api.node_port.enabled }}
nodePort: {{ .Values.network.api.node_port.port }} nodePort: {{ .Values.network.api.node_port.port }}
{{ end }} {{ end }}

View File

@ -20,15 +20,16 @@ limitations under the License.
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: gnocchi-statsd name: {{ tuple "metric_statsd" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec: spec:
ports: ports:
- port: {{ .Values.conf.gnocchi.statsd.port }} - name: gn-stats
port: {{ tuple "metric_statsd" "internal" "statsd" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
{{ if .Values.network.statsd.node_port.enabled }} {{ if .Values.network.statsd.node_port.enabled }}
nodePort: {{ .Values.network.statsd.node_port.port }} nodePort: {{ .Values.network.statsd.node_port.port }}
{{ end }} {{ end }}
selector: selector:
app: gnocchi-statsd {{ tuple $envAll "gnocchi" "statsd" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
{{ if .Values.network.statsd.node_port.enabled }} {{ if .Values.network.statsd.node_port.enabled }}
type: NodePort type: NodePort
{{ end }} {{ end }}

View File

@ -331,9 +331,13 @@ conf:
provider: uuid provider: uuid
api: api:
auth_mode: keystone auth_mode: keystone
port: 8041 #NOTE(portdirect): the bind port should not be defined, and is manipulated
# via the endpoints section.
port: null
statsd: statsd:
port: 8125 #NOTE(portdirect): the bind port should not be defined, and is manipulated
# via the endpoints section.
port: null
metricd: metricd:
workers: 1 workers: 1
database: database:
@ -427,6 +431,19 @@ endpoints:
api: api:
default: 8041 default: 8041
public: 80 public: 80
metric_statsd:
name: gnocchi-statsd
hosts:
default: gnocchi-statsd
host_fqdn_override:
default: null
path:
default: null
scheme:
default: null
port:
statsd:
default: 8125
oslo_db_postgresql: oslo_db_postgresql:
auth: auth:
admin: admin: