blob: 2fe3ce531bd8ac0682c74b56628a498942e6e6e8 [file] [log] [blame]
gio3e1b96b2026-07-21 18:52:35 +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 }}
39apiVersion: 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:
56 serviceAccountName: longhorn-ui-service-account
57 affinity:
58 {{- toYaml .Values.longhornUI.affinity | nindent 8 }}
59 containers:
60 {{- if .Values.openshift.enabled }}
61 {{- if .Values.openshift.ui.route }}
62 - name: oauth-proxy
63 {{- if .Values.image.openshift.oauthProxy.repository }}
64 image: {{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.openshift.oauthProxy.registry) }}{{ . }}/{{ end }}{{ .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 }}
86 - name: longhorn-ui
87 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 }}
88 imagePullPolicy: {{ .Values.image.pullPolicy }}
89 volumeMounts:
90 - name: nginx-cache
91 mountPath: /var/cache/nginx/
92 - name: nginx-config
93 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 {{- include "longhorn.timezoneEnv" . | nindent 10 }}
105 volumes:
106 {{- 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 }}
113 - emptyDir: {}
114 name: nginx-cache
115 - emptyDir: {}
116 name: nginx-config
117 - emptyDir: {}
118 name: var-run
119 {{- with (coalesce .Values.global.imagePullSecrets .Values.privateRegistry.registrySecret) }}
120 imagePullSecrets:
121 {{- $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 }}
134 {{- end }}
135 {{- if .Values.longhornUI.priorityClass }}
136 priorityClassName: {{ .Values.longhornUI.priorityClass | quote }}
137 {{- end }}
138 {{- if or .Values.global.tolerations .Values.longhornUI.tolerations .Values.global.cattle.windowsCluster.enabled }}
139 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 }}
143 {{- if or .Values.global.tolerations .Values.longhornUI.tolerations }}
144{{ default .Values.global.tolerations .Values.longhornUI.tolerations | toYaml | indent 6 }}
145 {{- end }}
146 {{- end }}
147 {{- if or .Values.global.nodeSelector .Values.longhornUI.nodeSelector .Values.global.cattle.windowsCluster.enabled }}
148 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 }}
152 {{- if or .Values.global.nodeSelector .Values.longhornUI.nodeSelector }}
153{{ default .Values.global.nodeSelector .Values.longhornUI.nodeSelector | toYaml | indent 8 }}
154 {{- 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 }}
165 {{- with .Values.service.ui.labels }}
166 {{- toYaml . | nindent 4 }}
167 {{- end }}
168 name: longhorn-frontend
169 namespace: {{ include "release_namespace" . }}
170 {{- with .Values.service.ui.annotations }}
171 annotations:
172 {{- toYaml . | nindent 4 }}
173 {{- end }}
174spec:
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 }}
186 {{- if and (eq .Values.service.ui.type "LoadBalancer") .Values.service.ui.loadBalancerClass }}
187 loadBalancerClass: {{ .Values.service.ui.loadBalancerClass }}
188 {{- end }}
189 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 }}