From 18276be75da9ab25a19cf4aaea79b0bc5b24bb34 Mon Sep 17 00:00:00 2001 From: Maarten de Waard Date: Tue, 5 Oct 2021 16:13:59 +0200 Subject: [PATCH] use relative path for backend URLs --- .env | 4 ++-- .gitignore | 3 +++ deployment/helmchart/templates/configmaps.yaml | 6 ++---- deployment/helmchart/templates/deployment.yaml | 8 ++++---- deployment/helmchart/templates/ingress.yaml | 11 +++++++++++ deployment/helmchart/values-local.yaml | 2 ++ deployment/helmchart/values.yaml | 8 ++++---- 7 files changed, 28 insertions(+), 14 deletions(-) diff --git a/.env b/.env index d2d7b10..1542add 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ -REACT_APP_API_URL=https://oas-api.initdevelopment.com/api/v1 -EXTEND_ESLINT=true \ No newline at end of file +REACT_APP_API_URL=/api/v1 +EXTEND_ESLINT=true diff --git a/.gitignore b/.gitignore index 9d70429..59d0f65 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,6 @@ yarn-error.log* .eslintcache cypress/videos/ + +# Helm dependencies +deployment/helmchart/charts/ diff --git a/deployment/helmchart/templates/configmaps.yaml b/deployment/helmchart/templates/configmaps.yaml index d893d75..ff3878c 100644 --- a/deployment/helmchart/templates/configmaps.yaml +++ b/deployment/helmchart/templates/configmaps.yaml @@ -10,10 +10,8 @@ metadata: annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} data: - REACT_APP_API_URL: "{{ include "adminBackend.serviceName" .}}" - EXTEND_ESLINT: "{{ .Values.adminFrontend.extendEslint }}" - ADMIN_FRONTEND_HOST: "{{ include "adminFrontend.host" . }}" - ADMIN_BACKEND_HOST: "{{ include "adminBackend.host" . }}" + # ADMIN_FRONTEND_HOST: "{{ include "adminFrontend.host" . }}" + # ADMIN_BACKEND_HOST: "{{ include "adminBackend.host" . }}" # Probably needed in the future: # ADMIN_BACKEND_USERNAME: {{ .Values.adminBackend.username | quote }} # ADMIN_BACKEND_EMAIL: {{ .Values.adminBackend.email | quote }} diff --git a/deployment/helmchart/templates/deployment.yaml b/deployment/helmchart/templates/deployment.yaml index 7dec374..8383ead 100644 --- a/deployment/helmchart/templates/deployment.yaml +++ b/deployment/helmchart/templates/deployment.yaml @@ -87,7 +87,7 @@ spec: {{- if .Values.adminFrontend.livenessProbe.enabled }} livenessProbe: httpGet: - path: /srv/status + path: / port: frontend-http initialDelaySeconds: {{ .Values.adminFrontend.livenessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.adminFrontend.livenessProbe.periodSeconds }} @@ -100,7 +100,7 @@ spec: {{- if .Values.adminFrontend.readinessProbe.enabled }} readinessProbe: httpGet: - path: /srv/status + path: / port: frontend-http initialDelaySeconds: {{ .Values.adminFrontend.readinessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.adminFrontend.readinessProbe.periodSeconds }} @@ -161,7 +161,7 @@ spec: {{- if .Values.adminBackend.livenessProbe.enabled }} livenessProbe: httpGet: - path: /srv/status + path: / port: backend-http initialDelaySeconds: {{ .Values.adminBackend.livenessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.adminBackend.livenessProbe.periodSeconds }} @@ -174,7 +174,7 @@ spec: {{- if .Values.adminBackend.readinessProbe.enabled }} readinessProbe: httpGet: - path: /srv/status + path: / port: backend-http initialDelaySeconds: {{ .Values.adminBackend.readinessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.adminBackend.readinessProbe.periodSeconds }} diff --git a/deployment/helmchart/templates/ingress.yaml b/deployment/helmchart/templates/ingress.yaml index e06ffa7..e200ea1 100644 --- a/deployment/helmchart/templates/ingress.yaml +++ b/deployment/helmchart/templates/ingress.yaml @@ -41,6 +41,12 @@ spec: pathType: {{ .Values.ingress.pathType }} {{- end }} backend: {{- include "common.ingress.backend" (dict "serviceName" (include "adminFrontend.serviceName" .) "servicePort" "frontend-http" "context" $) | nindent 14 }} + # Forward API calls to the back-end container + - path: {{ .Values.ingress.path }}api/v1 + {{- if eq "true" (include "common.ingress.supportsPathType" .) }} + pathType: {{ .Values.ingress.pathType }} + {{- end }} + backend: {{- include "common.ingress.backend" (dict "serviceName" (include "adminBackend.serviceName" .) "servicePort" "backend-http" "context" $) | nindent 14 }} {{- end }} {{- range .Values.ingress.extraHosts }} - host: {{ .name }} @@ -51,5 +57,10 @@ spec: pathType: {{ default "ImplementationSpecific" .pathType }} {{- end }} backend: {{- include "common.ingress.backend" (dict "serviceName" (include "adminFrontend.serviceName" $) "servicePort" "frontend-http" "context" $) | nindent 14 }} + - path: {{ default "/" .path }}api/v1 + {{- if eq "true" (include "common.ingress.supportsPathType" $) }} + pathType: {{ default "ImplementationSpecific" .pathType }} + {{- end }} + backend: {{- include "common.ingress.backend" (dict "serviceName" (include "adminBackend.serviceName" .) "servicePort" "backend-http" "context" $) | nindent 14 }} {{- end }} {{- end }} diff --git a/deployment/helmchart/values-local.yaml b/deployment/helmchart/values-local.yaml index d14982a..a33145a 100644 --- a/deployment/helmchart/values-local.yaml +++ b/deployment/helmchart/values-local.yaml @@ -4,6 +4,8 @@ adminFrontend: enabled: false readinessProbe: enabled: false + image: + tag: 2-add-helm-chart adminBackend: livenessProbe: diff --git a/deployment/helmchart/values.yaml b/deployment/helmchart/values.yaml index 4f155b4..f63b3e9 100644 --- a/deployment/helmchart/values.yaml +++ b/deployment/helmchart/values.yaml @@ -165,7 +165,7 @@ adminFrontend: ## livenessProbe: enabled: true - initialDelaySeconds: 500 + initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 6 @@ -183,7 +183,7 @@ adminFrontend: ## readinessProbe: enabled: true - initialDelaySeconds: 30 + initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 6 @@ -377,7 +377,7 @@ adminBackend: ## livenessProbe: enabled: true - initialDelaySeconds: 500 + initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 6 @@ -395,7 +395,7 @@ adminBackend: ## readinessProbe: enabled: true - initialDelaySeconds: 30 + initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 6