From dbea2773baca8d3f5bbd1b0c0317d4b14fb04524 Mon Sep 17 00:00:00 2001 From: Horst Gutmann Date: Mon, 4 Mar 2019 21:22:03 +0100 Subject: [PATCH] Helm chart: Fix ingress setup (#1086) * Helm chart: Fix ingress setup The ingress part of the Helm chart contained references to not-existing templates and values. Additionally, the deployment used some no longer available health-check URLs which prevented it from being marked as ready. * Make readiness and liveness paths depend on the image.tag --- charts/athens-proxy/templates/_helpers.tpl | 6 ++++++ charts/athens-proxy/templates/deployment.yaml | 4 ++-- charts/athens-proxy/templates/ingress.yaml | 6 +++--- charts/athens-proxy/templates/service.yaml | 2 +- charts/athens-proxy/values.yaml | 2 ++ 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/charts/athens-proxy/templates/_helpers.tpl b/charts/athens-proxy/templates/_helpers.tpl index afffd0b9..24d5289e 100644 --- a/charts/athens-proxy/templates/_helpers.tpl +++ b/charts/athens-proxy/templates/_helpers.tpl @@ -2,3 +2,9 @@ {{- $name := default .Chart.Name .Values.nameOverride -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{- define "livenessPath" -}} +{{- if eq .Values.image.tag "v0.2.0" -}}/{{- else -}}/healthz{{- end -}} +{{- end -}} +{{- define "readinessPath" -}} +{{- if eq .Values.image.tag "v0.2.0" -}}/{{- else -}}/readyz{{- end -}} +{{- end -}} diff --git a/charts/athens-proxy/templates/deployment.yaml b/charts/athens-proxy/templates/deployment.yaml index 53e1d082..e8ba7170 100644 --- a/charts/athens-proxy/templates/deployment.yaml +++ b/charts/athens-proxy/templates/deployment.yaml @@ -23,11 +23,11 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy | quote }} livenessProbe: httpGet: - path: /healthz + path: "{{ template "livenessPath" . }}" port: 3000 readinessProbe: httpGet: - path: /readyz + path: "{{ template "readinessPath" . }}" port: 3000 env: - name: ATHENS_STORAGE_TYPE diff --git a/charts/athens-proxy/templates/ingress.yaml b/charts/athens-proxy/templates/ingress.yaml index 90bf7dc7..e6e899c2 100644 --- a/charts/athens-proxy/templates/ingress.yaml +++ b/charts/athens-proxy/templates/ingress.yaml @@ -1,12 +1,12 @@ {{- if .Values.ingress.enabled -}} {{- $serviceName := include "fullname" . -}} -{{- $servicePort := .Values.service.externalPort -}} +{{- $servicePort := .Values.service.servicePort -}} apiVersion: extensions/v1beta1 kind: Ingress metadata: - name: {{ template "blahblah.fullname" . }} + name: {{ template "fullname" . }} labels: - app: {{ template "blahblah.name" . }} + app: {{ template "fullname" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} diff --git a/charts/athens-proxy/templates/service.yaml b/charts/athens-proxy/templates/service.yaml index 04d8edcd..5487fb0f 100644 --- a/charts/athens-proxy/templates/service.yaml +++ b/charts/athens-proxy/templates/service.yaml @@ -13,7 +13,7 @@ spec: app: {{ template "fullname" . }} ports: - name: http - port: 80 + port: {{ .Values.service.servicePort }} targetPort: 3000 protocol: TCP {{- if eq .Values.service.type "NodePort" }} diff --git a/charts/athens-proxy/values.yaml b/charts/athens-proxy/values.yaml index 434452e8..081317dd 100644 --- a/charts/athens-proxy/values.yaml +++ b/charts/athens-proxy/values.yaml @@ -10,6 +10,8 @@ image: pullPolicy: Always service: + ## Port as exposed by the service + servicePort: 80 ## Type of service; valid values are "ClusterIP", "LoadBalancer", and ## "NodePort". "ClusterIP" is sufficient in the case when the Proxy will be used ## from within the cluster. To expose externally, consider a "NodePort" or "LoadBalancer" service.