Skip to content

Commit ba9f9e9

Browse files
[linstor-gui] Address review comments on #2382
- Dockerfile: chown html root to 101:101 (match runAsGroup, not 101:0) - Makefile: declare .PHONY targets (image, image-linstor-gui, test) - deployment: drop priorityClassName system-cluster-critical (GUI is not control-plane critical; chart does not need to reserve the slot) - configmap-nginx: - fail the render if linstor.endpoint is not https:// so a misconfig cannot silently downgrade the mTLS-protected controller path - hoist proxy_set_header and proxy_ssl_* directives to the server block instead of duplicating across /v1 and /metrics locations Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent ae88fe3 commit ba9f9e9

4 files changed

Lines changed: 20 additions & 23 deletions

File tree

‎packages/system/linstor-gui/Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ include ../../../hack/package.mk
66

77
LINSTOR_GUI_VERSION ?= 2.3.0
88

9+
.PHONY: image image-linstor-gui test
10+
911
image: image-linstor-gui
1012

1113
image-linstor-gui:

‎packages/system/linstor-gui/images/linstor-gui/Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ RUN apk add --no-cache curl tar && \
1212
tar -xzf /tmp/linstor-gui.tar.gz -C /usr/share/nginx/html --strip-components=2 "linstor-gui-${LINSTOR_GUI_VERSION}/dist" && \
1313
rm -f /tmp/linstor-gui.tar.gz && \
1414
apk del curl tar && \
15-
chown -R 101:0 /usr/share/nginx/html
15+
chown -R 101:101 /usr/share/nginx/html
1616

1717
USER 101
1818
EXPOSE 3373

‎packages/system/linstor-gui/templates/configmap-nginx.yaml‎

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{{/*
22
Parse the LINSTOR endpoint so nginx can set `proxy_ssl_name` correctly.
3-
The endpoint is expected to be an https:// URL like
4-
https://linstor-controller.cozy-linstor.svc:3371
3+
The endpoint must be an https:// URL — http:// would downgrade the
4+
mTLS-protected controller path.
55
*/}}
6-
{{- $endpoint := trimPrefix "https://" (trimPrefix "http://" .Values.linstor.endpoint) -}}
6+
{{- if not (hasPrefix "https://" .Values.linstor.endpoint) -}}
7+
{{- fail "linstor.endpoint must start with https:// to enforce mTLS to the LINSTOR controller" -}}
8+
{{- end -}}
9+
{{- $endpoint := trimPrefix "https://" .Values.linstor.endpoint -}}
710
{{- $endpointHost := (splitList ":" $endpoint) | first -}}
811
apiVersion: v1
912
kind: ConfigMap
@@ -41,6 +44,17 @@ data:
4144
root /usr/share/nginx/html;
4245
index index.html;
4346
47+
# Shared proxy + mTLS settings for the LINSTOR controller upstream
48+
proxy_set_header Host $host;
49+
proxy_set_header X-Real-IP $remote_addr;
50+
proxy_ssl_certificate /etc/linstor/client/tls.crt;
51+
proxy_ssl_certificate_key /etc/linstor/client/tls.key;
52+
proxy_ssl_trusted_certificate /etc/linstor/client/ca.crt;
53+
proxy_ssl_verify on;
54+
proxy_ssl_verify_depth 2;
55+
proxy_ssl_server_name on;
56+
proxy_ssl_name {{ $endpointHost }};
57+
4458
# Static UI assets
4559
location / {
4660
try_files $uri $uri/ /index.html;
@@ -49,28 +63,10 @@ data:
4963
# Proxy LINSTOR REST API over mTLS to the controller
5064
location /v1 {
5165
proxy_pass {{ .Values.linstor.endpoint }};
52-
proxy_set_header Host $host;
53-
proxy_set_header X-Real-IP $remote_addr;
54-
proxy_ssl_certificate /etc/linstor/client/tls.crt;
55-
proxy_ssl_certificate_key /etc/linstor/client/tls.key;
56-
proxy_ssl_trusted_certificate /etc/linstor/client/ca.crt;
57-
proxy_ssl_verify on;
58-
proxy_ssl_verify_depth 2;
59-
proxy_ssl_server_name on;
60-
proxy_ssl_name {{ $endpointHost }};
6166
}
6267
6368
location /metrics {
6469
proxy_pass {{ .Values.linstor.endpoint }};
65-
proxy_set_header Host $host;
66-
proxy_set_header X-Real-IP $remote_addr;
67-
proxy_ssl_certificate /etc/linstor/client/tls.crt;
68-
proxy_ssl_certificate_key /etc/linstor/client/tls.key;
69-
proxy_ssl_trusted_certificate /etc/linstor/client/ca.crt;
70-
proxy_ssl_verify on;
71-
proxy_ssl_verify_depth 2;
72-
proxy_ssl_server_name on;
73-
proxy_ssl_name {{ $endpointHost }};
7470
}
7571
7672
location = /healthz {

‎packages/system/linstor-gui/templates/deployment.yaml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ spec:
2525
spec:
2626
serviceAccountName: linstor-gui
2727
automountServiceAccountToken: false
28-
priorityClassName: system-cluster-critical
2928
securityContext:
3029
runAsNonRoot: true
3130
seccompProfile:

0 commit comments

Comments
 (0)