{{- if .Values.abacus.validator.enabled }} apiVersion: apps/v1 kind: StatefulSet metadata: name: {{ include "abacus-agent.fullname" . }}-validator labels: {{- include "abacus-agent.labels" . | nindent 4 }} app.kubernetes.io/component: validator spec: selector: matchLabels: {{- include "abacus-agent.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: validator replicas: {{ len .Values.abacus.validator.configs }} serviceName: {{ include "abacus-agent.fullname" . }}-validator template: metadata: annotations: checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} checksum/validator-configmap: {{ include (print $.Template.BasePath "/validator-configmap.yaml") . | sha256sum }} {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.abacus.validator.podAnnotations }} {{ toYaml . | nindent 8 }} {{- end }} labels: {{- include "abacus-agent.labels" . | nindent 8 }} app.kubernetes.io/component: validator {{- with .Values.podCommonLabels }} {{ toYaml . | nindent 8 }} {{- end }} {{- with .Values.abacus.validator.podLabels }} {{ toYaml . | nindent 8 }} {{- end }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} terminationGracePeriodSeconds: 10 securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: agent securityContext: {{- toYaml .Values.securityContext | nindent 10 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} command: ["/bin/sh", "-c"] args: - | RID=$(echo $REPLICA_NAME | grep -Eo '[0-9]+$') env $(cat /config-env-vars/validator-$RID.env /secret-env-vars/validator-$RID.env | xargs) ./validator envFrom: - configMapRef: name: {{ include "abacus-agent.fullname" . }} - secretRef: name: {{ include "abacus-agent.fullname" . }}-secret - secretRef: name: {{ include "abacus-agent.fullname" . }}-validator-secret env: - name: REPLICA_NAME valueFrom: fieldRef: fieldPath: metadata.name {{- if .Values.abacus.tracing.uri }} - name: OPT_BASE_TRACING_JAEGER_NAME value: {{ include "abacus-agent.fullname" . }}-validator {{- end }} resources: {{- toYaml .Values.abacus.validator.resources | nindent 10 }} volumeMounts: - name: state mountPath: {{ .Values.abacus.dbPath }} - name: config-env-vars mountPath: /config-env-vars - name: secret-env-vars mountPath: /secret-env-vars ports: - name: metrics containerPort: {{ .Values.abacus.metrics.port }} volumes: - name: config-env-vars configMap: name: {{ include "abacus-agent.fullname" . }}-validator - name: secret-env-vars secret: secretName: {{ include "abacus-agent.fullname" . }}-validator-secret {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} volumeClaimTemplates: - metadata: name: state spec: storageClassName: {{ .Values.storage.storageClass }} accessModes: [ {{ .Values.storage.accessModes }} ] {{- if .Values.abacus.validator.storage.snapshot.enabled }} dataSource: name: {{ .Values.abacus.validator.storage.snapshot.name }} kind: VolumeSnapshot apiGroup: snapshot.storage.k8s.io {{- end }} resources: requests: storage: {{ .Values.abacus.validator.storage.size }} {{- end }}