{{- if .Values.web.enabled }} {{- $name := printf "%s-web" (include "workflow-postgres.name" . | trunc 59 | trimSuffix "-") }} {{- if not .Values.web.command }}{{- fail "web.command is required when web.enabled is true, for example [node, node_modules/@workflow/web/server.js]" }}{{- end }} # The observability web UI (@workflow/web), reading the release's database. # No workflow.vercel.com labels: pruning must never select it. apiVersion: apps/v1 kind: Deployment metadata: name: {{ $name }} labels: app.kubernetes.io/name: {{ $name }} app.kubernetes.io/component: web spec: replicas: {{ .Values.web.replicas }} selector: matchLabels: app.kubernetes.io/name: {{ $name }} template: metadata: labels: app.kubernetes.io/name: {{ $name }} app.kubernetes.io/component: web spec: serviceAccountName: {{ include "workflow-postgres.serviceAccountName" . }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} containers: - name: web {{- if .Values.web.image.repository }} image: "{{ .Values.web.image.repository }}:{{ required "web.image.tag is required with web.image.repository" .Values.web.image.tag }}" {{- else }} image: {{ include "workflow-postgres.image" . }} {{- end }} imagePullPolicy: {{ .Values.image.pullPolicy }} command: {{- toYaml .Values.web.command | nindent 12 }} {{- with .Values.web.args }} args: {{- toYaml . | nindent 12 }} {{- end }} ports: - name: http containerPort: {{ .Values.web.port }} # A TCP check: every HTTP path of the UI requires authentication # once it is configured. readinessProbe: tcpSocket: { port: http } livenessProbe: tcpSocket: { port: http } {{- with .Values.web.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} {{- if or .Values.envFrom .Values.web.envFrom }} envFrom: {{- with .Values.envFrom }} {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.web.envFrom }} {{- toYaml . | nindent 12 }} {{- end }} {{- end }} env: - name: PORT value: {{ .Values.web.port | quote }} - name: WORKFLOW_TARGET_WORLD value: "@workflow/world-postgres" - name: WORKFLOW_POSTGRES_JOB_PREFIX value: {{ include "workflow-postgres.jobPrefix" . | quote }} # The UI only reads and sends work; the release's pods run it. - name: WORKFLOW_POSTGRES_SKIP_WORKERS value: "1" {{- with .Values.web.allowedHosts }} - name: WORKFLOW_WEB_ALLOWED_HOSTS value: {{ join "," . | quote }} {{- end }} {{- with .Values.web.basename }} - name: WORKFLOW_WEB_BASENAME value: {{ . | quote }} {{- end }} {{- range $name, $value := .Values.env }} - name: {{ $name }} value: {{ $value | quote }} {{- end }} {{- range $name, $value := .Values.web.env }} - name: {{ $name }} value: {{ $value | quote }} {{- end }} --- apiVersion: v1 kind: Service metadata: name: {{ $name }} labels: app.kubernetes.io/name: {{ $name }} app.kubernetes.io/component: web spec: selector: app.kubernetes.io/name: {{ $name }} ports: - name: http port: {{ .Values.web.service.port }} targetPort: http {{- end }}