From adf7b2bb3e225af3d180c64d4d20c18db6568693 Mon Sep 17 00:00:00 2001 From: Marcin Jasion Date: Tue, 14 Nov 2023 17:45:08 +0100 Subject: [PATCH] add nginx sidecar --- charts/studio/nginx/ui-sidecar.conf | 28 ++++++++++++++++++ .../templates/deployment-studio-ui.yaml | 29 +++++++++++++++++++ charts/studio/templates/service-ui.yaml | 4 +++ 3 files changed, 61 insertions(+) create mode 100644 charts/studio/nginx/ui-sidecar.conf diff --git a/charts/studio/nginx/ui-sidecar.conf b/charts/studio/nginx/ui-sidecar.conf new file mode 100644 index 00000000..f62a10d2 --- /dev/null +++ b/charts/studio/nginx/ui-sidecar.conf @@ -0,0 +1,28 @@ +server { + listen 80; + access_log /dev/stdout; + error_log /dev/stdout debug; + + location / { + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass http://ui; + } +} + +upstream ui { + server 127.0.0.1:3000; +} + +# Health check endpoint +server { + access_log /dev/null main; + error_log /dev/null info; + + listen 8080; + location / { + return 200 'OK'; + } +} diff --git a/charts/studio/templates/deployment-studio-ui.yaml b/charts/studio/templates/deployment-studio-ui.yaml index 78af503a..a075c1be 100644 --- a/charts/studio/templates/deployment-studio-ui.yaml +++ b/charts/studio/templates/deployment-studio-ui.yaml @@ -19,6 +19,7 @@ spec: metadata: annotations: checksum/configmap-studio-ui: {{ include (print $.Template.BasePath "/configmap-studio-ui.yaml") . | sha256sum }} + checksum/configmap-studio-nginx: {{ include (print $.Template.BasePath "/configmap-studio-nginx.yaml") . | sha256sum }} {{- include "studio.checksum" . | indent 8 }} {{- with .Values.studioUi.podAnnotations }} {{- toYaml . | nindent 8 }} @@ -36,6 +37,31 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} containers: + - name: nginx-sidecar + image: "{{ .Values.studioBlobvault.image.repository }}:{{ .Values.studioBlobvault.image.tag }}" + ports: + - containerPort: 80 + protocol: TCP + name: nginx-http + livenessProbe: + tcpSocket: + port: 80 + periodSeconds: 10 + readinessProbe: + httpGet: + path: / + port: 8080 + initialDelaySeconds: 5 + periodSeconds: 10 + successThreshold: 3 + timeoutSeconds: 10 + volumeMounts: + - name: nginx-sidecar + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf + - name: nginx-sidecar + mountPath: /etc/nginx/conf.d/default.conf + subPath: ui-sidecar.conf - name: studio-ui securityContext: {{- toYaml .Values.studioUi.securityContext | nindent 12 }} @@ -93,6 +119,9 @@ spec: - name: studio-ca-certificates configMap: name: studio-ca-certificates + - name: nginx-sidecar + configMap: + name: {{ .Release.Name }}-nginx {{- with .Values.studioUi.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/studio/templates/service-ui.yaml b/charts/studio/templates/service-ui.yaml index b1dc17b4..f265c8d9 100644 --- a/charts/studio/templates/service-ui.yaml +++ b/charts/studio/templates/service-ui.yaml @@ -11,5 +11,9 @@ spec: targetPort: http protocol: TCP name: http + - port: 80 + targetPort: http + protocol: TCP + name: nginx-http selector: {{- include "studio-ui.selectorLabels" . | nindent 4 }}