diff options
Diffstat (limited to 'kubernetes/portal-ng')
7 files changed, 168 insertions, 0 deletions
diff --git a/kubernetes/portal-ng/components/portal-ng-ui/resources/assets/env.js b/kubernetes/portal-ng/components/portal-ng-ui/resources/assets/env.js new file mode 100644 index 0000000000..2e21ca50d0 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-ui/resources/assets/env.js @@ -0,0 +1,11 @@ +(function(window) { + window["env"] = window["env"] || {}; + window["env"]["keycloak"] = window["env"]["keycloak"] || {}; + + // Environment variables + window["env"]["customStyleEnabled"] = "{{ .Values.env.CUSTOM_STYLE_ENABLED }}"; + window["env"]["keycloak"]["hostname"] = "{{ .Values.env.KEYCLOAK_HOSTNAME }}"; + window["env"]["keycloak"]["realm"] = "{{ .Values.env.KEYCLOAK_REALM }}"; + window['env']['keycloak']['clientId'] = '{{ .Values.env.KEYCLOAK_CLIENT_ID }}'; + window["env"]["loggingEnabled"]= '{{ .Values.env.LOGGING_ENABLED }}'; +})(this); diff --git a/kubernetes/portal-ng/components/portal-ng-ui/resources/assets/version.json b/kubernetes/portal-ng/components/portal-ng-ui/resources/assets/version.json new file mode 100644 index 0000000000..4f56a1f070 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-ui/resources/assets/version.json @@ -0,0 +1,3 @@ +{ + "number": "{{ .Values.image.tag | default .Chart.AppVersion }}" +} diff --git a/kubernetes/portal-ng/components/portal-ng-ui/resources/default.conf b/kubernetes/portal-ng/components/portal-ng-ui/resources/default.conf new file mode 100644 index 0000000000..d448e278d5 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-ui/resources/default.conf @@ -0,0 +1,48 @@ +resolver {{ .Values.env.CLUSTER_NAMESERVER_IP }}; +server { + listen {{ .Values.env.NGINX_PORT }}; + location / { + root /usr/share/nginx/html; + index index.html; + try_files $uri $uri/ /index.html =404; + } + location /api/ { + set $upstream {{ .Values.env.BFF_URL }}; + rewrite /api/(.*) /$1 break; + add_header Access-Control-Allow-Origin *; + proxy_pass $upstream/$1$is_args$args; + proxy_set_header Host $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-Host $host; + proxy_set_header X-Forwarded-Server $host; + proxy_set_header X-Forwarded-Port $server_port; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_http_version 1.1; + } + location /auth/ { + set $upstream {{ .Values.env.KEYCLOAK_INTERNAL_URL }}; + rewrite /auth/(.*) /$1 break; + add_header Access-Control-Allow-Origin *; + proxy_pass $upstream/$1$is_args$args; + proxy_http_version 1.1; + proxy_set_header Host $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-Host $host; + proxy_set_header X-Forwarded-Server $host; + proxy_set_header X-Forwarded-Port $server_port; + proxy_set_header X-Forwarded-Proto $scheme; + } +} +## +# Gzip Settings +## +gzip on; +gzip_vary on; +gzip_proxied any; +gzip_min_length 1100; +gzip_comp_level 6; +gzip_buffers 16 8k; +gzip_http_version 1.1; +gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
\ No newline at end of file diff --git a/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-env-js.yaml b/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-env-js.yaml new file mode 100644 index 0000000000..e2244bd768 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-env-js.yaml @@ -0,0 +1,26 @@ +{{/* +# Copyright © 2024 Deutsche Telekom +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +*/}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-env-js + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} +data: +{{ tpl (.Files.Glob "resources/assets/env.js").AsConfig . | nindent 2 }} diff --git a/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-nginx-config.yaml b/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-nginx-config.yaml new file mode 100644 index 0000000000..f8e560b908 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-nginx-config.yaml @@ -0,0 +1,26 @@ +{{/* +# Copyright © 2024 Deutsche Telekom +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +*/}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-nginx-config + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} +data: +{{ tpl (.Files.Glob "resources/default.conf").AsConfig . | nindent 2 }} diff --git a/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-version-json.yaml b/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-version-json.yaml new file mode 100644 index 0000000000..79182a4e51 --- /dev/null +++ b/kubernetes/portal-ng/components/portal-ng-ui/templates/configmap-version-json.yaml @@ -0,0 +1,26 @@ +{{/* +# Copyright © 2024 Deutsche Telekom +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +*/}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-version-json + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ include "common.release" . }} + heritage: {{ .Release.Service }} +data: +{{ tpl (.Files.Glob "resources/assets/version.json").AsConfig . | nindent 2 }} diff --git a/kubernetes/portal-ng/components/portal-ng-ui/templates/deployment.yaml b/kubernetes/portal-ng/components/portal-ng-ui/templates/deployment.yaml index 6a16384346..4d467e0c88 100644 --- a/kubernetes/portal-ng/components/portal-ng-ui/templates/deployment.yaml +++ b/kubernetes/portal-ng/components/portal-ng-ui/templates/deployment.yaml @@ -53,6 +53,22 @@ spec: mountPath: {{ .Values.nginx.tilesPath }} subPath: tiles.json readOnly: true + - name: nginx-config + mountPath: /etc/nginx/conf.d/default.conf + subPath: default.conf + readOnly: true + - name: env-js + mountPath: /usr/share/nginx/html/assets/env.js + subPath: env.js + readOnly: true + - name: version-json + mountPath: /usr/share/nginx/html/assets/version.json + subPath: version.json + readOnly: true + - name: tmp-volume + mountPath: /tmp + - name: nginx-cache-volume + mountPath: /var/cache/nginx resources: {{ include "common.resources" . | nindent 12 }} {{- with .Values.nodeSelector }} nodeSelector: @@ -76,3 +92,15 @@ spec: items: - key: tiles.json path: tiles.json + - name: nginx-config + configMap: + name: {{ include "common.fullname" . }}-nginx-config + - name: env-js + configMap: + name: {{ include "common.fullname" . }}-env-js + - name: tmp-volume + emptyDir: + sizeLimit: 64Mi + - name: nginx-cache-volume + emptyDir: + sizeLimit: 64Mi |