From 33372d62f56d284f215d5a1d7f5465e6aa48d2aa Mon Sep 17 00:00:00 2001 From: Ishaan Mittal Date: Fri, 27 Dec 2024 00:50:15 +0530 Subject: [PATCH 01/10] mount nginx.conf as a volume to the frontend container Signed-off-by: Ishaan Mittal --- .../templates/configmap-frontend.yaml | 98 +++++++++++++++++++ charts/opencost/templates/deployment.yaml | 15 ++- charts/opencost/values.yaml | 6 ++ 3 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 charts/opencost/templates/configmap-frontend.yaml diff --git a/charts/opencost/templates/configmap-frontend.yaml b/charts/opencost/templates/configmap-frontend.yaml new file mode 100644 index 0000000..db28704 --- /dev/null +++ b/charts/opencost/templates/configmap-frontend.yaml @@ -0,0 +1,98 @@ +{{- if .Values.opencost.ui.enabled }} +{{- $serviceName := include "opencost.fullname" . -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: nginx-conf + namespace: {{ .Release.Namespace }} +data: + nginx.conf: | +gzip_static on; +gzip on; +gzip_min_length 50000; +gzip_proxied expired no-cache no-store private auth; +gzip_types + application/atom+xml + application/geo+json + application/javascript + application/x-javascript + application/json + application/ld+json + application/manifest+json + application/rdf+xml + application/rss+xml + application/vnd.ms-fontobject + application/wasm + application/x-web-app-manifest+json + application/xhtml+xml + application/xml + font/eot + font/otf + font/ttf + image/bmp + image/svg+xml + text/cache-manifest + text/calendar + text/css + text/javascript + text/markdown + text/plain + text/xml + text/x-component + text/x-cross-domain-policy; + +upstream model { + # Update to the cost model endpoint + # Example: host.docker.internal:9003; + server ${API_SERVER}:${API_PORT}; +} +upstream model { +{{- if .Values.opencost.ui.useDefaultFqdn }} + server {{ $serviceName }}.{{ .Release.Namespace }}.svc.cluster.local:9003; +{{- else if .Values.opencost.ui.modelFqdn }} + server {{ .Values.opencost.ui.modelFqdn }}; +{{- else }} + server {{ $serviceName }}.{{ .Release.Namespace }}:9003; +{{- end }} +} + +server { + server_name _; + root /var/www; + index index.html; + large_client_header_buffers 4 32k; + add_header Cache-Control "must-revalidate"; + + error_page 504 /custom_504.html; + location = /custom_504.html { + internal; + } + + add_header Cache-Control "max-age=300"; + location / { + root /var/www; + index index.html index.htm; + try_files $uri /index.html; + } + + add_header ETag "1.96.0"; + listen {{ .Values.opencost.ui.uiPort }}; + listen [::]:{{ .Values.opencost.ui.uiPort }}; + resolver 127.0.0.1 valid=5s; + location /healthz { + access_log /dev/null; + return 200 'OK'; + } + location /model/ { + proxy_connect_timeout 180; + proxy_send_timeout 180; + proxy_read_timeout 180; + proxy_pass http://model/; + proxy_redirect off; + proxy_http_version 1.1; + proxy_set_header Connection ""; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } +} +{{- end }} diff --git a/charts/opencost/templates/deployment.yaml b/charts/opencost/templates/deployment.yaml index efa828e..6b46e3b 100644 --- a/charts/opencost/templates/deployment.yaml +++ b/charts/opencost/templates/deployment.yaml @@ -312,8 +312,13 @@ spec: {{- with .Values.opencost.ui.securityContext }} securityContext: {{- toYaml . | nindent 12 }} {{- end }} + volumeMounts: {{- with .Values.opencost.ui.extraVolumeMounts }} - volumeMounts: {{- toYaml . | nindent 12 }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- if .Values.opencost.ui.enabled }} + - name: nginx-conf + mountPath: /etc/nginx/conf.d/ {{- end }} {{- end }} {{- with .Values.opencost.extraContainers }} @@ -389,6 +394,14 @@ spec: - key: cloud-integration.json path: cloud-integration.json {{- end }} + {{- if .Values.opencost.ui.enabled }} + - name: nginx-conf + configMap: + name: nginx-conf + items: + - key: nginx.conf + path: default.nginx.conf + {{- end }} {{- with .Values.extraVolumes }} {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/opencost/values.yaml b/charts/opencost/values.yaml index 920395b..c39e3be 100644 --- a/charts/opencost/values.yaml +++ b/charts/opencost/values.yaml @@ -442,6 +442,12 @@ opencost: # -- A list of volume mounts to be added to the pod extraVolumeMounts: [] + # set to true to set upstream to use ..svc.cluster.local instead of just . + useDefaultFqdn: false + + # Set the model fqdn to use for the upstream + # modelFqdn: opencost.opencost.svc.cluster.local:9003 + ingress: # -- Ingress for OpenCost UI enabled: false From 9ec4ddfb782f3d86448cb17bb932149e6a2188ba Mon Sep 17 00:00:00 2001 From: Ishaan Mittal Date: Fri, 27 Dec 2024 00:53:07 +0530 Subject: [PATCH 02/10] lint Signed-off-by: Ishaan Mittal --- .../templates/configmap-frontend.yaml | 164 +++++++++--------- charts/opencost/values.yaml | 2 +- 2 files changed, 83 insertions(+), 83 deletions(-) diff --git a/charts/opencost/templates/configmap-frontend.yaml b/charts/opencost/templates/configmap-frontend.yaml index db28704..1c41134 100644 --- a/charts/opencost/templates/configmap-frontend.yaml +++ b/charts/opencost/templates/configmap-frontend.yaml @@ -7,92 +7,92 @@ metadata: namespace: {{ .Release.Namespace }} data: nginx.conf: | -gzip_static on; -gzip on; -gzip_min_length 50000; -gzip_proxied expired no-cache no-store private auth; -gzip_types - application/atom+xml - application/geo+json - application/javascript - application/x-javascript - application/json - application/ld+json - application/manifest+json - application/rdf+xml - application/rss+xml - application/vnd.ms-fontobject - application/wasm - application/x-web-app-manifest+json - application/xhtml+xml - application/xml - font/eot - font/otf - font/ttf - image/bmp - image/svg+xml - text/cache-manifest - text/calendar - text/css - text/javascript - text/markdown - text/plain - text/xml - text/x-component - text/x-cross-domain-policy; + gzip_static on; + gzip on; + gzip_min_length 50000; + gzip_proxied expired no-cache no-store private auth; + gzip_types + application/atom+xml + application/geo+json + application/javascript + application/x-javascript + application/json + application/ld+json + application/manifest+json + application/rdf+xml + application/rss+xml + application/vnd.ms-fontobject + application/wasm + application/x-web-app-manifest+json + application/xhtml+xml + application/xml + font/eot + font/otf + font/ttf + image/bmp + image/svg+xml + text/cache-manifest + text/calendar + text/css + text/javascript + text/markdown + text/plain + text/xml + text/x-component + text/x-cross-domain-policy; -upstream model { - # Update to the cost model endpoint - # Example: host.docker.internal:9003; - server ${API_SERVER}:${API_PORT}; -} -upstream model { -{{- if .Values.opencost.ui.useDefaultFqdn }} - server {{ $serviceName }}.{{ .Release.Namespace }}.svc.cluster.local:9003; -{{- else if .Values.opencost.ui.modelFqdn }} - server {{ .Values.opencost.ui.modelFqdn }}; -{{- else }} - server {{ $serviceName }}.{{ .Release.Namespace }}:9003; -{{- end }} -} - -server { - server_name _; - root /var/www; - index index.html; - large_client_header_buffers 4 32k; - add_header Cache-Control "must-revalidate"; - - error_page 504 /custom_504.html; - location = /custom_504.html { - internal; + upstream model { + # Update to the cost model endpoint + # Example: host.docker.internal:9003; + server ${API_SERVER}:${API_PORT}; + } + upstream model { + {{- if .Values.opencost.ui.useDefaultFqdn }} + server {{ $serviceName }}.{{ .Release.Namespace }}.svc.cluster.local:9003; + {{- else if .Values.opencost.ui.modelFqdn }} + server {{ .Values.opencost.ui.modelFqdn }}; + {{- else }} + server {{ $serviceName }}.{{ .Release.Namespace }}:9003; + {{- end }} } - add_header Cache-Control "max-age=300"; - location / { + server { + server_name _; root /var/www; - index index.html index.htm; - try_files $uri /index.html; - } + index index.html; + large_client_header_buffers 4 32k; + add_header Cache-Control "must-revalidate"; - add_header ETag "1.96.0"; - listen {{ .Values.opencost.ui.uiPort }}; - listen [::]:{{ .Values.opencost.ui.uiPort }}; - resolver 127.0.0.1 valid=5s; - location /healthz { - access_log /dev/null; - return 200 'OK'; - } - location /model/ { - proxy_connect_timeout 180; - proxy_send_timeout 180; - proxy_read_timeout 180; - proxy_pass http://model/; - proxy_redirect off; - proxy_http_version 1.1; - proxy_set_header Connection ""; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + error_page 504 /custom_504.html; + location = /custom_504.html { + internal; + } + + add_header Cache-Control "max-age=300"; + location / { + root /var/www; + index index.html index.htm; + try_files $uri /index.html; + } + + add_header ETag "1.96.0"; + listen {{ .Values.opencost.ui.uiPort }}; + listen [::]:{{ .Values.opencost.ui.uiPort }}; + resolver 127.0.0.1 valid=5s; + location /healthz { + access_log /dev/null; + return 200 'OK'; + } + location /model/ { + proxy_connect_timeout 180; + proxy_send_timeout 180; + proxy_read_timeout 180; + proxy_pass http://model/; + proxy_redirect off; + proxy_http_version 1.1; + proxy_set_header Connection ""; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } } -} {{- end }} diff --git a/charts/opencost/values.yaml b/charts/opencost/values.yaml index c39e3be..a803ef5 100644 --- a/charts/opencost/values.yaml +++ b/charts/opencost/values.yaml @@ -447,7 +447,7 @@ opencost: # Set the model fqdn to use for the upstream # modelFqdn: opencost.opencost.svc.cluster.local:9003 - + ingress: # -- Ingress for OpenCost UI enabled: false From c31dcbb2bcaa7fbb349ae93ee217fe06716d4374 Mon Sep 17 00:00:00 2001 From: Ishaan Mittal Date: Fri, 27 Dec 2024 02:11:02 +0530 Subject: [PATCH 03/10] chart bump --- charts/opencost/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/opencost/Chart.yaml b/charts/opencost/Chart.yaml index 2b5e2cd..24d4ac6 100755 --- a/charts/opencost/Chart.yaml +++ b/charts/opencost/Chart.yaml @@ -9,7 +9,7 @@ keywords: - finops - monitoring - opencost -version: 1.43.0 +version: 1.43.1 maintainers: - name: mattray url: https://mattray.dev From 1c6a569af394c5dc96ba95e41607c4b0b84164e2 Mon Sep 17 00:00:00 2001 From: Ishaan Mittal Date: Fri, 27 Dec 2024 02:41:49 +0530 Subject: [PATCH 04/10] correct after testing --- charts/opencost/templates/configmap-frontend.yaml | 5 ----- charts/opencost/templates/deployment.yaml | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/charts/opencost/templates/configmap-frontend.yaml b/charts/opencost/templates/configmap-frontend.yaml index 1c41134..242372d 100644 --- a/charts/opencost/templates/configmap-frontend.yaml +++ b/charts/opencost/templates/configmap-frontend.yaml @@ -41,11 +41,6 @@ data: text/x-component text/x-cross-domain-policy; - upstream model { - # Update to the cost model endpoint - # Example: host.docker.internal:9003; - server ${API_SERVER}:${API_PORT}; - } upstream model { {{- if .Values.opencost.ui.useDefaultFqdn }} server {{ $serviceName }}.{{ .Release.Namespace }}.svc.cluster.local:9003; diff --git a/charts/opencost/templates/deployment.yaml b/charts/opencost/templates/deployment.yaml index 6b46e3b..87b1e54 100644 --- a/charts/opencost/templates/deployment.yaml +++ b/charts/opencost/templates/deployment.yaml @@ -357,7 +357,7 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} {{- end }} - {{- if or .Values.plugins.enabled .Values.opencost.exporter.persistence.enabled .Values.extraVolumes .Values.opencost.customPricing.enabled .Values.opencost.cloudIntegrationSecret}} + {{- if or .Values.plugins.enabled .Values.opencost.exporter.persistence.enabled .Values.extraVolumes .Values.opencost.customPricing.enabled .Values.opencost.cloudIntegrationSecret .Values.opencost.ui.enabled }} volumes: {{- if .Values.plugins.enabled }} {{- if .Values.plugins.install.enabled}} From 0e24ebf0eed5191c1f69079fe87e3b2ddd3dad6c Mon Sep 17 00:00:00 2001 From: Ishaan Mittal Date: Fri, 27 Dec 2024 03:42:01 +0530 Subject: [PATCH 05/10] add to a subpath instead of overwriting the compelete directory --- charts/opencost/templates/deployment.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/charts/opencost/templates/deployment.yaml b/charts/opencost/templates/deployment.yaml index 87b1e54..c6e0967 100644 --- a/charts/opencost/templates/deployment.yaml +++ b/charts/opencost/templates/deployment.yaml @@ -318,7 +318,8 @@ spec: {{- end }} {{- if .Values.opencost.ui.enabled }} - name: nginx-conf - mountPath: /etc/nginx/conf.d/ + mountPath: /etc/nginx/conf.d/default.nginx.conf + subPath: default.nginx.conf {{- end }} {{- end }} {{- with .Values.opencost.extraContainers }} From 6e15561fe11b0274ea2b66e64c427428ad7dbef5 Mon Sep 17 00:00:00 2001 From: Ishaan Mittal Date: Fri, 27 Dec 2024 00:50:15 +0530 Subject: [PATCH 06/10] mount nginx.conf as a volume to the frontend container Signed-off-by: Ishaan Mittal --- .../templates/configmap-frontend.yaml | 98 +++++++++++++++++++ charts/opencost/templates/deployment.yaml | 15 ++- charts/opencost/values.yaml | 6 ++ 3 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 charts/opencost/templates/configmap-frontend.yaml diff --git a/charts/opencost/templates/configmap-frontend.yaml b/charts/opencost/templates/configmap-frontend.yaml new file mode 100644 index 0000000..db28704 --- /dev/null +++ b/charts/opencost/templates/configmap-frontend.yaml @@ -0,0 +1,98 @@ +{{- if .Values.opencost.ui.enabled }} +{{- $serviceName := include "opencost.fullname" . -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: nginx-conf + namespace: {{ .Release.Namespace }} +data: + nginx.conf: | +gzip_static on; +gzip on; +gzip_min_length 50000; +gzip_proxied expired no-cache no-store private auth; +gzip_types + application/atom+xml + application/geo+json + application/javascript + application/x-javascript + application/json + application/ld+json + application/manifest+json + application/rdf+xml + application/rss+xml + application/vnd.ms-fontobject + application/wasm + application/x-web-app-manifest+json + application/xhtml+xml + application/xml + font/eot + font/otf + font/ttf + image/bmp + image/svg+xml + text/cache-manifest + text/calendar + text/css + text/javascript + text/markdown + text/plain + text/xml + text/x-component + text/x-cross-domain-policy; + +upstream model { + # Update to the cost model endpoint + # Example: host.docker.internal:9003; + server ${API_SERVER}:${API_PORT}; +} +upstream model { +{{- if .Values.opencost.ui.useDefaultFqdn }} + server {{ $serviceName }}.{{ .Release.Namespace }}.svc.cluster.local:9003; +{{- else if .Values.opencost.ui.modelFqdn }} + server {{ .Values.opencost.ui.modelFqdn }}; +{{- else }} + server {{ $serviceName }}.{{ .Release.Namespace }}:9003; +{{- end }} +} + +server { + server_name _; + root /var/www; + index index.html; + large_client_header_buffers 4 32k; + add_header Cache-Control "must-revalidate"; + + error_page 504 /custom_504.html; + location = /custom_504.html { + internal; + } + + add_header Cache-Control "max-age=300"; + location / { + root /var/www; + index index.html index.htm; + try_files $uri /index.html; + } + + add_header ETag "1.96.0"; + listen {{ .Values.opencost.ui.uiPort }}; + listen [::]:{{ .Values.opencost.ui.uiPort }}; + resolver 127.0.0.1 valid=5s; + location /healthz { + access_log /dev/null; + return 200 'OK'; + } + location /model/ { + proxy_connect_timeout 180; + proxy_send_timeout 180; + proxy_read_timeout 180; + proxy_pass http://model/; + proxy_redirect off; + proxy_http_version 1.1; + proxy_set_header Connection ""; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } +} +{{- end }} diff --git a/charts/opencost/templates/deployment.yaml b/charts/opencost/templates/deployment.yaml index efa828e..6b46e3b 100644 --- a/charts/opencost/templates/deployment.yaml +++ b/charts/opencost/templates/deployment.yaml @@ -312,8 +312,13 @@ spec: {{- with .Values.opencost.ui.securityContext }} securityContext: {{- toYaml . | nindent 12 }} {{- end }} + volumeMounts: {{- with .Values.opencost.ui.extraVolumeMounts }} - volumeMounts: {{- toYaml . | nindent 12 }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- if .Values.opencost.ui.enabled }} + - name: nginx-conf + mountPath: /etc/nginx/conf.d/ {{- end }} {{- end }} {{- with .Values.opencost.extraContainers }} @@ -389,6 +394,14 @@ spec: - key: cloud-integration.json path: cloud-integration.json {{- end }} + {{- if .Values.opencost.ui.enabled }} + - name: nginx-conf + configMap: + name: nginx-conf + items: + - key: nginx.conf + path: default.nginx.conf + {{- end }} {{- with .Values.extraVolumes }} {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/opencost/values.yaml b/charts/opencost/values.yaml index 920395b..c39e3be 100644 --- a/charts/opencost/values.yaml +++ b/charts/opencost/values.yaml @@ -442,6 +442,12 @@ opencost: # -- A list of volume mounts to be added to the pod extraVolumeMounts: [] + # set to true to set upstream to use ..svc.cluster.local instead of just . + useDefaultFqdn: false + + # Set the model fqdn to use for the upstream + # modelFqdn: opencost.opencost.svc.cluster.local:9003 + ingress: # -- Ingress for OpenCost UI enabled: false From 8d2de9c599078cc87e71e71f7089284003cf3775 Mon Sep 17 00:00:00 2001 From: Ishaan Mittal Date: Fri, 27 Dec 2024 00:53:07 +0530 Subject: [PATCH 07/10] lint Signed-off-by: Ishaan Mittal --- .../templates/configmap-frontend.yaml | 164 +++++++++--------- charts/opencost/values.yaml | 2 +- 2 files changed, 83 insertions(+), 83 deletions(-) diff --git a/charts/opencost/templates/configmap-frontend.yaml b/charts/opencost/templates/configmap-frontend.yaml index db28704..1c41134 100644 --- a/charts/opencost/templates/configmap-frontend.yaml +++ b/charts/opencost/templates/configmap-frontend.yaml @@ -7,92 +7,92 @@ metadata: namespace: {{ .Release.Namespace }} data: nginx.conf: | -gzip_static on; -gzip on; -gzip_min_length 50000; -gzip_proxied expired no-cache no-store private auth; -gzip_types - application/atom+xml - application/geo+json - application/javascript - application/x-javascript - application/json - application/ld+json - application/manifest+json - application/rdf+xml - application/rss+xml - application/vnd.ms-fontobject - application/wasm - application/x-web-app-manifest+json - application/xhtml+xml - application/xml - font/eot - font/otf - font/ttf - image/bmp - image/svg+xml - text/cache-manifest - text/calendar - text/css - text/javascript - text/markdown - text/plain - text/xml - text/x-component - text/x-cross-domain-policy; + gzip_static on; + gzip on; + gzip_min_length 50000; + gzip_proxied expired no-cache no-store private auth; + gzip_types + application/atom+xml + application/geo+json + application/javascript + application/x-javascript + application/json + application/ld+json + application/manifest+json + application/rdf+xml + application/rss+xml + application/vnd.ms-fontobject + application/wasm + application/x-web-app-manifest+json + application/xhtml+xml + application/xml + font/eot + font/otf + font/ttf + image/bmp + image/svg+xml + text/cache-manifest + text/calendar + text/css + text/javascript + text/markdown + text/plain + text/xml + text/x-component + text/x-cross-domain-policy; -upstream model { - # Update to the cost model endpoint - # Example: host.docker.internal:9003; - server ${API_SERVER}:${API_PORT}; -} -upstream model { -{{- if .Values.opencost.ui.useDefaultFqdn }} - server {{ $serviceName }}.{{ .Release.Namespace }}.svc.cluster.local:9003; -{{- else if .Values.opencost.ui.modelFqdn }} - server {{ .Values.opencost.ui.modelFqdn }}; -{{- else }} - server {{ $serviceName }}.{{ .Release.Namespace }}:9003; -{{- end }} -} - -server { - server_name _; - root /var/www; - index index.html; - large_client_header_buffers 4 32k; - add_header Cache-Control "must-revalidate"; - - error_page 504 /custom_504.html; - location = /custom_504.html { - internal; + upstream model { + # Update to the cost model endpoint + # Example: host.docker.internal:9003; + server ${API_SERVER}:${API_PORT}; + } + upstream model { + {{- if .Values.opencost.ui.useDefaultFqdn }} + server {{ $serviceName }}.{{ .Release.Namespace }}.svc.cluster.local:9003; + {{- else if .Values.opencost.ui.modelFqdn }} + server {{ .Values.opencost.ui.modelFqdn }}; + {{- else }} + server {{ $serviceName }}.{{ .Release.Namespace }}:9003; + {{- end }} } - add_header Cache-Control "max-age=300"; - location / { + server { + server_name _; root /var/www; - index index.html index.htm; - try_files $uri /index.html; - } + index index.html; + large_client_header_buffers 4 32k; + add_header Cache-Control "must-revalidate"; - add_header ETag "1.96.0"; - listen {{ .Values.opencost.ui.uiPort }}; - listen [::]:{{ .Values.opencost.ui.uiPort }}; - resolver 127.0.0.1 valid=5s; - location /healthz { - access_log /dev/null; - return 200 'OK'; - } - location /model/ { - proxy_connect_timeout 180; - proxy_send_timeout 180; - proxy_read_timeout 180; - proxy_pass http://model/; - proxy_redirect off; - proxy_http_version 1.1; - proxy_set_header Connection ""; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + error_page 504 /custom_504.html; + location = /custom_504.html { + internal; + } + + add_header Cache-Control "max-age=300"; + location / { + root /var/www; + index index.html index.htm; + try_files $uri /index.html; + } + + add_header ETag "1.96.0"; + listen {{ .Values.opencost.ui.uiPort }}; + listen [::]:{{ .Values.opencost.ui.uiPort }}; + resolver 127.0.0.1 valid=5s; + location /healthz { + access_log /dev/null; + return 200 'OK'; + } + location /model/ { + proxy_connect_timeout 180; + proxy_send_timeout 180; + proxy_read_timeout 180; + proxy_pass http://model/; + proxy_redirect off; + proxy_http_version 1.1; + proxy_set_header Connection ""; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } } -} {{- end }} diff --git a/charts/opencost/values.yaml b/charts/opencost/values.yaml index c39e3be..a803ef5 100644 --- a/charts/opencost/values.yaml +++ b/charts/opencost/values.yaml @@ -447,7 +447,7 @@ opencost: # Set the model fqdn to use for the upstream # modelFqdn: opencost.opencost.svc.cluster.local:9003 - + ingress: # -- Ingress for OpenCost UI enabled: false From 69cb03e72b73781345bfb195789c030fb6672de7 Mon Sep 17 00:00:00 2001 From: Ishaan Mittal Date: Fri, 27 Dec 2024 02:41:49 +0530 Subject: [PATCH 08/10] correct after testing --- charts/opencost/templates/configmap-frontend.yaml | 5 ----- charts/opencost/templates/deployment.yaml | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/charts/opencost/templates/configmap-frontend.yaml b/charts/opencost/templates/configmap-frontend.yaml index 1c41134..242372d 100644 --- a/charts/opencost/templates/configmap-frontend.yaml +++ b/charts/opencost/templates/configmap-frontend.yaml @@ -41,11 +41,6 @@ data: text/x-component text/x-cross-domain-policy; - upstream model { - # Update to the cost model endpoint - # Example: host.docker.internal:9003; - server ${API_SERVER}:${API_PORT}; - } upstream model { {{- if .Values.opencost.ui.useDefaultFqdn }} server {{ $serviceName }}.{{ .Release.Namespace }}.svc.cluster.local:9003; diff --git a/charts/opencost/templates/deployment.yaml b/charts/opencost/templates/deployment.yaml index 6b46e3b..87b1e54 100644 --- a/charts/opencost/templates/deployment.yaml +++ b/charts/opencost/templates/deployment.yaml @@ -357,7 +357,7 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} {{- end }} - {{- if or .Values.plugins.enabled .Values.opencost.exporter.persistence.enabled .Values.extraVolumes .Values.opencost.customPricing.enabled .Values.opencost.cloudIntegrationSecret}} + {{- if or .Values.plugins.enabled .Values.opencost.exporter.persistence.enabled .Values.extraVolumes .Values.opencost.customPricing.enabled .Values.opencost.cloudIntegrationSecret .Values.opencost.ui.enabled }} volumes: {{- if .Values.plugins.enabled }} {{- if .Values.plugins.install.enabled}} From 6f7d4aabd664f9a513333940f2508d0beadc7adf Mon Sep 17 00:00:00 2001 From: Ishaan Mittal Date: Fri, 27 Dec 2024 03:42:01 +0530 Subject: [PATCH 09/10] add to a subpath instead of overwriting the compelete directory --- charts/opencost/templates/deployment.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/charts/opencost/templates/deployment.yaml b/charts/opencost/templates/deployment.yaml index 87b1e54..c6e0967 100644 --- a/charts/opencost/templates/deployment.yaml +++ b/charts/opencost/templates/deployment.yaml @@ -318,7 +318,8 @@ spec: {{- end }} {{- if .Values.opencost.ui.enabled }} - name: nginx-conf - mountPath: /etc/nginx/conf.d/ + mountPath: /etc/nginx/conf.d/default.nginx.conf + subPath: default.nginx.conf {{- end }} {{- end }} {{- with .Values.opencost.extraContainers }} From 3d6d10f8dc8d7f7899e9c3cb9c27559a92754e47 Mon Sep 17 00:00:00 2001 From: Ishaan Mittal Date: Mon, 20 Jan 2025 23:12:45 +0530 Subject: [PATCH 10/10] naming configmap --- charts/opencost/templates/configmap-frontend.yaml | 2 +- charts/opencost/templates/deployment.yaml | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/charts/opencost/templates/configmap-frontend.yaml b/charts/opencost/templates/configmap-frontend.yaml index 242372d..60c939f 100644 --- a/charts/opencost/templates/configmap-frontend.yaml +++ b/charts/opencost/templates/configmap-frontend.yaml @@ -3,7 +3,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: nginx-conf + name: opencost-ui-nginx-conf namespace: {{ .Release.Namespace }} data: nginx.conf: | diff --git a/charts/opencost/templates/deployment.yaml b/charts/opencost/templates/deployment.yaml index c6e0967..b5a8aaf 100644 --- a/charts/opencost/templates/deployment.yaml +++ b/charts/opencost/templates/deployment.yaml @@ -316,11 +316,9 @@ spec: {{- with .Values.opencost.ui.extraVolumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} - {{- if .Values.opencost.ui.enabled }} - name: nginx-conf mountPath: /etc/nginx/conf.d/default.nginx.conf subPath: default.nginx.conf - {{- end }} {{- end }} {{- with .Values.opencost.extraContainers }} {{- toYaml . | nindent 8 }}