blob: ea4fa141edd9aab3f144eca0e50437bfe5bfb855 [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 volumes:
105 {{- 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 }}
112 - emptyDir: {}
113 name: nginx-cache
114 - emptyDir: {}
115 name: nginx-config
116 - emptyDir: {}
117 name: var-run
118 {{- with (coalesce .Values.global.imagePullSecrets .Values.privateRegistry.registrySecret) }}
119 imagePullSecrets:
120 {{- $imagePullSecrets := list }}
121 {{- if kindIs "string" . }}
122 {{- $imagePullSecrets = append $imagePullSecrets (dict "name" .) }}
123 {{- else }}
124 {{- range . }}
125 {{- if kindIs "string" . }}
126 {{- $imagePullSecrets = append $imagePullSecrets (dict "name" .) }}
127 {{- else }}
128 {{- $imagePullSecrets = append $imagePullSecrets . }}
129 {{- end }}
130 {{- end }}
131 {{- end }}
132 {{- toYaml $imagePullSecrets | nindent 8 }}
133 {{- end }}
134 {{- if .Values.longhornUI.priorityClass }}
135 priorityClassName: {{ .Values.longhornUI.priorityClass | quote }}
136 {{- end }}
137 {{- if or .Values.global.tolerations .Values.longhornUI.tolerations .Values.global.cattle.windowsCluster.enabled }}
138 tolerations:
139 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.tolerations }}
140{{ toYaml .Values.global.cattle.windowsCluster.tolerations | indent 6 }}
141 {{- end }}
142 {{- if or .Values.global.tolerations .Values.longhornUI.tolerations }}
143{{ default .Values.global.tolerations .Values.longhornUI.tolerations | toYaml | indent 6 }}
144 {{- end }}
145 {{- end }}
146 {{- if or .Values.global.nodeSelector .Values.longhornUI.nodeSelector .Values.global.cattle.windowsCluster.enabled }}
147 nodeSelector:
148 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.nodeSelector }}
149{{ toYaml .Values.global.cattle.windowsCluster.nodeSelector | indent 8 }}
150 {{- end }}
151 {{- if or .Values.global.nodeSelector .Values.longhornUI.nodeSelector }}
152{{ default .Values.global.nodeSelector .Values.longhornUI.nodeSelector | toYaml | indent 8 }}
153 {{- end }}
154 {{- end }}
155---
156kind: Service
157apiVersion: v1
158metadata:
159 labels: {{- include "longhorn.labels" . | nindent 4 }}
160 app: longhorn-ui
161 {{- if eq .Values.service.ui.type "Rancher-Proxy" }}
162 kubernetes.io/cluster-service: "true"
163 {{- end }}
164 name: longhorn-frontend
165 namespace: {{ include "release_namespace" . }}
166 {{- with .Values.service.ui.annotations }}
167 annotations:
168 {{- toYaml . | nindent 4 }}
169 {{- end }}
170spec:
171 {{- if eq .Values.service.ui.type "Rancher-Proxy" }}
172 type: ClusterIP
173 {{- else }}
174 type: {{ .Values.service.ui.type }}
175 {{- end }}
176 {{- if and .Values.service.ui.loadBalancerIP (eq .Values.service.ui.type "LoadBalancer") }}
177 loadBalancerIP: {{ .Values.service.ui.loadBalancerIP }}
178 {{- end }}
179 {{- if and (eq .Values.service.ui.type "LoadBalancer") .Values.service.ui.loadBalancerSourceRanges }}
180 loadBalancerSourceRanges: {{- toYaml .Values.service.ui.loadBalancerSourceRanges | nindent 4 }}
181 {{- end }}
182 selector:
183 app: longhorn-ui
184 ports:
185 - name: http
186 port: 80
187 targetPort: http
188 {{- if .Values.service.ui.nodePort }}
189 nodePort: {{ .Values.service.ui.nodePort }}
190 {{- else }}
191 nodePort: null
192 {{- end }}