| gio | 16bb638 | 2025-05-21 18:42:40 +0400 | [diff] [blame] | 1 | {{- 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 |
| 6 | apiVersion: route.openshift.io/v1 |
| 7 | kind: Route |
| 8 | metadata: |
| 9 | labels: {{- include "longhorn.labels" . | nindent 4 }} |
| 10 | app: longhorn-ui |
| 11 | name: {{ .Values.openshift.ui.route }} |
| 12 | namespace: {{ include "release_namespace" . }} |
| 13 | spec: |
| 14 | to: |
| 15 | kind: Service |
| 16 | name: longhorn-ui |
| 17 | tls: |
| 18 | termination: reencrypt |
| 19 | --- |
| 20 | apiVersion: v1 |
| 21 | kind: Service |
| 22 | metadata: |
| 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 |
| 29 | spec: |
| 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 Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 39 | apiVersion: apps/v1 |
| 40 | kind: Deployment |
| 41 | metadata: |
| 42 | labels: {{- include "longhorn.labels" . | nindent 4 }} |
| 43 | app: longhorn-ui |
| 44 | name: longhorn-ui |
| 45 | namespace: {{ include "release_namespace" . }} |
| 46 | spec: |
| 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: |
| gio | 16bb638 | 2025-05-21 18:42:40 +0400 | [diff] [blame] | 56 | serviceAccountName: longhorn-ui-service-account |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 57 | affinity: |
| gio | dbf4a85 | 2025-06-30 17:09:46 +0400 | [diff] [blame] | 58 | {{- toYaml .Values.longhornUI.affinity | nindent 8 }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 59 | containers: |
| gio | 16bb638 | 2025-05-21 18:42:40 +0400 | [diff] [blame] | 60 | {{- if .Values.openshift.enabled }} |
| 61 | {{- if .Values.openshift.ui.route }} |
| 62 | - name: oauth-proxy |
| 63 | {{- if .Values.image.openshift.oauthProxy.repository }} |
| gio | 3e1b96b | 2026-07-21 18:52:35 +0400 | [diff] [blame] | 64 | 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 }} |
| gio | 16bb638 | 2025-05-21 18:42:40 +0400 | [diff] [blame] | 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 Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 86 | - name: longhorn-ui |
| gio | 3e1b96b | 2026-07-21 18:52:35 +0400 | [diff] [blame] | 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 }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 88 | imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 89 | volumeMounts: |
| gio | dbf4a85 | 2025-06-30 17:09:46 +0400 | [diff] [blame] | 90 | - name: nginx-cache |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 91 | mountPath: /var/cache/nginx/ |
| gio | dbf4a85 | 2025-06-30 17:09:46 +0400 | [diff] [blame] | 92 | - name: nginx-config |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 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" |
| gio | 3e1b96b | 2026-07-21 18:52:35 +0400 | [diff] [blame] | 104 | {{- include "longhorn.timezoneEnv" . | nindent 10 }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 105 | volumes: |
| gio | 16bb638 | 2025-05-21 18:42:40 +0400 | [diff] [blame] | 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 }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 113 | - emptyDir: {} |
| 114 | name: nginx-cache |
| 115 | - emptyDir: {} |
| 116 | name: nginx-config |
| 117 | - emptyDir: {} |
| 118 | name: var-run |
| gio | 3e1b96b | 2026-07-21 18:52:35 +0400 | [diff] [blame] | 119 | {{- with (coalesce .Values.global.imagePullSecrets .Values.privateRegistry.registrySecret) }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 120 | imagePullSecrets: |
| gio | 3e1b96b | 2026-07-21 18:52:35 +0400 | [diff] [blame] | 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 }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 134 | {{- end }} |
| 135 | {{- if .Values.longhornUI.priorityClass }} |
| 136 | priorityClassName: {{ .Values.longhornUI.priorityClass | quote }} |
| 137 | {{- end }} |
| gio | 16bb638 | 2025-05-21 18:42:40 +0400 | [diff] [blame] | 138 | {{- if or .Values.global.tolerations .Values.longhornUI.tolerations .Values.global.cattle.windowsCluster.enabled }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 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 }} |
| gio | 16bb638 | 2025-05-21 18:42:40 +0400 | [diff] [blame] | 143 | {{- if or .Values.global.tolerations .Values.longhornUI.tolerations }} |
| 144 | {{ default .Values.global.tolerations .Values.longhornUI.tolerations | toYaml | indent 6 }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 145 | {{- end }} |
| 146 | {{- end }} |
| gio | 16bb638 | 2025-05-21 18:42:40 +0400 | [diff] [blame] | 147 | {{- if or .Values.global.nodeSelector .Values.longhornUI.nodeSelector .Values.global.cattle.windowsCluster.enabled }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 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 }} |
| gio | 16bb638 | 2025-05-21 18:42:40 +0400 | [diff] [blame] | 152 | {{- if or .Values.global.nodeSelector .Values.longhornUI.nodeSelector }} |
| 153 | {{ default .Values.global.nodeSelector .Values.longhornUI.nodeSelector | toYaml | indent 8 }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 154 | {{- end }} |
| 155 | {{- end }} |
| 156 | --- |
| 157 | kind: Service |
| 158 | apiVersion: v1 |
| 159 | metadata: |
| 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 }} |
| gio | 3e1b96b | 2026-07-21 18:52:35 +0400 | [diff] [blame] | 165 | {{- with .Values.service.ui.labels }} |
| 166 | {{- toYaml . | nindent 4 }} |
| 167 | {{- end }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 168 | name: longhorn-frontend |
| 169 | namespace: {{ include "release_namespace" . }} |
| gio | 3e1b96b | 2026-07-21 18:52:35 +0400 | [diff] [blame] | 170 | {{- with .Values.service.ui.annotations }} |
| 171 | annotations: |
| 172 | {{- toYaml . | nindent 4 }} |
| 173 | {{- end }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 174 | spec: |
| 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 }} |
| gio | 3e1b96b | 2026-07-21 18:52:35 +0400 | [diff] [blame] | 186 | {{- if and (eq .Values.service.ui.type "LoadBalancer") .Values.service.ui.loadBalancerClass }} |
| 187 | loadBalancerClass: {{ .Values.service.ui.loadBalancerClass }} |
| 188 | {{- end }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 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 }} |