Skip to content

Commit

Permalink
Add v3-monitor chart (#441)
Browse files Browse the repository at this point in the history
  • Loading branch information
antares-sw authored Sep 12, 2023
1 parent 1b1bc6c commit c8b83aa
Show file tree
Hide file tree
Showing 7 changed files with 306 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/v3-monitor/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions charts/v3-monitor/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: common
repository: https://charts.stakewise.io/
version: 1.0.0
digest: sha256:a52d823dcd535c64eafc9df56fe41455c602032e084b8adcaa34e536451d2ab2
generated: "2023-09-08T15:44:35.203134+04:00"
29 changes: 29 additions & 0 deletions charts/v3-monitor/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: v2
name: v3-monitor
description: This service continually monitors validator attestations on the Ethereum 2.0 network. If a validator misses its attestation, an alert is promptly sent out through a notifier provider such as Telegram, Discord, Slack, PagerDuty, or Pushover.

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: 'v0.0.1'

dependencies:
- name: common
repository: https://charts.stakewise.io/
version: 1.x.x
34 changes: 34 additions & 0 deletions charts/v3-monitor/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" . }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
data:
DB_URL: "sqlite+aiosqlite:////data/monitor.db"
NETWORK: {{ .Values.settings.network | quote }}
FRONTEND_URL: {{ .Values.settings.frontendUrl | quote }}
{{- if .Values.settings.vaultAddress }}
VAULT_ADDRESS: {{ .Values.settings.vaultAddress | quote }}
{{- end }}
EXECUTION_ENDPOINTS: {{ .Values.settings.executionEndpoints | quote }}
CONSENSUS_ENDPOINTS: {{ .Values.settings.consensusEndpoints | quote }}
NOTIFIERS_ENABLED_PROVIDER: {{ .Values.settings.notifiersEnabledProvider | quote }}
NOTIFIERS_INTERVAL_IN_MINUTES: {{ .Values.settings.notifiersIntervalInMinutes | quote }}
{{- if or (.Values.settings.notifiersTelegramToken) (.Values.settings.notifiersTelegramChatID) }}
NOTIFIERS_TELEGRAM_TOKEN: {{ .Values.settings.notifiersTelegramToken | quote }}
NOTIFIERS_TELEGRAM_CHAT_ID: {{ .Values.settings.notifiersTelegramChatID | quote }}
{{- end }}
{{- if .Values.settings.notifiersSlackWebhookURL }}
NOTIFIERS_SLACK_WEBHOOK_URL: {{ .Values.settings.notifiersSlackWebhookURL | quote }}
{{- end }}
{{- if .Values.settings.notifiersDiscordWebhookURL }}
NOTIFIERS_DISCORD_WEBHOOK_URL: {{ .Values.settings.notifiersDiscordWebhookURL | quote }}
{{- end }}
{{- if .Values.settings.notifiersPagerdutyRoutingKey }}
NOTIFIERS_PAGERDUTY_ROUTING_KEY: {{ .Values.settings.notifiersPagerdutyRoutingKey | quote }}
{{- end }}
{{- if or (.Values.settings.notifiersPushoverToken) (.Values.settings.notifiersPushoverUser) }}
NOTIFIERS_PUSHOVER_TOKEN: {{ .Values.settings.notifiersPushoverToken | quote }}
NOTIFIERS_PUSHOVER_USER: {{ .Values.settings.notifiersPushoverUser | quote }}
{{- end }}
8 changes: 8 additions & 0 deletions charts/v3-monitor/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{- if or .Values.global.serviceAccount.create .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "common.names.fullname" . }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
{{- end }}
81 changes: 81 additions & 0 deletions charts/v3-monitor/templates/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
kind: StatefulSet
apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
metadata:
name: {{ include "common.names.fullname" . }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "common.labels.matchLabels" . | nindent 6 }}
serviceName: {{ include "common.names.fullname" . }}
template:
metadata:
labels:
{{- include "common.labels.matchLabels" . | nindent 8 }}
annotations:
checksum/v3-monitor-configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
spec:
{{- if .Values.tolerations }}
tolerations:
{{ tpl .Values.tolerations . | nindent 8 | trim }}
{{- end }}
{{- if .Values.affinity }}
affinity:
{{ tpl .Values.affinity . | nindent 8 | trim }}
{{- end }}
{{- with .Values.securityContext }}
securityContext:
{{ toYaml . | nindent 8 | trim }}
{{- end }}
serviceAccountName: {{ include "common.names.fullname" . }}
priorityClassName: {{ .Values.priorityClassName | quote }}
{{- if .Values.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- end }}
{{- with .Values.image.pullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if and .Values.persistence.enabled .Values.initChownData }}
initContainers:
- name: init-chown
image: "{{ .Values.initImage.registry }}/{{ .Values.initImage.repository }}:{{ .Values.initImage.tag }}"
imagePullPolicy: {{ .Values.initImage.pullPolicy }}
securityContext:
runAsUser: 0
command:
- sh
- -c
- >
chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.runAsUser }} /data
volumeMounts:
- name: data
mountPath: /data
{{- end }}
containers:
- name: v3-monitor
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ include "common.names.fullname" . }}
volumeMounts:
- name: data
mountPath: /data
{{- with .Values.resources }}
resources:
{{ toYaml . | nindent 12 | trim }}
{{- end }}
volumeClaimTemplates:
- metadata:
name: data
labels:
{{- include "common.labels.standard" . | nindent 10 }}
spec:
accessModes: {{ .Values.persistence.accessModes }}
storageClassName: {{ .Values.persistence.storageClassName }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
125 changes: 125 additions & 0 deletions charts/v3-monitor/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Default values for v3-monitor.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

global:
serviceAccount:
create: true

## Pod Security Context
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
##
securityContext:
fsGroup: 1001
runAsUser: 1001

## Init image is used to chown data volume, initialise genesis, etc.
##
initImage:
registry: 'docker.io'
repository: 'busybox'
tag: '1.34'
pullPolicy: IfNotPresent

fullnameOverride: ''

## Termination Grace Period
## ref: https://kubernetes.io/docs/tasks/run-application/force-delete-stateful-set-pod/#delete-pods
##
terminationGracePeriodSeconds: 10

## Affinity Settings
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
##
affinity: {}

## Toleration Settings
## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/
##
tolerations: []

serviceAccount:
## Annotations to add to the service account
##
annotations: {}
## The name of the service account to use.
## If not set and create is true, a name is generated using the fullname template
##
name: ''

## Docker image
##
image:
registry: 'europe-west4-docker.pkg.dev'
repository: 'stakewiselabs/public/v3-monitor'
tag: 'main'
pullPolicy: IfNotPresent
pullSecrets: []

## Configure resource requests and limits.
## http://kubernetes.io/docs/user-guide/compute-resources/
##
resources:
requests:
cpu: 10m
memory: 200Mi

## Used to assign priority to pod
## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
##
priorityClassName: ''

settings:
## The network of the Vault. Choices are: mainnet, gnosis, goerli
## Default value will be taken from vault config
network: 'goerli'

frontendUrl: 'https://pacific.stakewise.io'

## Address of the Vault
vaultAddress: ''

# Comma separated list of endpoints for the execution node
executionEndpoints: ''
# Comma separated list of endpoints for the consensus node
consensusEndpoints: ''

# Notifiers settings
# options: telegram, discord, slack, pagerduty, pushover
notifiersEnabledProvider: ""
notifiersIntervalInMinutes: "30" # Can be increased to reduce spam from alerts when validators down

# Telegram notifier settings
notifiersTelegramToken: ""
notifiersTelegramChatID: ""

# Slack notifier settings
notifiersSlackWebhookURL: ""

# Discord notifier settings
# Note that URL must end with /slack
# Example: https://discord.com/api/webhooks/{webhook.id}/{webhook.token}/slack
notifiersDiscordWebhookURL: ""

# Pagerduty notifier settings
notifiersPagerdutyRoutingKey: ""

# Pushover notifier settings
notifiersPushoverToken: ""
notifiersPushoverUser: ""


## If false, data ownership will not be reset at startup
## This allows the geth node to be run with an arbitrary user
##
initChownData: true

## Whether or not to allocate persistent volume disk for the data directory.
## In case of node failure, the node data directory will still persist.
##
persistence:
enabled: true
storageClassName: ''
accessModes:
- ReadWriteOnce
size: 10Gi

0 comments on commit c8b83aa

Please sign in to comment.