apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "selenoid.fullname" . }} labels: {{- include "selenoid.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} selector: matchLabels: {{- include "selenoid.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "selenoid.labels" . | nindent 8 }} {{- with .Values.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} startupProbe: {{- toYaml .Values.startupProbe | nindent 12 }} livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }} readinessProbe: {{- toYaml .Values.readinessProbe | nindent 12 }} resources: {{- toYaml .Values.resources | nindent 12 }} volumeMounts: - name: config mountPath: /etc/selenoid/browsers.json subPath: browsers.json - name: scripts mountPath: /tmp/scripts/selenoid subPath: selenoid command: - sh args: - /tmp/scripts/selenoid ports: - containerPort: 4444 name: selenium env: - name: DOCKER_HOST value: tcp://localhost:2375 - name: dind image: "{{ .Values.dind.registry }}/{{ .Values.dind.repository }}:{{ .Values.dind.tag }}" imagePullPolicy: {{ .Values.dind.pullPolicy }} command: {{- range .Values.dind.command }} - {{ . }} {{- end }} args: {{- range .Values.dind.commandArgs }} - {{ . }} {{- end }} {{- with .Values.dind.securityContext }} securityContext: {{- toYaml . | nindent 12 }} {{- end }} lifecycle: preStop: # wait for all running containers to have stopped, so the last build can finish before the runner is fully stopped. exec: command: ["/bin/sh","-c","while true; do sleep {{ .Values.dind.gracefulShutdownRetryPeriod }}; lastEventTime=$(docker -H tcp://localhost:2375 events --since={{ .Values.dind.gracefulShutdownRetryPeriod }}s --until=1s | wc -l); containersRunning=$(docker -H tcp://localhost:2375 ps -q | wc -l); if [ $containersRunning -eq 0 ] && [ $lastEventTime -eq 0 ]; then exit 0; fi; echo 'steps/containers running, retry'; done"] livenessProbe: exec: command: - docker - -H - tcp://localhost:2375 - images initialDelaySeconds: 5 periodSeconds: 5 readinessProbe: exec: command: - docker - -H - tcp://localhost:2375 - images initialDelaySeconds: 5 periodSeconds: 5 {{- with .Values.dind.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.dind.extraVolumeMounts }} volumeMounts: {{- toYaml . | nindent 12 }} {{- end }} volumes: - name: config configMap: name: {{ include "selenoid.fullname" . }}-config - name: scripts configMap: name: {{ include "selenoid.fullname" . }}-scripts - name: docker-storage emptyDir: {} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }}