{{- if .Values.validators.enabled }} apiVersion: apps/v1 kind: StatefulSet metadata: name: {{ include "besu-network.fullname" . }}-validator namespace: {{ .Values.global.namespace }} labels: {{- include "besu-network.labels" . | nindent 4 }} component: validator spec: serviceName: {{ include "besu-network.fullname" . }}-validator replicas: {{ .Values.validators.replicas }} selector: matchLabels: {{- include "besu-network.selectorLabels" . | nindent 6 }} component: validator template: metadata: labels: {{- include "besu-network.selectorLabels" . | nindent 8 }} component: validator spec: {{- with .Values.validators.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.validators.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: labelSelector: matchExpressions: - key: component operator: In values: - validator topologyKey: topology.kubernetes.io/zone initContainers: - name: config-init image: busybox:1.36 command: - sh - -c - | cp /config-source/* /config-dest/ chmod -R 644 /config-dest/* volumeMounts: - name: config-source mountPath: /config-source - name: config-dest mountPath: /config-dest resources: requests: cpu: "10m" memory: "32Mi" limits: cpu: "100m" memory: "64Mi" containers: - name: besu image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.tag }}" imagePullPolicy: {{ .Values.global.image.pullPolicy }} command: - /opt/besu/bin/besu - --config-file=/config/besu-config.toml ports: - name: p2p containerPort: {{ .Values.validators.config.p2pPort }} protocol: TCP - name: p2p-udp containerPort: {{ .Values.validators.config.p2pPort }} protocol: UDP - name: metrics containerPort: {{ .Values.validators.config.metricsPort }} protocol: TCP env: - name: JAVA_OPTS value: "-Xmx4g -Xms4g" resources: {{- toYaml .Values.validators.resources | nindent 12 }} volumeMounts: - name: data mountPath: /data - name: config mountPath: /config - name: keys mountPath: /keys readOnly: true livenessProbe: httpGet: path: /liveness port: metrics initialDelaySeconds: 60 periodSeconds: 30 readinessProbe: httpGet: path: /readiness port: metrics initialDelaySeconds: 30 periodSeconds: 10 volumes: - name: config-source configMap: name: {{ include "besu-network.fullname" . }}-validator-config - name: keys secret: secretName: {{ .Values.secrets.validatorKeys.secretName }} volumeClaimTemplates: - metadata: name: data spec: accessModes: - ReadWriteOnce storageClassName: {{ .Values.validators.storage.storageClass }} resources: requests: storage: {{ .Values.validators.storage.size }} --- apiVersion: v1 kind: Service metadata: name: {{ include "besu-network.fullname" . }}-validator namespace: {{ .Values.global.namespace }} labels: {{- include "besu-network.labels" . | nindent 4 }} component: validator spec: type: {{ .Values.service.validators.type }} {{- if eq .Values.service.validators.type "ClusterIP" }} clusterIP: None {{- end }} ports: - name: p2p port: {{ .Values.validators.config.p2pPort }} targetPort: p2p protocol: TCP - name: p2p-udp port: {{ .Values.validators.config.p2pPort }} targetPort: p2p-udp protocol: UDP - name: metrics port: {{ .Values.validators.config.metricsPort }} targetPort: metrics protocol: TCP selector: {{- include "besu-network.selectorLabels" . | nindent 4 }} component: validator --- {{- if .Values.pdb.validators }} apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: {{ include "besu-network.fullname" . }}-validator-pdb namespace: {{ .Values.global.namespace }} spec: minAvailable: {{ .Values.pdb.validators.minAvailable }} selector: matchLabels: {{- include "besu-network.selectorLabels" . | nindent 6 }} component: validator {{- end }} {{- end }}