From 3f44f4586aac42ac3644f9f7c4d4e268e2151281 Mon Sep 17 00:00:00 2001 From: Steve Wilkerson Date: Mon, 5 Mar 2018 10:03:48 -0600 Subject: [PATCH] Elasticsearch: use endpoints section and lookups to set port This PS moves elasticsearch to use the endpoints section and lookups to set the port it serves on. Change-Id: I4a73893124b6d988cd1f885cfc3dd62abeb4ae8c --- elasticsearch/templates/deployment-client.yaml | 8 ++++---- elasticsearch/templates/deployment-master.yaml | 4 ++-- .../monitoring/prometheus/exporter-deployment.yaml | 2 +- .../templates/monitoring/prometheus/exporter-service.yaml | 2 +- elasticsearch/templates/service-data.yaml | 2 +- elasticsearch/templates/service-discovery.yaml | 2 +- elasticsearch/templates/service-logging.yaml | 2 +- elasticsearch/templates/statefulset-data.yaml | 4 ++-- elasticsearch/values.yaml | 5 ----- 9 files changed, 13 insertions(+), 18 deletions(-) diff --git a/elasticsearch/templates/deployment-client.yaml b/elasticsearch/templates/deployment-client.yaml index 15f3a3d18..381a1a137 100644 --- a/elasticsearch/templates/deployment-client.yaml +++ b/elasticsearch/templates/deployment-client.yaml @@ -169,18 +169,18 @@ spec: - stop ports: - name: http - containerPort: {{ .Values.network.client.port }} + containerPort: {{ tuple "elasticsearch" "internal" "http" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} - name: transport - containerPort: {{ .Values.network.discovery.port }} + containerPort: {{ tuple "elasticsearch" "internal" "discovery" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} livenessProbe: tcpSocket: - port: {{ .Values.network.discovery.port }} + port: {{ tuple "elasticsearch" "internal" "discovery" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} initialDelaySeconds: 20 periodSeconds: 10 readinessProbe: httpGet: path: /_cluster/health - port: {{ .Values.network.client.port }} + port: {{ tuple "elasticsearch" "internal" "client" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} env: - name: NAMESPACE valueFrom: diff --git a/elasticsearch/templates/deployment-master.yaml b/elasticsearch/templates/deployment-master.yaml index 41d5e581b..d455942fe 100644 --- a/elasticsearch/templates/deployment-master.yaml +++ b/elasticsearch/templates/deployment-master.yaml @@ -131,10 +131,10 @@ spec: - stop ports: - name: transport - containerPort: {{ .Values.network.discovery.port }} + containerPort: {{ tuple "elasticsearch" "internal" "discovery" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} livenessProbe: tcpSocket: - port: {{ .Values.network.discovery.port }} + port: {{ tuple "elasticsearch" "internal" "discovery" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} initialDelaySeconds: 20 periodSeconds: 10 env: diff --git a/elasticsearch/templates/monitoring/prometheus/exporter-deployment.yaml b/elasticsearch/templates/monitoring/prometheus/exporter-deployment.yaml index d9b10d1a7..83a8d488a 100644 --- a/elasticsearch/templates/monitoring/prometheus/exporter-deployment.yaml +++ b/elasticsearch/templates/monitoring/prometheus/exporter-deployment.yaml @@ -66,7 +66,7 @@ spec: key: ELASTICSEARCH_URI ports: - name: metrics - containerPort: {{ .Values.network.prometheus_elasticsearch_exporter.port }} + containerPort: {{ tuple "prometheus_elasticsearch_exporter" "internal" "metrics" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} volumeMounts: - name: elasticsearch-exporter-bin mountPath: /tmp/elasticsearch-exporter.sh diff --git a/elasticsearch/templates/monitoring/prometheus/exporter-service.yaml b/elasticsearch/templates/monitoring/prometheus/exporter-service.yaml index 2b9db7333..1d04b4aa5 100644 --- a/elasticsearch/templates/monitoring/prometheus/exporter-service.yaml +++ b/elasticsearch/templates/monitoring/prometheus/exporter-service.yaml @@ -31,7 +31,7 @@ metadata: spec: ports: - name: metrics - port: {{ .Values.network.prometheus_elasticsearch_exporter.port }} + port: {{ tuple "prometheus_elasticsearch_exporter" "internal" "metrics" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} selector: {{ tuple $envAll "elasticsearch" "exporter" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{- end }} diff --git a/elasticsearch/templates/service-data.yaml b/elasticsearch/templates/service-data.yaml index e488ba63e..0dc7e544b 100644 --- a/elasticsearch/templates/service-data.yaml +++ b/elasticsearch/templates/service-data.yaml @@ -24,7 +24,7 @@ metadata: spec: ports: - name: transport - port: {{ .Values.network.data.port }} + port: {{ tuple "elasticsearch" "internal" "discovery" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} {{- if .Values.network.data.node_port.enabled }} nodePort: {{ .Values.network.data.node_port.port }} {{- end }} diff --git a/elasticsearch/templates/service-discovery.yaml b/elasticsearch/templates/service-discovery.yaml index 172c06ae2..efe2f0c2b 100644 --- a/elasticsearch/templates/service-discovery.yaml +++ b/elasticsearch/templates/service-discovery.yaml @@ -24,7 +24,7 @@ metadata: spec: ports: - name: transport - port: {{ .Values.network.discovery.port }} + port: {{ tuple "elasticsearch" "internal" "discovery" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} {{- if .Values.network.discovery.node_port.enabled }} nodePort: {{ .Values.network.discovery.node_port.port }} {{- end }} diff --git a/elasticsearch/templates/service-logging.yaml b/elasticsearch/templates/service-logging.yaml index 7b937e247..a096617c8 100644 --- a/elasticsearch/templates/service-logging.yaml +++ b/elasticsearch/templates/service-logging.yaml @@ -24,7 +24,7 @@ metadata: spec: ports: - name: http - port: 80 + port: {{ tuple "elasticsearch" "internal" "http" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} {{- if .Values.network.client.node_port.enabled }} nodePort: {{ .Values.network.client.node_port.port }} {{- end }} diff --git a/elasticsearch/templates/statefulset-data.yaml b/elasticsearch/templates/statefulset-data.yaml index 353f6da40..36745033a 100644 --- a/elasticsearch/templates/statefulset-data.yaml +++ b/elasticsearch/templates/statefulset-data.yaml @@ -128,10 +128,10 @@ spec: - stop ports: - name: transport - containerPort: {{ .Values.network.data.port }} + containerPort: {{ tuple "elasticsearch" "internal" "discovery" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} livenessProbe: tcpSocket: - port: {{ .Values.network.discovery.port }} + port: {{ tuple "elasticsearch" "internal" "discovery" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} initialDelaySeconds: 20 periodSeconds: 10 env: diff --git a/elasticsearch/values.yaml b/elasticsearch/values.yaml index cae448f7c..5a10fc64b 100644 --- a/elasticsearch/values.yaml +++ b/elasticsearch/values.yaml @@ -337,22 +337,17 @@ monitoring: network: client: - port: 9200 node_port: enabled: false port: 30920 discovery: - port: 9300 node_port: enabled: false port: 30930 data: - port: 9300 node_port: enabled: false port: 30931 - prometheus_elasticsearch_exporter: - port: 9108 storage: elasticsearch: