blob: 76b80f2fcea760a671b2d5948121c8ecd084c5ef [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 }}
64 image: {{ template "registry_url" . }}{{ .Values.image.openshift.oauthProxy.repository }}:{{ .Values.image.openshift.oauthProxy.tag }}
65 {{- 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
87 image: {{ template "registry_url" . }}{{ .Values.image.longhorn.ui.repository }}:{{ .Values.image.longhorn.ui.tag }}
88 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"
104 volumes:
gio16bb6382025-05-21 18:42:40 +0400105 {{- if .Values.openshift.enabled }}
106 {{- if .Values.openshift.ui.route }}
107 - name: longhorn-ui-tls
108 secret:
109 secretName: longhorn-ui-tls
110 {{- end }}
111 {{- end }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400112 - emptyDir: {}
113 name: nginx-cache
114 - emptyDir: {}
115 name: nginx-config
116 - emptyDir: {}
117 name: var-run
118 {{- if .Values.privateRegistry.registrySecret }}
119 imagePullSecrets:
120 - name: {{ .Values.privateRegistry.registrySecret }}
121 {{- end }}
122 {{- if .Values.longhornUI.priorityClass }}
123 priorityClassName: {{ .Values.longhornUI.priorityClass | quote }}
124 {{- end }}
gio16bb6382025-05-21 18:42:40 +0400125 {{- if or .Values.global.tolerations .Values.longhornUI.tolerations .Values.global.cattle.windowsCluster.enabled }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400126 tolerations:
127 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.tolerations }}
128{{ toYaml .Values.global.cattle.windowsCluster.tolerations | indent 6 }}
129 {{- end }}
gio16bb6382025-05-21 18:42:40 +0400130 {{- if or .Values.global.tolerations .Values.longhornUI.tolerations }}
131{{ default .Values.global.tolerations .Values.longhornUI.tolerations | toYaml | indent 6 }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400132 {{- end }}
133 {{- end }}
gio16bb6382025-05-21 18:42:40 +0400134 {{- if or .Values.global.nodeSelector .Values.longhornUI.nodeSelector .Values.global.cattle.windowsCluster.enabled }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400135 nodeSelector:
136 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.nodeSelector }}
137{{ toYaml .Values.global.cattle.windowsCluster.nodeSelector | indent 8 }}
138 {{- end }}
gio16bb6382025-05-21 18:42:40 +0400139 {{- if or .Values.global.nodeSelector .Values.longhornUI.nodeSelector }}
140{{ default .Values.global.nodeSelector .Values.longhornUI.nodeSelector | toYaml | indent 8 }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400141 {{- end }}
142 {{- end }}
143---
144kind: Service
145apiVersion: v1
146metadata:
147 labels: {{- include "longhorn.labels" . | nindent 4 }}
148 app: longhorn-ui
149 {{- if eq .Values.service.ui.type "Rancher-Proxy" }}
150 kubernetes.io/cluster-service: "true"
151 {{- end }}
152 name: longhorn-frontend
153 namespace: {{ include "release_namespace" . }}
154spec:
155 {{- if eq .Values.service.ui.type "Rancher-Proxy" }}
156 type: ClusterIP
157 {{- else }}
158 type: {{ .Values.service.ui.type }}
159 {{- end }}
160 {{- if and .Values.service.ui.loadBalancerIP (eq .Values.service.ui.type "LoadBalancer") }}
161 loadBalancerIP: {{ .Values.service.ui.loadBalancerIP }}
162 {{- end }}
163 {{- if and (eq .Values.service.ui.type "LoadBalancer") .Values.service.ui.loadBalancerSourceRanges }}
164 loadBalancerSourceRanges: {{- toYaml .Values.service.ui.loadBalancerSourceRanges | nindent 4 }}
165 {{- end }}
166 selector:
167 app: longhorn-ui
168 ports:
169 - name: http
170 port: 80
171 targetPort: http
172 {{- if .Values.service.ui.nodePort }}
173 nodePort: {{ .Values.service.ui.nodePort }}
174 {{- else }}
175 nodePort: null
176 {{- end }}