blob: a0c2c47d7e6231c3c60d96b9e6e00790fc0f0a37 [file] [log] [blame]
gio16bb6382025-05-21 18:42:40 +04001{{- if .Values.openshift.enabled }}
2{{- if .Values.openshift.ui.route }}
3# https://github.com/openshift/oauth-proxy/blob/master/contrib/sidecar.yaml
4# Create a proxy service account and ensure it will use the route "proxy"
5# Create a secure connection to the proxy via a route
6apiVersion: route.openshift.io/v1
7kind: Route
8metadata:
9 labels: {{- include "longhorn.labels" . | nindent 4 }}
10 app: longhorn-ui
11 name: {{ .Values.openshift.ui.route }}
12 namespace: {{ include "release_namespace" . }}
13spec:
14 to:
15 kind: Service
16 name: longhorn-ui
17 tls:
18 termination: reencrypt
19---
20apiVersion: v1
21kind: Service
22metadata:
23 labels: {{- include "longhorn.labels" . | nindent 4 }}
24 app: longhorn-ui
25 name: longhorn-ui
26 namespace: {{ include "release_namespace" . }}
27 annotations:
28 service.alpha.openshift.io/serving-cert-secret-name: longhorn-ui-tls
29spec:
30 ports:
31 - name: longhorn-ui
32 port: {{ .Values.openshift.ui.port | default 443 }}
33 targetPort: {{ .Values.openshift.ui.proxy | default 8443 }}
34 selector:
35 app: longhorn-ui
36---
37{{- end }}
38{{- end }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040039apiVersion: apps/v1
40kind: Deployment
41metadata:
42 labels: {{- include "longhorn.labels" . | nindent 4 }}
43 app: longhorn-ui
44 name: longhorn-ui
45 namespace: {{ include "release_namespace" . }}
46spec:
47 replicas: {{ .Values.longhornUI.replicas }}
48 selector:
49 matchLabels:
50 app: longhorn-ui
51 template:
52 metadata:
53 labels: {{- include "longhorn.labels" . | nindent 8 }}
54 app: longhorn-ui
55 spec:
gio16bb6382025-05-21 18:42:40 +040056 serviceAccountName: longhorn-ui-service-account
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040057 affinity:
giodbf4a852025-06-30 17:09:46 +040058 {{- toYaml .Values.longhornUI.affinity | nindent 8 }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040059 containers:
gio16bb6382025-05-21 18:42:40 +040060 {{- if .Values.openshift.enabled }}
61 {{- if .Values.openshift.ui.route }}
62 - name: oauth-proxy
63 {{- if .Values.image.openshift.oauthProxy.repository }}
gio3e1b96b2026-07-21 18:52:35 +040064 image: {{ with (coalesce .Values.image.openshift.oauthProxy.registry .Values.global.imageRegistry (include "registry_url" .)) }}{{ . }}/{{ end }}{{ .Values.image.openshift.oauthProxy.repository }}:{{ .Values.image.openshift.oauthProxy.tag }}
gio16bb6382025-05-21 18:42:40 +040065 {{- else }}
66 image: ""
67 {{- end }}
68 imagePullPolicy: IfNotPresent
69 ports:
70 - containerPort: {{ .Values.openshift.ui.proxy | default 8443 }}
71 name: public
72 args:
73 - --https-address=:{{ .Values.openshift.ui.proxy | default 8443 }}
74 - --provider=openshift
75 - --openshift-service-account=longhorn-ui-service-account
76 - --upstream=http://localhost:8000
77 - --tls-cert=/etc/tls/private/tls.crt
78 - --tls-key=/etc/tls/private/tls.key
79 - --cookie-secret=SECRET
80 - --openshift-sar={"namespace":"{{ include "release_namespace" . }}","group":"longhorn.io","resource":"setting","verb":"delete"}
81 volumeMounts:
82 - mountPath: /etc/tls/private
83 name: longhorn-ui-tls
84 {{- end }}
85 {{- end }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040086 - name: longhorn-ui
gio3e1b96b2026-07-21 18:52:35 +040087 image: {{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.longhorn.ui.registry) }}{{ . }}/{{ end }}{{ .Values.image.longhorn.ui.repository }}:{{ .Values.image.longhorn.ui.tag }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040088 imagePullPolicy: {{ .Values.image.pullPolicy }}
89 volumeMounts:
giodbf4a852025-06-30 17:09:46 +040090 - name: nginx-cache
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040091 mountPath: /var/cache/nginx/
giodbf4a852025-06-30 17:09:46 +040092 - name: nginx-config
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040093 mountPath: /var/config/nginx/
94 - name: var-run
95 mountPath: /var/run/
96 ports:
97 - containerPort: 8000
98 name: http
99 env:
100 - name: LONGHORN_MANAGER_IP
101 value: "http://longhorn-backend:9500"
102 - name: LONGHORN_UI_PORT
103 value: "8000"
gio3e1b96b2026-07-21 18:52:35 +0400104 {{- include "longhorn.timezoneEnv" . | nindent 10 }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400105 volumes:
gio16bb6382025-05-21 18:42:40 +0400106 {{- if .Values.openshift.enabled }}
107 {{- if .Values.openshift.ui.route }}
108 - name: longhorn-ui-tls
109 secret:
110 secretName: longhorn-ui-tls
111 {{- end }}
112 {{- end }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400113 - emptyDir: {}
114 name: nginx-cache
115 - emptyDir: {}
116 name: nginx-config
117 - emptyDir: {}
118 name: var-run
gio3e1b96b2026-07-21 18:52:35 +0400119 {{- with (coalesce .Values.global.imagePullSecrets .Values.privateRegistry.registrySecret) }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400120 imagePullSecrets:
gio3e1b96b2026-07-21 18:52:35 +0400121 {{- $imagePullSecrets := list }}
122 {{- if kindIs "string" . }}
123 {{- $imagePullSecrets = append $imagePullSecrets (dict "name" .) }}
124 {{- else }}
125 {{- range . }}
126 {{- if kindIs "string" . }}
127 {{- $imagePullSecrets = append $imagePullSecrets (dict "name" .) }}
128 {{- else }}
129 {{- $imagePullSecrets = append $imagePullSecrets . }}
130 {{- end }}
131 {{- end }}
132 {{- end }}
133 {{- toYaml $imagePullSecrets | nindent 8 }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400134 {{- end }}
135 {{- if .Values.longhornUI.priorityClass }}
136 priorityClassName: {{ .Values.longhornUI.priorityClass | quote }}
137 {{- end }}
gio16bb6382025-05-21 18:42:40 +0400138 {{- if or .Values.global.tolerations .Values.longhornUI.tolerations .Values.global.cattle.windowsCluster.enabled }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400139 tolerations:
140 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.tolerations }}
141{{ toYaml .Values.global.cattle.windowsCluster.tolerations | indent 6 }}
142 {{- end }}
gio16bb6382025-05-21 18:42:40 +0400143 {{- if or .Values.global.tolerations .Values.longhornUI.tolerations }}
144{{ default .Values.global.tolerations .Values.longhornUI.tolerations | toYaml | indent 6 }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400145 {{- end }}
146 {{- end }}
gio16bb6382025-05-21 18:42:40 +0400147 {{- if or .Values.global.nodeSelector .Values.longhornUI.nodeSelector .Values.global.cattle.windowsCluster.enabled }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400148 nodeSelector:
149 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.nodeSelector }}
150{{ toYaml .Values.global.cattle.windowsCluster.nodeSelector | indent 8 }}
151 {{- end }}
gio16bb6382025-05-21 18:42:40 +0400152 {{- if or .Values.global.nodeSelector .Values.longhornUI.nodeSelector }}
153{{ default .Values.global.nodeSelector .Values.longhornUI.nodeSelector | toYaml | indent 8 }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400154 {{- end }}
155 {{- end }}
156---
157kind: Service
158apiVersion: v1
159metadata:
160 labels: {{- include "longhorn.labels" . | nindent 4 }}
161 app: longhorn-ui
162 {{- if eq .Values.service.ui.type "Rancher-Proxy" }}
163 kubernetes.io/cluster-service: "true"
164 {{- end }}
gio3e1b96b2026-07-21 18:52:35 +0400165 {{- with .Values.service.ui.labels }}
166 {{- toYaml . | nindent 4 }}
167 {{- end }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400168 name: longhorn-frontend
169 namespace: {{ include "release_namespace" . }}
gio3e1b96b2026-07-21 18:52:35 +0400170 {{- with .Values.service.ui.annotations }}
171 annotations:
172 {{- toYaml . | nindent 4 }}
173 {{- end }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400174spec:
175 {{- if eq .Values.service.ui.type "Rancher-Proxy" }}
176 type: ClusterIP
177 {{- else }}
178 type: {{ .Values.service.ui.type }}
179 {{- end }}
180 {{- if and .Values.service.ui.loadBalancerIP (eq .Values.service.ui.type "LoadBalancer") }}
181 loadBalancerIP: {{ .Values.service.ui.loadBalancerIP }}
182 {{- end }}
183 {{- if and (eq .Values.service.ui.type "LoadBalancer") .Values.service.ui.loadBalancerSourceRanges }}
184 loadBalancerSourceRanges: {{- toYaml .Values.service.ui.loadBalancerSourceRanges | nindent 4 }}
185 {{- end }}
gio3e1b96b2026-07-21 18:52:35 +0400186 {{- if and (eq .Values.service.ui.type "LoadBalancer") .Values.service.ui.loadBalancerClass }}
187 loadBalancerClass: {{ .Values.service.ui.loadBalancerClass }}
188 {{- end }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400189 selector:
190 app: longhorn-ui
191 ports:
192 - name: http
193 port: 80
194 targetPort: http
195 {{- if .Values.service.ui.nodePort }}
196 nodePort: {{ .Values.service.ui.nodePort }}
197 {{- else }}
198 nodePort: null
199 {{- end }}