diff --git a/charts/armiarma/.helmignore b/charts/armiarma/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/charts/armiarma/.helmignore @@ -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/ diff --git a/charts/armiarma/Chart.lock b/charts/armiarma/Chart.lock new file mode 100644 index 00000000..e4575e1e --- /dev/null +++ b/charts/armiarma/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 13.2.23 +digest: sha256:29f892fc9caea67e8d827f6e81cb2783de11c282832e07cabbc04fb429971184 +generated: "2023-12-05T10:41:26.555587+10:00" diff --git a/charts/armiarma/Chart.yaml b/charts/armiarma/Chart.yaml new file mode 100644 index 00000000..35cb1769 --- /dev/null +++ b/charts/armiarma/Chart.yaml @@ -0,0 +1,14 @@ +apiVersion: v2 +name: armiarma +description: A distributed p2p network monitoring tool +home: https://github.com/migalabs/armiarma +type: application +version: 0.1.0 +maintainers: + - name: samcm + email: sam.calder-mason@ethereum.org +dependencies: +- name: postgresql + version: 13.2.23 + repository: "https://charts.bitnami.com/bitnami" + condition: postgresql.enabled diff --git a/charts/armiarma/README.md b/charts/armiarma/README.md new file mode 100644 index 00000000..ffded5cd --- /dev/null +++ b/charts/armiarma/README.md @@ -0,0 +1,70 @@ + +# armiarma + +![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) + +A distributed p2p network monitoring tool + +**Homepage:** + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | postgresql | 13.2.23 | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | Affinity configuration for pods | +| annotations | object | `{}` | Annotations for the StatefulSet | +| containerSecurityContext | object | See `values.yaml` | The security context for containers | +| customArgs | list | `["eth2","--persist-connevents=false","--persist-msgs=false"]` | Custom args for the armiarma container | +| customCommand | list | `[]` | Command replacement for the armiarma container | +| extraContainers | list | `[]` | Additional containers | +| extraEnv | list | `[]` | Additional env variables | +| extraPorts | list | `[]` | Additional ports. Useful when using extraContainers | +| extraVolumeMounts | list | `[]` | Additional volume mounts | +| extraVolumes | list | `[]` | Additional volumes | +| fullnameOverride | string | `""` | Overrides the chart's computed fullname | +| global | object | `{"postgresql":{"auth":{"database":"armiarmadb","password":"postgres","postgresqlPassword":"postgres","user":"postgres"}}}` | Global values | +| image.pullPolicy | string | `"IfNotPresent"` | armiarma container pull policy | +| image.repository | string | `"ethpandaops/armiarma"` | armiarma container image repository | +| image.tag | string | `"master"` | armiarma container image tag | +| imagePullSecrets | list | `[]` | Image pull secrets for Docker images | +| ingress.annotations | object | `{}` | Annotations for Ingress | +| ingress.enabled | bool | `false` | Ingress resource for exposing the SSE port | +| ingress.hosts[0].host | string | `"chart-example.local"` | | +| ingress.hosts[0].paths | list | `[]` | | +| ingress.tls | list | `[]` | Ingress TLS | +| initContainers | list | `[]` | Additional init containers | +| livenessProbe | object | See `values.yaml` | Liveness probe | +| metricsPort | int | `9080` | Metrics port | +| nameOverride | string | `""` | Overrides the chart's name | +| nodeSelector | object | `{}` | Node selector for pods | +| p2pNodePort.enabled | bool | `false` | Expose P2P port via NodePort | +| p2pNodePort.initContainer.image.pullPolicy | string | `"IfNotPresent"` | Container pull policy | +| p2pNodePort.initContainer.image.repository | string | `"lachlanevenson/k8s-kubectl"` | Container image to fetch nodeport information | +| p2pNodePort.initContainer.image.tag | string | `"v1.21.3"` | Container tag | +| p2pNodePort.port | int | `31000` | NodePort to be used | +| podAnnotations | object | `{}` | Pod annotations | +| podDisruptionBudget | object | `{}` | Define the PodDisruptionBudget spec If not set then a PodDisruptionBudget will not be created | +| podLabels | object | `{}` | Pod labels | +| podManagementPolicy | string | `"OrderedReady"` | Pod management policy | +| postgresql | object | `{"enabled":true,"image":{"repository":"bitnami/postgresql","tag":"14-debian-11"},"nameOverride":"postgresql","postgresqlDatabase":"armiarmadb","postgresqlPassword":"postgres","postgresqlUsername":"postgres","primary":{"persistence":{"enabled":true,"size":"8Gi"}}}` | Postgresql subchart configuration | +| priorityClassName | string | `nil` | Pod priority class | +| readinessProbe | object | See `values.yaml` | Readiness probe | +| resources | object | `{}` | Resource requests and limits | +| secretEnv | object | `{"ARMIARMA_BACKUP_INTERVAL":"12h","ARMIARMA_FORK_DIGEST":"0x4a26c58b","ARMIARMA_GOSSIP_TOPICS":"beacon_block","ARMIARMA_LOG_LEVEL":"info","ARMIARMA_PSQL":"postgres://{{ $.Values.global.postgresql.auth.user }}:{{ $.Values.global.postgresql.auth.password }}@{{ include \"armiarma.fullname\" $ }}-postgresql:5432/{{ $.Values.global.postgresql.auth.database }}","ARMIARMA_SUBNETS":"all"}` | Env variables injected via a created secret | +| securityContext | object | See `values.yaml` | The security context for pods | +| service.type | string | `"ClusterIP"` | Service type | +| serviceAccount.annotations | object | `{}` | Annotations to add to the service account | +| serviceAccount.create | bool | `true` | Specifies whether a service account should be created | +| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | +| ssePort | int | `9099` | SSE port | +| terminationGracePeriodSeconds | int | `30` | How long to wait until the pod is forcefully terminated | +| tolerations | list | `[]` | Tolerations for pods | +| topologySpreadConstraints | list | `[]` | Topology Spread Constraints for pods | +| updateStrategy | object | `{"type":"RollingUpdate"}` | Update stategy for the Statefulset | +| updateStrategy.type | string | `"RollingUpdate"` | Update stategy type | diff --git a/charts/armiarma/README.md.gotmpl b/charts/armiarma/README.md.gotmpl new file mode 100644 index 00000000..54549956 --- /dev/null +++ b/charts/armiarma/README.md.gotmpl @@ -0,0 +1,15 @@ + +{{ template "chart.header" . }} +{{ template "chart.deprecationWarning" . }} + +{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }} + +{{ template "chart.description" . }} + +{{ template "chart.homepageLine" . }} + +{{ template "chart.sourcesSection" . }} + +{{ template "chart.requirementsSection" . }} + +{{ template "chart.valuesSection" . }} diff --git a/charts/armiarma/ci/default-values.yaml b/charts/armiarma/ci/default-values.yaml new file mode 100644 index 00000000..a9c2ad8b --- /dev/null +++ b/charts/armiarma/ci/default-values.yaml @@ -0,0 +1,8 @@ +secretEnv: + HCAPTCHA_SECRET: "your_hcaptcha_secret" + HCAPTCHA_SITEKEY: "your_hcaptcha_site_key" + APP_ETHKEY: "6c9bd4919736ead6bdeb0441cd8124c16e45a881aef5d11de24be12ee9ecafe3" + APP_AMOUNT: "1000000000000000000" # 1 ETH + APP_CHAINS: "5" + #APP_IMAGEURL: + APP_TITLE: "%CHAINNAME armiarma" diff --git a/charts/armiarma/templates/NOTES.txt b/charts/armiarma/templates/NOTES.txt new file mode 100644 index 00000000..fd1a5b42 --- /dev/null +++ b/charts/armiarma/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "armiarma.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "armiarma.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "armiarma.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ include "armiarma.httpPort" . }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "armiarma.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/charts/armiarma/templates/_helpers.tpl b/charts/armiarma/templates/_helpers.tpl new file mode 100644 index 00000000..d1eeda5e --- /dev/null +++ b/charts/armiarma/templates/_helpers.tpl @@ -0,0 +1,83 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "armiarma.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "armiarma.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "armiarma.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "armiarma.labels" -}} +helm.sh/chart: {{ include "armiarma.chart" . }} +{{ include "armiarma.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "armiarma.selectorLabels" -}} +app.kubernetes.io/name: {{ include "armiarma.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "armiarma.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "armiarma.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{- define "armiarma.metricsPort" -}} +{{ .Values.metricsPort }} +{{- end -}} + +{{- define "armiarma.ssePort" -}} +{{ .Values.ssePort }} +{{- end -}} + +{{- define "armiarma.secretEnv" -}} +ARMIARMA_PORT: {{ tpl (.Values.p2pNodePort.port | toString) . | b64enc }} +ARMIARMA_METRICS_PORT: {{ tpl (.Values.metricsPort | toString) . | b64enc }} +ARMIARMA_SSE_PORT: {{ tpl (.Values.ssePort | toString) . | b64enc }} +{{- range $key, $value := .Values.secretEnv }} +{{ $key }}: {{ tpl (toString ($value | toYaml)) $ | b64enc }} +{{- end -}} +{{- end -}} + +{{- define "armiarma.p2pPort" -}} +{{- print .Values.p2pNodePort.port }} +{{- end -}} diff --git a/charts/armiarma/templates/ingress.yaml b/charts/armiarma/templates/ingress.yaml new file mode 100644 index 00000000..2b8bb401 --- /dev/null +++ b/charts/armiarma/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "armiarma.fullname" . -}} +{{- $svcPort := include "armiarma.ssePort" . -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "armiarma.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/armiarma/templates/secret.yaml b/charts/armiarma/templates/secret.yaml new file mode 100644 index 00000000..897d006e --- /dev/null +++ b/charts/armiarma/templates/secret.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "armiarma.fullname" . }}-env + labels: + {{- include "armiarma.labels" . | nindent 4 }} +data: +{{- include "armiarma.secretEnv" . | nindent 2 }} diff --git a/charts/armiarma/templates/service-headless.yaml b/charts/armiarma/templates/service-headless.yaml new file mode 100644 index 00000000..f602b5e3 --- /dev/null +++ b/charts/armiarma/templates/service-headless.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "armiarma.fullname" . }}-headless + labels: + {{- include "armiarma.labels" . | nindent 4 }} +spec: + clusterIP: None + ports: + - port: {{ include "armiarma.metricsPort" . }} + targetPort: metrics + protocol: TCP + name: metrics + - port: {{ include "armiarma.ssePort" . }} + targetPort: sse + protocol: TCP + name: sse + {{- if .Values.extraPorts }} + {{ toYaml .Values.extraPorts | nindent 4}} + {{- end }} + selector: + {{- include "armiarma.selectorLabels" . | nindent 4 }} diff --git a/charts/armiarma/templates/service.p2p.nodeport.yaml b/charts/armiarma/templates/service.p2p.nodeport.yaml new file mode 100644 index 00000000..87523873 --- /dev/null +++ b/charts/armiarma/templates/service.p2p.nodeport.yaml @@ -0,0 +1,28 @@ +{{- if .Values.p2pNodePort.enabled -}} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "armiarma.fullname" $ }}-p2p-0 + labels: + {{- include "armiarma.labels" $ | nindent 4 }} + pod: {{ include "armiarma.fullname" $ }}-0 + type: p2p +spec: + type: NodePort + externalTrafficPolicy: Local + ports: + - name: p2p-tcp + port: {{ include "armiarma.p2pPort" $ }} + protocol: TCP + targetPort: p2p-tcp + nodePort: {{ include "armiarma.p2pPort" $ }} + - name: p2p-udp + port: {{ include "armiarma.p2pPort" $ }} + protocol: UDP + targetPort: p2p-udp + nodePort: {{ include "armiarma.p2pPort" $ }} + selector: + {{- include "armiarma.selectorLabels" $ | nindent 4 }} + statefulset.kubernetes.io/pod-name: "{{ include "armiarma.fullname" $ }}-0" +{{- end }} diff --git a/charts/armiarma/templates/service.yaml b/charts/armiarma/templates/service.yaml new file mode 100644 index 00000000..d5c44e06 --- /dev/null +++ b/charts/armiarma/templates/service.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "armiarma.fullname" . }} + labels: + {{- include "armiarma.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ include "armiarma.metricsPort" . }} + targetPort: metrics + protocol: TCP + name: metrics + - port: {{ include "armiarma.ssePort" . }} + targetPort: sse + protocol: TCP + name: sse + {{- if .Values.extraPorts }} + {{ toYaml .Values.extraPorts | nindent 4}} + {{- end }} + selector: + {{- include "armiarma.selectorLabels" . | nindent 4 }} diff --git a/charts/armiarma/templates/serviceaccount.yaml b/charts/armiarma/templates/serviceaccount.yaml new file mode 100644 index 00000000..d809783d --- /dev/null +++ b/charts/armiarma/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "armiarma.serviceAccountName" . }} + labels: + {{- include "armiarma.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/charts/armiarma/templates/statefulset.yaml b/charts/armiarma/templates/statefulset.yaml new file mode 100644 index 00000000..d3198e66 --- /dev/null +++ b/charts/armiarma/templates/statefulset.yaml @@ -0,0 +1,148 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "armiarma.fullname" . }} + labels: + {{- include "armiarma.labels" . | nindent 4 }} + annotations: + {{- toYaml .Values.annotations | nindent 4 }} +spec: + podManagementPolicy: {{ .Values.podManagementPolicy }} + replicas: 1 + selector: + matchLabels: + {{- include "armiarma.selectorLabels" . | nindent 6 }} + serviceName: {{ include "armiarma.fullname" . }}-headless + updateStrategy: + {{- toYaml .Values.updateStrategy | nindent 4 }} + template: + metadata: + labels: + {{- include "armiarma.selectorLabels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + annotations: + checksum/secrets: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "armiarma.serviceAccountName" . }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} + {{- end }} + securityContext: + {{- toYaml .Values.securityContext | nindent 8 }} + initContainers: + {{- if .Values.initContainers }} + {{- toYaml .Values.initContainers | nindent 8 }} + {{- end }} + {{- if .Values.p2pNodePort.enabled }} + - name: init-nodeport + image: "{{ .Values.p2pNodePort.initContainer.image.repository }}:{{ .Values.p2pNodePort.initContainer.image.tag }}" + imagePullPolicy: {{.Values.p2pNodePort.initContainer.image.pullPolicy }} + securityContext: + runAsNonRoot: false + runAsUser: 0 + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + command: + - sh + - -c + - > + export EXTERNAL_PORT=$(kubectl get services -l "pod in (${POD_NAME}), type in (p2p)" -o jsonpath='{.items[0].spec.ports[0].nodePort}'); + export EXTERNAL_IP=$(kubectl get nodes "${NODE_NAME}" -o jsonpath='{.status.addresses[?(@.type=="ExternalIP")].address}'); + echo "EXTERNAL_PORT=$EXTERNAL_PORT" > /env/init-nodeport; + echo "EXTERNAL_IP=$EXTERNAL_IP" >> /env/init-nodeport; + cat /env/init-nodeport; + volumeMounts: + - name: env-nodeport + mountPath: /env + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if gt (len .Values.customCommand) 0 }} + command: + {{- toYaml .Values.customCommand | nindent 12}} + {{- end }} + {{- if gt (len .Values.customArgs) 0 }} + args: + {{- toYaml .Values.customArgs | nindent 12}} + {{- end }} + securityContext: + {{- toYaml .Values.containerSecurityContext | nindent 12 }} + volumeMounts: + - name: config + mountPath: "/config" + {{- if .Values.p2pNodePort.enabled }} + - name: env-nodeport + mountPath: /env + {{- end }} + {{- if .Values.extraVolumeMounts }} + {{ toYaml .Values.extraVolumeMounts | nindent 12}} + {{- end }} + ports: + - name: metrics + containerPort: {{ include "armiarma.metricsPort" . }} + protocol: TCP + - name: sse + containerPort: {{ include "armiarma.ssePort" . }} + protocol: TCP + {{- if .Values.p2pNodePort.enabled }} + - name: p2p-tcp + containerPort: {{ include "armiarma.p2pPort" . }} + protocol: TCP + - name: p2p-udp + containerPort: {{ include "armiarma.p2pPort" . }} + protocol: UDP + {{- end }} + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + envFrom: + - secretRef: + name: {{ include "armiarma.fullname" $ }}-env + + {{- if .Values.extraEnv }} + env: + {{- toYaml .Values.extraEnv | nindent 12 }} + {{- end }} + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 8}} + {{- end }} + nodeSelector: + {{- toYaml .Values.nodeSelector | nindent 8 }} + affinity: + {{- toYaml .Values.affinity | nindent 8 }} + tolerations: + {{- toYaml .Values.tolerations | nindent 8 }} + topologySpreadConstraints: + {{- toYaml .Values.topologySpreadConstraints | nindent 8 }} + terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} + volumes: + - name: config + emptyDir: {} + {{- if .Values.p2pNodePort.enabled }} + - name: env-nodeport + emptyDir: {} + {{- end }} + {{- if .Values.extraVolumes }} + {{ toYaml .Values.extraVolumes | nindent 8}} + {{- end }} diff --git a/charts/armiarma/values.yaml b/charts/armiarma/values.yaml new file mode 100644 index 00000000..8403407b --- /dev/null +++ b/charts/armiarma/values.yaml @@ -0,0 +1,220 @@ +# -- Global values +global: + postgresql: + auth: + postgresqlPassword: postgres + user: postgres + password: postgres + database: armiarmadb + +# -- Overrides the chart's name +nameOverride: "" + +# -- Overrides the chart's computed fullname +fullnameOverride: "" + +image: + # -- armiarma container image repository + repository: ethpandaops/armiarma + # -- armiarma container image tag + tag: master + # -- armiarma container pull policy + pullPolicy: IfNotPresent + +# -- Custom args for the armiarma container +customArgs: + - eth2 + - --persist-connevents=false + - --persist-msgs=false + +# -- Command replacement for the armiarma container +customCommand: [] + +# -- Env variables injected via a created secret +secretEnv: + ARMIARMA_LOG_LEVEL: "info" + ARMIARMA_PSQL: "postgres://{{ $.Values.global.postgresql.auth.user }}:{{ $.Values.global.postgresql.auth.password }}@{{ include \"armiarma.fullname\" $ }}-postgresql:5432/{{ $.Values.global.postgresql.auth.database }}" + ARMIARMA_BACKUP_INTERVAL: "12h" + ARMIARMA_FORK_DIGEST: "0x4a26c58b" + ARMIARMA_GOSSIP_TOPICS: "beacon_block" + ARMIARMA_SUBNETS: "all" + +# When p2pNodePort is enabled, your P2P port will be exposed via service type NodePort. +# This will generate a service for each replica, with a port binding via NodePort. +# This is useful if you want to expose and announce your node to the Internet. +p2pNodePort: + # -- Expose P2P port via NodePort + enabled: false + # -- NodePort to be used + port: 31000 + initContainer: + image: + # -- Container image to fetch nodeport information + repository: lachlanevenson/k8s-kubectl + # -- Container tag + tag: v1.21.3 + # -- Container pull policy + pullPolicy: IfNotPresent + +# -- Metrics port +metricsPort: 9080 + +# -- SSE port +ssePort: 9099 + +ingress: + # -- Ingress resource for exposing the SSE port + enabled: false + # -- Annotations for Ingress + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + # -- Ingress host + hosts: + - host: chart-example.local + paths: [] + # -- Ingress TLS + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +service: + # -- Service type + type: ClusterIP + +# -- Affinity configuration for pods +affinity: {} + +# -- Image pull secrets for Docker images +imagePullSecrets: [] + +# -- Annotations for the StatefulSet +annotations: {} + +# -- Liveness probe +# @default -- See `values.yaml` +livenessProbe: + tcpSocket: + port: metrics + initialDelaySeconds: 60 + periodSeconds: 120 + +# -- Readiness probe +# @default -- See `values.yaml` +readinessProbe: + tcpSocket: + port: metrics + initialDelaySeconds: 10 + periodSeconds: 10 + +# -- Node selector for pods +nodeSelector: {} + +# -- Pod labels +podLabels: {} + +# -- Pod annotations +podAnnotations: {} + +# -- Pod management policy +podManagementPolicy: OrderedReady + +# -- Pod priority class +priorityClassName: null + +# -- Resource requests and limits +resources: {} +# limits: +# cpu: 500m +# memory: 2Gi +# requests: +# cpu: 300m +# memory: 1Gi + +# -- The security context for pods +# @default -- See `values.yaml` +securityContext: + fsGroup: 10001 + runAsGroup: 10001 + runAsNonRoot: true + runAsUser: 10001 + +# -- The security context for containers +# @default -- See `values.yaml` +containerSecurityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + + +serviceAccount: + # -- Specifies whether a service account should be created + create: true + # -- 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: "" + +# -- How long to wait until the pod is forcefully terminated +terminationGracePeriodSeconds: 30 + +# -- Tolerations for pods +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +tolerations: [] + +# -- Topology Spread Constraints for pods +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/ +topologySpreadConstraints: [] + +# -- Define the PodDisruptionBudget spec +# If not set then a PodDisruptionBudget will not be created +podDisruptionBudget: {} +# minAvailable: 1 +# maxUnavailable: 1 + +# -- Update stategy for the Statefulset +updateStrategy: + # -- Update stategy type + type: RollingUpdate + +# -- Additional init containers +initContainers: [] +# - name: my-init-container +# image: busybox:latest +# command: ['sh', '-c', 'echo hello'] + +# -- Additional containers +extraContainers: [] + +# -- Additional volumes +extraVolumes: [] + +# -- Additional volume mounts +extraVolumeMounts: [] + +# -- Additional ports. Useful when using extraContainers +extraPorts: [] + +# -- Additional env variables +extraEnv: [] + +# -- Postgresql subchart configuration +postgresql: + enabled: true + nameOverride: "postgresql" + image: + repository: bitnami/postgresql + tag: 14-debian-11 + + primary: + persistence: + enabled: true + size: 8Gi + postgresqlDatabase: armiarmadb + postgresqlUsername: postgres + postgresqlPassword: postgres