diff --git a/infrastructure/charts/mev-commit-validator-monitoring/Chart.yaml b/infrastructure/charts/mev-commit-validator-monitoring/Chart.yaml new file mode 100644 index 000000000..18098622d --- /dev/null +++ b/infrastructure/charts/mev-commit-validator-monitoring/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: mev-commit-validator-monitoring +description: A Helm chart for deploying mev-commit-validator-monitoring service +type: application +version: 0.1.0 +appVersion: "1.0.0" diff --git a/infrastructure/charts/mev-commit-validator-monitoring/templates/_helpers.tpl b/infrastructure/charts/mev-commit-validator-monitoring/templates/_helpers.tpl new file mode 100644 index 000000000..f453f11da --- /dev/null +++ b/infrastructure/charts/mev-commit-validator-monitoring/templates/_helpers.tpl @@ -0,0 +1,68 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "mev-commit-validator-monitor.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +*/}} +{{- define "mev-commit-validator-monitor.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "mev-commit-validator-monitor.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "mev-commit-validator-monitor.labels" -}} +helm.sh/chart: {{ include "mev-commit-validator-monitor.chart" . }} +{{ include "mev-commit-validator-monitor.selectorLabels" . }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- if .Values.commonLabels }} +{{ toYaml .Values.commonLabels }} +{{- end }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "mev-commit-validator-monitor.selectorLabels" -}} +app.kubernetes.io/name: {{ include "mev-commit-validator-monitor.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app: {{ include "mev-commit-validator-monitor.name" . }} +{{- end }} + +{{/* +Create the name of the database secret to use +*/}} +{{- define "mev-commit-validator-monitor.dbSecretName" -}} +{{- if .Values.database.credentials.existingSecret }} +{{- .Values.database.credentials.existingSecret }} +{{- else }} +{{- printf "%s-db-credentials" (include "mev-commit-validator-monitor.fullname" .) }} +{{- end }} +{{- end }} + +{{/* +Create the name of the slack secret to use +*/}} +{{- define "mev-commit-validator-monitor.slackSecretName" -}} +{{- if .Values.notifications.slack.existingSecret }} +{{- .Values.notifications.slack.existingSecret }} +{{- else }} +{{- printf "%s-slack-webhook" (include "mev-commit-validator-monitor.fullname" .) }} +{{- end }} +{{- end }} diff --git a/infrastructure/charts/mev-commit-validator-monitoring/templates/configmap.yaml b/infrastructure/charts/mev-commit-validator-monitoring/templates/configmap.yaml new file mode 100644 index 000000000..a081e908d --- /dev/null +++ b/infrastructure/charts/mev-commit-validator-monitoring/templates/configmap.yaml @@ -0,0 +1,29 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "mev-commit-validator-monitor.fullname" . }}-config + namespace: {{ .Values.namespace | default "default" }} + labels: + {{- include "mev-commit-validator-monitor.labels" . | nindent 4 }} + {{- with .Values.commonAnnotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +data: + DB_ENABLED: {{ .Values.database.enabled | quote }} + DB_HOST: {{ .Values.database.host | quote }} + DB_PORT: {{ .Values.database.port | quote }} + DB_NAME: {{ .Values.database.name | quote }} + DB_SSLMODE: {{ .Values.database.sslMode | quote }} + BEACON_API_URL: {{ .Values.ethereum.beaconApiUrl | quote }} + ETHEREUM_RPC_URL: {{ .Values.ethereum.rpcUrl | quote }} + VALIDATOR_OPT_IN_CONTRACT: {{ .Values.ethereum.validatorOptInContract | quote }} + {{- if .Values.relayUrls }} + RELAY_URLS: {{ join "," .Values.relayUrls | quote }} + {{- end }} + DASHBOARD_API_URL: {{ .Values.dashboard.apiUrl | quote }} + LOG_LEVEL: {{ .Values.logging.level | quote }} + LOG_FMT: {{ .Values.logging.format | quote }} + HEALTH_PORT: {{ .Values.monitoring.healthPort | quote }} + LAGGARD_MODE: {{ .Values.monitoring.laggardMode | quote }} + TRACK_MISSED: {{ .Values.monitoring.trackMissed | quote }} diff --git a/infrastructure/charts/mev-commit-validator-monitoring/templates/deployment.yaml b/infrastructure/charts/mev-commit-validator-monitoring/templates/deployment.yaml new file mode 100644 index 000000000..aa180e86e --- /dev/null +++ b/infrastructure/charts/mev-commit-validator-monitoring/templates/deployment.yaml @@ -0,0 +1,60 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "mev-commit-validator-monitor.fullname" . }} + namespace: {{ .Values.namespace | default "default" }} + labels: + {{- include "mev-commit-validator-monitor.labels" . | nindent 4 }} + {{- with .Values.commonAnnotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "mev-commit-validator-monitor.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "mev-commit-validator-monitor.selectorLabels" . | nindent 8 }} + {{- with .Values.commonLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.commonAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: validator-monitor + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: {{ .Values.monitoring.healthPort | int }} + name: health + envFrom: + - configMapRef: + name: {{ include "mev-commit-validator-monitor.fullname" . }}-config + env: + - name: DB_USER + valueFrom: + secretKeyRef: + name: {{ include "mev-commit-validator-monitor.dbSecretName" . }} + key: db-user + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "mev-commit-validator-monitor.dbSecretName" . }} + key: db-password + - name: WEBHOOK_URLS + valueFrom: + secretKeyRef: + name: {{ include "mev-commit-validator-monitor.slackSecretName" . }} + key: webhook-url diff --git a/infrastructure/charts/mev-commit-validator-monitoring/templates/ingress.yaml b/infrastructure/charts/mev-commit-validator-monitoring/templates/ingress.yaml new file mode 100644 index 000000000..e6da5b4d2 --- /dev/null +++ b/infrastructure/charts/mev-commit-validator-monitoring/templates/ingress.yaml @@ -0,0 +1,37 @@ +{{- $ingress := .Values.ingress | default dict }} +{{- if $ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "mev-commit-validator-monitor.fullname" . }} + namespace: {{ $ingress.namespace | default "default" }} + labels: + {{- include "mev-commit-validator-monitor.labels" . | nindent 4 }} + {{- with $ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if $ingress.className }} + ingressClassName: {{ $ingress.className }} + {{- end }} + {{- with $ingress.tls }} + tls: + {{- toYaml . | nindent 4 }} + {{- end }} + rules: + {{- range $ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + pathType: {{ .pathType }} + backend: + service: + name: {{ $ingress.backend.serviceName }} + port: + number: {{ $ingress.backend.servicePort }} + {{- end }} + {{- end }} +{{- end }} diff --git a/infrastructure/charts/mev-commit-validator-monitoring/templates/secret-db.yaml b/infrastructure/charts/mev-commit-validator-monitoring/templates/secret-db.yaml new file mode 100644 index 000000000..1453a9568 --- /dev/null +++ b/infrastructure/charts/mev-commit-validator-monitoring/templates/secret-db.yaml @@ -0,0 +1,13 @@ +{{- if .Values.database.credentials.createSecret }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "mev-commit-validator-monitor.dbSecretName" . }} + namespace: {{ .Values.namespace | default "default" }} + labels: + {{- include "mev-commit-validator-monitor.labels" . | nindent 4 }} +type: Opaque +data: + db-user: {{ .Values.database.credentials.user | b64enc }} + db-password: {{ .Values.database.credentials.password | b64enc }} +{{- end }} diff --git a/infrastructure/charts/mev-commit-validator-monitoring/templates/secret-slack.yaml b/infrastructure/charts/mev-commit-validator-monitoring/templates/secret-slack.yaml new file mode 100644 index 000000000..234c1b100 --- /dev/null +++ b/infrastructure/charts/mev-commit-validator-monitoring/templates/secret-slack.yaml @@ -0,0 +1,12 @@ +{{- if .Values.notifications.slack.createSecret }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "mev-commit-validator-monitor.slackSecretName" . }} + namespace: {{ .Values.namespace | default "default" }} + labels: + {{- include "mev-commit-validator-monitor.labels" . | nindent 4 }} +type: Opaque +data: + webhook-url: {{ .Values.notifications.slack.webhookUrl | b64enc }} +{{- end }} diff --git a/infrastructure/charts/mev-commit-validator-monitoring/templates/service.yaml b/infrastructure/charts/mev-commit-validator-monitoring/templates/service.yaml new file mode 100644 index 000000000..248868d77 --- /dev/null +++ b/infrastructure/charts/mev-commit-validator-monitoring/templates/service.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "mev-commit-validator-monitor.fullname" . }} + namespace: {{ .Values.namespace | default "default" }} + labels: + {{- include "mev-commit-validator-monitor.labels" . | nindent 4 }} + {{- with .Values.commonAnnotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.targetPort }} + protocol: TCP + name: health + selector: + {{- if .Values.service.customSelectors }} + {{- toYaml .Values.service.customSelectors | nindent 4 }} + {{- else }} + {{- include "mev-commit-validator-monitor.selectorLabels" . | nindent 4 }} + {{- end }} diff --git a/infrastructure/charts/mev-commit-validator-monitoring/values.yaml b/infrastructure/charts/mev-commit-validator-monitoring/values.yaml new file mode 100644 index 000000000..9e8d0f2d9 --- /dev/null +++ b/infrastructure/charts/mev-commit-validator-monitoring/values.yaml @@ -0,0 +1,105 @@ +replicaCount: 1 + +image: + repository: + tag: + pullPolicy: Always + +nameOverride: "" +fullnameOverride: "" + +# Namespace to deploy resources +namespace: mev-commit-observability + +# Common labels to apply to all resources +commonLabels: {} + # team: blockchain + # environment: production + +# Common annotations to apply to all resources +commonAnnotations: {} + # prometheus.io/scrape: "true" + # prometheus.io/port: "9090" + +# Node selector for pod assignment +nodeSelector: {} + # disktype: ssd + # kubernetes.io/os: linux + +# Service configuration +service: + type: ClusterIP + port: 9090 + targetPort: 9090 + # Custom selectors for the service (if empty, uses the default selector labels) + customSelectors: {} + # app: mev-commit-validator-monitor + # tier: monitoring + +# Database configuration +database: + enabled: "true" + host: "" + port: "5432" + name: "" + sslMode: "disable" + + # Credentials - these will be stored as secrets + credentials: + createSecret: true # Set to false if you want to use an existing secret + existingSecret: "" # Name of existing secret to use if createSecret is false + user: "" + password: "" + +# Ethereum and Beacon configuration +ethereum: + validatorOptInContract: "" + rpcUrl: "" + beaconApiUrl: "" + +# Relay configuration +relayUrls: + - https://relay1.xyz # please note these are dummy urls + - https://relay2.xyz + + +# Dashboard configuration +dashboard: + apiUrl: "" + +# Monitoring configuration +monitoring: + healthPort: "9090" + laggardMode: "10" + trackMissed: "true" + +# Logging configuration +logging: + level: "info" + format: "json" + +# Notifications +notifications: + slack: + createSecret: true # Set to false if you want to use an existing secret + existingSecret: "" # Name of existing secret to use if createSecret is false + webhookUrl: "https://hooks.slack.com/services/" + +ingress: + enabled: false + namespace: # Ingress in default namespace for CloudFlare secret access + className: + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / + hosts: + - host: + paths: + - path: /health + pathType: Prefix + tls: + - hosts: + - + secretName: + backend: + serviceName: mev-commit-validator-monitoring + servicePort: 9090