Skip to content

Commit 9efdd3e

Browse files
authored
K8s: Add template for file browser video records service (#2763)
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 9348ed1 commit 9efdd3e

File tree

7 files changed

+368
-0
lines changed

7 files changed

+368
-0
lines changed

charts/selenium-grid/CONFIGURATION.md

+40
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,46 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
678678
| videoRecorder.extraVolumes | list | `[]` | Extra volumes for video recorder pod |
679679
| videoRecorder.s3 | object | `{"args":[],"command":[],"extraEnvironmentVariables":[],"imageName":"aws-cli","imagePullPolicy":"IfNotPresent","imageRegistry":"bitnami","imageTag":"latest","securityContext":{"runAsUser":0}}` | Container spec for the uploader if above it is defined as "uploader.name: s3" |
680680
| customLabels | object | `{}` | Custom labels for k8s resources |
681+
| videoManager.enabled | bool | `false` | Enable video manager |
682+
| videoManager.nameOverride | string | `""` | Override deployment name of video manager |
683+
| videoManager.ingress.enabled | bool | `true` | Enable ingress resource to access the file browser |
684+
| videoManager.ingress.annotations | string | `nil` | Annotations for file browser ingress resource |
685+
| videoManager.ingress.paths | list | `[]` | Configure paths for file browser ingress resource |
686+
| videoManager.imageRegistry | string | `"filebrowser"` | Registry to pull the image (this overwrites global.seleniumGrid.imageRegistry parameter) |
687+
| videoManager.imageName | string | `"filebrowser"` | File browser image name |
688+
| videoManager.imageTag | string | `"latest"` | File browser image tag (this overwrites global.seleniumGrid.imageTag parameter) |
689+
| videoManager.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) |
690+
| videoManager.imagePullSecret | string | `""` | Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) |
691+
| videoManager.config.baseurl | string | `"recordings"` | Base URL use to access the file browser (e.g. http://public.ip/recordings) |
692+
| videoManager.config.username | string | `""` | Username for the first user when using quick config (default "admin") |
693+
| videoManager.config.password | string | `""` | Hashed password (bcrypt) for the first user when using quick config (default "admin") |
694+
| videoManager.config.noauth | bool | `true` | Use the noauth auther when using quick setup |
695+
| videoManager.extraEnvironmentVariables | list | `[]` | Specify extra environment variables for Router |
696+
| videoManager.extraEnvFrom | list | `[]` | Specify extra environment variables from ConfigMap and Secret for Router |
697+
| videoManager.affinity | object | `{}` | Specify affinity for router pods, this overwrites global.seleniumGrid.affinity parameter |
698+
| videoManager.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for router pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
699+
| videoManager.annotations | object | `{}` | Custom annotations for router pods |
700+
| videoManager.port | int | `80` | Router container port |
701+
| videoManager.nodePort | int | `30080` | Router expose NodePort |
702+
| videoManager.startupProbe | object | `{}` | Startup probe settings |
703+
| videoManager.readinessProbe | object | `{}` | Readiness probe settings |
704+
| videoManager.livenessProbe | object | `{}` | Liveness probe settings |
705+
| videoManager.lifecycle | object | `{}` | |
706+
| videoManager.resources | object | `{"limits":{"cpu":"1","memory":"1Gi"},"requests":{"cpu":"0.1","memory":"128Mi"}}` | Resources for router container |
707+
| videoManager.replicas | int | `1` | Number of replicas |
708+
| videoManager.securityContext | object | `{}` | SecurityContext for router container |
709+
| videoManager.serviceType | string | `"ClusterIP"` | Kubernetes service type (see https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types) |
710+
| videoManager.clusterIP | string | `""` | Set specific clusterIP when serviceType is ClusterIP (see https://kubernetes.io/docs/concepts/services-networking/service/#type-clusterip) |
711+
| videoManager.externalName | string | `""` | Set specific externalName when serviceType is ExternalName (see https://kubernetes.io/docs/concepts/services-networking/service/#type-externalname) |
712+
| videoManager.loadBalancerIP | string | `""` | Set specific loadBalancerIP when serviceType is LoadBalancer (see https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer) |
713+
| videoManager.serviceAnnotations | object | `{}` | Custom annotations for router service |
714+
| videoManager.serviceExternalTrafficPolicy | string | `""` | Set externalTrafficPolicy to Local or Cluster (see https://kubernetes.io/docs/concepts/services-networking/service-traffic-policy/) |
715+
| videoManager.serviceSessionAffinity | string | `""` | Set session affinity to None, ClientIP or ClientIPString |
716+
| videoManager.tolerations | list | `[]` | Tolerations for router pods |
717+
| videoManager.nodeSelector | object | `{}` | Node selector for router pods |
718+
| videoManager.priorityClassName | string | `""` | Priority class name for router pods |
719+
| videoManager.extraVolumeMounts | list | `[]` | |
720+
| videoManager.extraVolumes | list | `[]` | Extra volumes for video recorder pod |
681721
| keda.additionalAnnotations | string | `nil` | Annotations for KEDA resources |
682722
| keda.http.timeout | int | `60000` | |
683723
| keda.webhooks | object | `{"enabled":false}` | Enable KEDA admission webhooks component |

charts/selenium-grid/templates/_nameHelpers.tpl

+7
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,13 @@ Recorder ConfigMap fullname
232232
{{- tpl (default (include "seleniumGrid.component.name" (list "selenium-recorder-config" $)) .Values.recorderConfigMap.nameOverride) $ | trunc 63 | trimSuffix "-" -}}
233233
{{- end -}}
234234

235+
{{/*
236+
Video manager fullname
237+
*/}}
238+
{{- define "seleniumGrid.videoManager.fullname" -}}
239+
{{- tpl (default (include "seleniumGrid.component.name" (list "selenium-video-manager" $)) .Values.videoManager.nameOverride) $ | trunc 63 | trimSuffix "-" -}}
240+
{{- end -}}
241+
235242
{{/*
236243
Uploader ConfigMap fullname
237244
*/}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
{{- if .Values.videoManager.enabled }}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: {{ template "seleniumGrid.videoManager.fullname" $ }}
6+
namespace: {{ .Release.Namespace }}
7+
labels: &app_labels
8+
app: {{ template "seleniumGrid.videoManager.fullname" $ }}
9+
app.kubernetes.io/name: {{ template "seleniumGrid.videoManager.fullname" $ }}
10+
{{- include "seleniumGrid.commonLabels" . | nindent 4 }}
11+
{{- with .Values.customLabels }}
12+
{{- toYaml . | nindent 4 }}
13+
{{- end }}
14+
spec:
15+
strategy:
16+
{{- template "seleniumGrid.updateStrategy" (list $.Values.videoManager $.Values.global.seleniumGrid) }}
17+
replicas: {{ max 1 ($.Values.videoManager.replicas | int) }}
18+
revisionHistoryLimit: {{ .Values.global.seleniumGrid.revisionHistoryLimit }}
19+
selector:
20+
matchLabels:
21+
app: {{ template "seleniumGrid.videoManager.fullname" $ }}
22+
app.kubernetes.io/instance: {{ .Release.Name }}
23+
template:
24+
metadata:
25+
labels: *app_labels
26+
{{- with .Values.videoManager.annotations }}
27+
annotations: {{- toYaml . | nindent 8 }}
28+
{{- end }}
29+
spec:
30+
serviceAccountName: {{ template "seleniumGrid.serviceAccount.fullname" . }}
31+
serviceAccount: {{ template "seleniumGrid.serviceAccount.fullname" . }}
32+
containers:
33+
- name: file-browser
34+
image: {{ printf "%s/%s:%s" .Values.videoManager.imageRegistry .Values.videoManager.imageName .Values.videoManager.imageTag }}
35+
imagePullPolicy: {{ .Values.videoManager.imagePullPolicy }}
36+
env:
37+
{{- with .Values.videoManager.config.baseurl }}
38+
- name: FB_BASEURL
39+
value: {{ . | quote }}
40+
{{- end }}
41+
{{- with .Values.videoManager.config.username }}
42+
- name: FB_USERNAME
43+
value: {{ . | quote }}
44+
{{- end }}
45+
{{- with .Values.videoManager.config.password }}
46+
- name: FB_PASSWORD
47+
value: {{ . | quote }}
48+
{{- end }}
49+
{{- if .Values.videoManager.config.noauth }}
50+
- name: FB_NOAUTH
51+
value: "true"
52+
{{- end }}
53+
{{- with .Values.videoManager.extraEnvironmentVariables }}
54+
{{- tpl (toYaml .) $ | nindent 12 }}
55+
{{- end }}
56+
{{- with .Values.videoManager.extraEnvFrom }}
57+
envFrom: {{- toYaml . | nindent 12 }}
58+
{{- end }}
59+
volumeMounts:
60+
{{- if .Values.videoManager.extraVolumeMounts }}
61+
{{- tpl (toYaml .) $ | nindent 12 }}
62+
{{- else }}
63+
- name: srv
64+
mountPath: /srv
65+
subPath: srv
66+
{{- end }}
67+
ports:
68+
- containerPort: {{ .Values.videoManager.port }}
69+
protocol: TCP
70+
{{- with .Values.videoManager.resources }}
71+
resources: {{- toYaml . | nindent 12 }}
72+
{{- end }}
73+
{{- with .Values.videoManager.securityContext }}
74+
securityContext: {{- toYaml . | nindent 12 }}
75+
{{- end }}
76+
{{- with .Values.videoManager.startupProbe }}
77+
startupProbe: {{- toYaml . | nindent 12 }}
78+
{{- end }}
79+
{{- with .Values.videoManager.livenessProbe }}
80+
livenessProbe: {{- toYaml . | nindent 12 }}
81+
{{- end }}
82+
{{- with .Values.videoManager.lifecycle }}
83+
lifecycle: {{- toYaml . | nindent 12 }}
84+
{{- end }}
85+
{{- with .Values.videoManager.nodeSelector }}
86+
nodeSelector: {{- toYaml . | nindent 8 }}
87+
{{- end }}
88+
{{- if or .Values.global.seleniumGrid.affinity .Values.videoManager.affinity }}
89+
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.videoManager.affinity }}
90+
affinity: {{- toYaml $affinityYaml | nindent 8 }}
91+
{{- end }}
92+
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.videoManager.topologySpreadConstraints }}
93+
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.videoManager.topologySpreadConstraints }}
94+
topologySpreadConstraints:
95+
{{- range $constraint := $topologySpreadConstraints }}
96+
- {{ toYaml $constraint | nindent 10 | trim }}
97+
{{- if not $constraint.labelSelector }}
98+
labelSelector:
99+
matchLabels:
100+
app: {{ template "seleniumGrid.videoManager.fullname" $ }}
101+
{{- end }}
102+
{{- end }}
103+
{{- end }}
104+
{{- with .Values.videoManager.tolerations }}
105+
tolerations: {{ toYaml . | nindent 6 }}
106+
{{- end }}
107+
{{- if or .Values.global.seleniumGrid.imagePullSecret .Values.videoManager.imagePullSecret }}
108+
imagePullSecrets:
109+
- name: {{ default .Values.global.seleniumGrid.imagePullSecret .Values.videoManager.imagePullSecret }}
110+
{{- end }}
111+
{{- with .Values.videoManager.priorityClassName }}
112+
priorityClassName: {{ . }}
113+
{{- end }}
114+
volumes:
115+
{{- if .Values.videoManager.extraVolumes }}
116+
{{ tpl (toYaml .) $ | nindent 8 }}
117+
{{- else }}
118+
- name: srv
119+
emptyDir: {}
120+
{{- end }}
121+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{{- if and .Values.videoManager.enabled .Values.videoManager.ingress.enabled .Values.ingress.enabled }}
2+
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
3+
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
4+
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
5+
{{- end }}
6+
{{- end }}
7+
apiVersion: networking.k8s.io/v1
8+
kind: Ingress
9+
metadata:
10+
name: {{ template "seleniumGrid.videoManager.fullname" $ }}
11+
namespace: {{ .Release.Namespace }}
12+
labels:
13+
{{- include "seleniumGrid.commonLabels" . | nindent 4 }}
14+
{{- with .Values.customLabels }}
15+
{{- toYaml . | nindent 4 }}
16+
{{- end }}
17+
{{- with .Values.videoManager.ingress.annotations }}
18+
annotations:
19+
{{- . | toYaml | nindent 4 }}
20+
{{- end }}
21+
spec:
22+
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
23+
ingressClassName: {{ .Values.ingress.className }}
24+
{{- end }}
25+
{{- if and (or .Values.tls.enabled .Values.tls.ingress.generateTLS) (tpl .Values.ingress.hostname $) (not .Values.ingress.tls) }}
26+
tls:
27+
- hosts:
28+
- {{ tpl .Values.ingress.hostname $ }}
29+
secretName: {{ include "seleniumGrid.tls.fullname" $ | quote }}
30+
{{- else if .Values.ingress.tls }}
31+
tls:
32+
{{- range .Values.ingress.tls }}
33+
- hosts:
34+
{{- range .hosts }}
35+
- {{ tpl . $ }}
36+
{{- end }}
37+
secretName: {{ tpl (default (include "seleniumGrid.tls.fullname" $) .secretName) $ | quote }}
38+
{{- end }}
39+
{{- end }}
40+
rules:
41+
{{- if $.Values.ingress.hostname }}
42+
- host: {{ tpl $.Values.ingress.hostname $ }}
43+
http:
44+
{{- else }}
45+
- http:
46+
{{- end }}
47+
paths:
48+
{{- if .Values.videoManager.ingress.paths }}
49+
{{- tpl (toYaml . | nindent 10) $ }}
50+
{{- else }}
51+
- backend:
52+
service:
53+
name: {{ include "seleniumGrid.videoManager.fullname" $ | quote }}
54+
port:
55+
number: 80
56+
path: {{ printf "/%s" $.Values.videoManager.config.baseurl | quote }}
57+
pathType: Prefix
58+
{{- end }}
59+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{{- if .Values.videoManager.enabled }}
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: {{ template "seleniumGrid.videoManager.fullname" $ }}
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
app: {{ template "seleniumGrid.videoManager.fullname" $ }}
9+
{{- include "seleniumGrid.commonLabels" . | nindent 4 }}
10+
{{- with .Values.customLabels }}
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
{{- with .Values.videoManager.serviceAnnotations }}
14+
annotations: {{- toYaml . | nindent 4 }}
15+
{{- end }}
16+
spec:
17+
selector:
18+
app: {{ template "seleniumGrid.videoManager.fullname" $ }}
19+
app.kubernetes.io/instance: {{ .Release.Name }}
20+
type: {{ .Values.videoManager.serviceType }}
21+
{{- if and (eq .Values.videoManager.serviceType "ClusterIP") ( .Values.videoManager.clusterIP ) }}
22+
clusterIP: {{ .Values.videoManager.clusterIP }}
23+
{{- end }}
24+
{{- if and (eq .Values.videoManager.serviceType "ExternalName") ( .Values.videoManager.externalName ) }}
25+
externalName: {{ .Values.videoManager.externalName }}
26+
{{- end }}
27+
{{- if and (eq .Values.videoManager.serviceType "LoadBalancer") (.Values.videoManager.loadBalancerIP) }}
28+
loadBalancerIP: {{ .Values.videoManager.loadBalancerIP }}
29+
{{- end }}
30+
ports:
31+
- name: web
32+
protocol: TCP
33+
port: {{ .Values.videoManager.port }}
34+
targetPort: {{ .Values.videoManager.port }}
35+
{{- if and (eq $.Values.videoManager.serviceType "NodePort") $.Values.videoManager.nodePort }}
36+
nodePort: {{ $.Values.videoManager.nodePort }}
37+
{{- end }}
38+
{{- with .Values.videoManager.serviceExternalTrafficPolicy }}
39+
externalTrafficPolicy: {{ . }}
40+
{{- end }}
41+
{{- with .Values.videoManager.serviceSessionAffinity }}
42+
sessionAffinity: {{ . }}
43+
{{- end }}
44+
{{- end }}

charts/selenium-grid/values.yaml

+94
Original file line numberDiff line numberDiff line change
@@ -2030,6 +2030,100 @@ videoRecorder:
20302030
# -- Custom labels for k8s resources
20312031
customLabels: {}
20322032

2033+
videoManager:
2034+
# -- Enable video manager
2035+
enabled: false
2036+
# -- Override deployment name of video manager
2037+
nameOverride: ""
2038+
ingress:
2039+
# -- Enable ingress resource to access the file browser
2040+
enabled: true
2041+
# -- Annotations for file browser ingress resource
2042+
annotations:
2043+
# -- Configure paths for file browser ingress resource
2044+
paths: []
2045+
# -- Registry to pull the image (this overwrites global.seleniumGrid.imageRegistry parameter)
2046+
imageRegistry: "filebrowser"
2047+
# -- File browser image name
2048+
imageName: "filebrowser"
2049+
# -- File browser image tag (this overwrites global.seleniumGrid.imageTag parameter)
2050+
imageTag: "latest"
2051+
# -- Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images)
2052+
imagePullPolicy: IfNotPresent
2053+
# -- Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/)
2054+
imagePullSecret: ""
2055+
config:
2056+
# -- Base URL use to access the file browser (e.g. http://public.ip/recordings)
2057+
baseurl: "recordings"
2058+
# -- Username for the first user when using quick config (default "admin")
2059+
username: ""
2060+
# -- Hashed password (bcrypt) for the first user when using quick config (default "admin")
2061+
password: ""
2062+
# -- Use the noauth auther when using quick setup
2063+
noauth: true
2064+
# -- Specify extra environment variables for Router
2065+
extraEnvironmentVariables: []
2066+
# -- Specify extra environment variables from ConfigMap and Secret for Router
2067+
extraEnvFrom: []
2068+
# -- Specify affinity for router pods, this overwrites global.seleniumGrid.affinity parameter
2069+
affinity: {}
2070+
# -- Specify topologySpreadConstraints for router pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter
2071+
topologySpreadConstraints: []
2072+
# -- Custom annotations for router pods
2073+
annotations: {}
2074+
# -- Router container port
2075+
port: 80
2076+
# -- Router expose NodePort
2077+
nodePort: 30080
2078+
# -- Startup probe settings
2079+
startupProbe: {}
2080+
# -- Readiness probe settings
2081+
readinessProbe: {}
2082+
# -- Liveness probe settings
2083+
livenessProbe: {}
2084+
lifecycle: {}
2085+
# -- Resources for router container
2086+
resources:
2087+
requests:
2088+
cpu: "0.1"
2089+
memory: "128Mi"
2090+
limits:
2091+
cpu: "1"
2092+
memory: "1Gi"
2093+
# -- Number of replicas
2094+
replicas: 1
2095+
# -- SecurityContext for router container
2096+
securityContext: { }
2097+
# -- Kubernetes service type (see https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types)
2098+
serviceType: ClusterIP
2099+
# -- Set specific clusterIP when serviceType is ClusterIP (see https://kubernetes.io/docs/concepts/services-networking/service/#type-clusterip)
2100+
clusterIP: ""
2101+
# -- Set specific externalName when serviceType is ExternalName (see https://kubernetes.io/docs/concepts/services-networking/service/#type-externalname)
2102+
externalName: ""
2103+
# -- Set specific loadBalancerIP when serviceType is LoadBalancer (see https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer)
2104+
loadBalancerIP: ""
2105+
# -- Custom annotations for router service
2106+
serviceAnnotations: { }
2107+
# -- Set externalTrafficPolicy to Local or Cluster (see https://kubernetes.io/docs/concepts/services-networking/service-traffic-policy/)
2108+
serviceExternalTrafficPolicy: ""
2109+
# -- Set session affinity to None, ClientIP or ClientIPString
2110+
serviceSessionAffinity: ""
2111+
# -- Tolerations for router pods
2112+
tolerations: [ ]
2113+
# -- Node selector for router pods
2114+
nodeSelector: { }
2115+
# -- Priority class name for router pods
2116+
priorityClassName: ""
2117+
extraVolumeMounts: [ ]
2118+
# - name: srv
2119+
# mountPath: /srv
2120+
# subPath: srv
2121+
# -- Extra volumes for video recorder pod
2122+
extraVolumes: [ ]
2123+
# - name: srv
2124+
# persistentVolumeClaim:
2125+
# claimName: video-pv-claim
2126+
20332127
# Configuration for dependency chart keda
20342128
keda:
20352129
# enabled: false

tests/charts/refValues/simplex-docker-desktop.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ edgeNode:
6868
videoRecorder:
6969
enabled: true
7070

71+
videoManager:
72+
enabled: true
73+
7174
ingress-nginx:
7275
controller:
7376
hostPort:

0 commit comments

Comments
 (0)