diff --git a/.github/workflows/test-charts.yaml b/.github/workflows/test-charts.yaml index e41eb5ca..c6b399c9 100644 --- a/.github/workflows/test-charts.yaml +++ b/.github/workflows/test-charts.yaml @@ -66,4 +66,5 @@ jobs: --excluded-charts beacon-metrics-gazer --excluded-charts tracoor-server --excluded-charts tracoor-agent + --excluded-charts tracoor-single --excluded-charts xatu-cl-mimicry diff --git a/README.md b/README.md index 55e4e751..35a06e10 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,9 @@ Tooling - [`stubbies`](charts/stubbies) - Ethereum execution client stub for consensus layer clients. - [`testnet-faucet`](charts/testnet-faucet) - Web faucet that can be used to distribute testnet ETH to users. - [`testnet-homepage`](charts/testnet-homepage) - Simple website that can be used to display useful information about your testnet. +- [`tracoor-single`](charts/tracoor-single) - An Ethereum beacon data and execution trace explorer in single mode. +- [`tracoor-server`](charts/tracoor-server) - An Ethereum beacon data and execution trace explorer in server mode. +- [`tracoor-agent`](charts/tracoor-agent) - An Ethereum beacon data and execution trace explorer in agent mode. - [`web3signer`](charts/web3signer) - An open-source remote signing service. - [`xatu-discovery`](charts/xatu-discovery) - Ethereum p2p monitoring tool that discovers node records. - [`xatu-mimicry`](charts/xatu-mimicry) - Ethereum p2p monitoring tool that collects data from the execution layer. diff --git a/charts/tracoor-single/.helmignore b/charts/tracoor-single/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/charts/tracoor-single/.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/tracoor-single/Chart.yaml b/charts/tracoor-single/Chart.yaml new file mode 100644 index 00000000..d6f913dd --- /dev/null +++ b/charts/tracoor-single/Chart.yaml @@ -0,0 +1,11 @@ +apiVersion: v2 +name: tracoor-single +description: Ethereum debug data capture and indexer +home: https://github.com/ethpandaops/tracoor +type: application +version: 0.0.1 +maintainers: + - name: samcm + email: sam.calder-mason@ethereum.org + - name: savid + email: andrew.davis@ethereum.org diff --git a/charts/tracoor-single/README.md b/charts/tracoor-single/README.md new file mode 100644 index 00000000..417b1b6f --- /dev/null +++ b/charts/tracoor-single/README.md @@ -0,0 +1,97 @@ + +# tracoor-single + +![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) + +Ethereum debug data capture and indexer + +**Homepage:** + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | Affinity configuration for pods | +| annotations | object | `{}` | Annotations for the Deployment | +| args | list | `[]` | Command arguments | +| autoscaling.enabled | bool | `false` | Autoscaling configuration | +| autoscaling.maxReplicas | int | `3` | Maximum number of replicas | +| autoscaling.minReplicas | int | `2` | Minimum number of replicas | +| autoscaling.targetCPUUtilizationPercentage | int | `85` | Target CPU utilization percentage | +| config.agents[0].ethereum.beacon.nodeAddress | string | `"http://localhost:5052"` | | +| config.agents[0].ethereum.execution.nodeAddress | string | `"http://localhost:8545"` | | +| config.agents[0].ethereum.execution.traceDisableMemory | bool | `true` | | +| config.agents[0].ethereum.execution.traceDisableStack | bool | `true` | | +| config.agents[0].ethereum.execution.traceDisableStorage | bool | `true` | | +| config.agents[0].ethereum.overrideNetworkName | string | `"mainnet"` | | +| config.agents[0].name | string | `"instance-1"` | | +| config.server.addr | string | `":8081"` | | +| config.server.gatewayAddr | string | `":8080"` | | +| config.server.ntpServer | string | `"time.google.com"` | | +| config.server.persistence.driver_name | string | `"sqlite"` | | +| config.server.persistence.dsn | string | `"file:/tmp/tracoor.db"` | | +| config.server.pprofAddr | string | `":6060"` | | +| config.server.preStopSleepSeconds | int | `1` | | +| config.server.services.indexer.retention.beaconBlocks | string | `"30m"` | | +| config.server.services.indexer.retention.beaconStates | string | `"30m"` | | +| config.server.services.indexer.retention.executionBlockTraces | string | `"30m"` | | +| config.shared.indexer.address | string | `"localhost:8081"` | | +| config.shared.logging | string | `"debug"` | | +| config.shared.metricsAddr | string | `":9091"` | | +| config.shared.store.config.base_path | string | `"/tmp/tracoor"` | | +| config.shared.store.type | string | `"fs"` | | +| containerSecurityContext | object | See `values.yaml` | The security context for containers | +| customArgs | list | `[]` | Custom args for the tracoor container | +| customCommand | list | `[]` | Command replacement for the tracoor container | +| extraContainers | list | `[]` | Additional containers | +| extraEnv | list | `[]` | Additional env variables | +| extraPodPorts | list | `[]` | Extra Pod ports | +| 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 | +| image.pullPolicy | string | `"IfNotPresent"` | tracoor container pull policy | +| image.repository | string | `"ethpandaops/tracoor"` | tracoor container image repository | +| image.tag | string | `"latest"` | tracoor container image tag | +| imagePullSecrets | list | `[]` | Image pull secrets for Docker images | +| ingress.grpc.annotations | object | `{}` | Annotations for Ingress | +| ingress.grpc.enabled | bool | `false` | Ingress resource for GRPC | +| ingress.grpc.hosts[0].host | string | `"chart-example.local"` | | +| ingress.grpc.hosts[0].paths | list | `[]` | | +| ingress.grpc.tls | list | `[]` | Ingress TLS | +| ingress.http.annotations | object | `{}` | Annotations for Ingress | +| ingress.http.enabled | bool | `false` | Ingress resource for the HTTP API | +| ingress.http.hosts[0].host | string | `"chart-example.local"` | | +| ingress.http.hosts[0].paths | list | `[]` | | +| ingress.http.tls | list | `[]` | Ingress TLS | +| initContainers | list | `[]` | Additional init containers | +| lifecycle | object | See `values.yaml` | Lifecycle hooks | +| livenessProbe | object | See `values.yaml` | Liveness probe | +| nameOverride | string | `""` | Overrides the chart's name | +| nodeSelector | object | `{}` | Node selector for pods | +| podAnnotations | object | `{}` | Pod annotations | +| podDisruptionBudget | object | `{}` | Define the PodDisruptionBudget spec If not set then a PodDisruptionBudget will not be created | +| podLabels | object | `{}` | Pod labels | +| priorityClassName | string | `nil` | Pod priority class | +| readinessProbe | object | See `values.yaml` | Readiness probe | +| replicas | int | `1` | Number of replicas | +| resources | object | `{}` | Resource requests and limits | +| secretEnv | object | `{}` | Secret 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 | `false` | 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 | +| serviceMonitor.annotations | object | `{}` | Additional ServiceMonitor annotations | +| serviceMonitor.enabled | bool | `false` | If true, a ServiceMonitor CRD is created for a prometheus operator https://github.com/coreos/prometheus-operator | +| serviceMonitor.interval | string | `"15s"` | ServiceMonitor scrape interval | +| serviceMonitor.labels | object | `{}` | Additional ServiceMonitor labels | +| serviceMonitor.namespace | string | `nil` | Alternative namespace for ServiceMonitor | +| serviceMonitor.path | string | `"/metrics"` | Path to scrape | +| serviceMonitor.relabelings | list | `[]` | ServiceMonitor relabelings | +| serviceMonitor.scheme | string | `"http"` | ServiceMonitor scheme | +| serviceMonitor.scrapeTimeout | string | `"30s"` | ServiceMonitor scrape timeout | +| serviceMonitor.tlsConfig | object | `{}` | ServiceMonitor TLS configuration | +| terminationGracePeriodSeconds | int | `90` | How long to wait until the pod is forcefully terminated | +| tolerations | list | `[]` | Tolerations for pods | +| topologySpreadConstraints | list | `[]` | Topology Spread Constraints for pods | diff --git a/charts/tracoor-single/README.md.gotmpl b/charts/tracoor-single/README.md.gotmpl new file mode 100644 index 00000000..54549956 --- /dev/null +++ b/charts/tracoor-single/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/tracoor-single/templates/NOTES.txt b/charts/tracoor-single/templates/NOTES.txt new file mode 100644 index 00000000..41212144 --- /dev/null +++ b/charts/tracoor-single/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 "tracoor-single.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 "tracoor-single.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "tracoor-single.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ include "tracoor-single.httpPort" . }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "tracoor-single.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/tracoor-single/templates/_helpers.tpl b/charts/tracoor-single/templates/_helpers.tpl new file mode 100644 index 00000000..decc8a7a --- /dev/null +++ b/charts/tracoor-single/templates/_helpers.tpl @@ -0,0 +1,80 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "tracoor-single.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 "tracoor-single.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 "tracoor-single.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "tracoor-single.labels" -}} +helm.sh/chart: {{ include "tracoor-single.chart" . }} +{{ include "tracoor-single.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "tracoor-single.selectorLabels" -}} +app.kubernetes.io/name: {{ include "tracoor-single.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "tracoor-single.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "tracoor-single.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{- define "tracoor-single.httpPort" -}} +{{ (split ":" .Values.config.server.gatewayAddr)._1 | default "8080" }} +{{- end }} + +{{- define "tracoor-single.grpcPort" -}} +{{ (split ":" .Values.config.server.addr)._1 | default "8081" }} +{{- end }} + +{{- define "tracoor-single.metricsPort" -}} +{{ (split ":" .Values.config.shared.metricsAddr)._1 | default "9090" }} +{{- end -}} + +{{- define "tracoor-single.pprofPort" -}} +{{- if .Values.config.server.pprofAddr -}} +{{ (split ":" .Values.config.server.pprofAddr)._1 | default "6060" }} +{{- end -}} +{{- end -}} diff --git a/charts/tracoor-single/templates/configmap.yaml b/charts/tracoor-single/templates/configmap.yaml new file mode 100644 index 00000000..8c4c9b34 --- /dev/null +++ b/charts/tracoor-single/templates/configmap.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "tracoor-single.fullname" . }} + labels: + {{- include "tracoor-single.labels" . | nindent 4 }} +data: + config.yaml: |- + {{ toYaml .Values.config | nindent 4 }} diff --git a/charts/tracoor-single/templates/deployment.yaml b/charts/tracoor-single/templates/deployment.yaml new file mode 100644 index 00000000..5aca81d4 --- /dev/null +++ b/charts/tracoor-single/templates/deployment.yaml @@ -0,0 +1,126 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "tracoor-single.fullname" . }} + labels: + {{- include "tracoor-single.labels" . | nindent 4 }} + annotations: + {{- toYaml .Values.annotations | nindent 4 }} +spec: + replicas: {{ .Values.replicas }} + selector: + matchLabels: + {{- include "tracoor-single.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "tracoor-single.selectorLabels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + checksum/secrets: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "tracoor-single.serviceAccountName" . }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} + {{- end }} + securityContext: + {{- toYaml .Values.securityContext | nindent 8 }} + initContainers: + {{- if .Values.initContainers }} + {{- toYaml .Values.initContainers | nindent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: + {{- if gt (len .Values.customCommand) 0 }} + {{- toYaml .Values.customCommand | nindent 12}} + {{- else }} + - "/tracoor" + - "single" + - --config=/config.yaml + {{- if gt (len .Values.args) 0 }} + {{- toYaml .Values.args | nindent 12}} + {{- end }} + {{- 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.yaml" + subPath: config.yaml + readOnly: true + {{- if .Values.extraVolumeMounts }} + {{ toYaml .Values.extraVolumeMounts | nindent 10 }} + {{- end }} + ports: + - name: http + containerPort: {{ include "tracoor-single.httpPort" . }} + protocol: TCP + - name: metrics + containerPort: {{ include "tracoor-single.metricsPort" . }} + protocol: TCP + - name: grpc + containerPort: {{ include "tracoor-single.grpcPort" . }} + protocol: TCP + {{- if (include "tracoor-single.pprofPort" .) }} + - name: pprof + containerPort: {{ include "tracoor-single.pprofPort" . }} + protocol: TCP + {{- end }} + {{- if .Values.extraPodPorts }} + {{ toYaml .Values.extraPodPorts | nindent 10 }} + {{- end }} + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + lifecycle: + {{- toYaml .Values.lifecycle | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + env: + {{- range $key, $value := .Values.secretEnv }} + - name: {{ $key }} + valueFrom: + secretKeyRef: + name: {{ include "tracoor-single.fullname" $ }}-env + key: {{ $key }} + {{- end }} + {{- if .Values.extraEnv }} + {{- 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: + {{- if .Values.extraVolumes }} + {{ toYaml .Values.extraVolumes | nindent 8}} + {{- end }} + - name: config + configMap: + name: {{ include "tracoor-single.fullname" . }} diff --git a/charts/tracoor-single/templates/hpa.yaml b/charts/tracoor-single/templates/hpa.yaml new file mode 100644 index 00000000..996c3a64 --- /dev/null +++ b/charts/tracoor-single/templates/hpa.yaml @@ -0,0 +1,22 @@ +{{- if .Values.autoscaling.enabled -}} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "tracoor-single.fullname" . }} + labels: + {{- include "tracoor-single.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "tracoor-single.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} +{{- end }} diff --git a/charts/tracoor-single/templates/ingress-grpc.yaml b/charts/tracoor-single/templates/ingress-grpc.yaml new file mode 100644 index 00000000..f842215e --- /dev/null +++ b/charts/tracoor-single/templates/ingress-grpc.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.grpc.enabled -}} +{{- $fullName := include "tracoor-single.fullname" . -}} +{{- $svcPort := include "tracoor-single.grpcPort" . -}} +{{- if and .Values.ingress.grpc.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.grpc.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.grpc.annotations "kubernetes.io/ingress.class" .Values.ingress.grpc.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 }}-grpc + labels: + {{- include "tracoor-single.labels" . | nindent 4 }} + {{- with .Values.ingress.grpc.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.grpc.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.grpc.className }} + {{- end }} + {{- if .Values.ingress.grpc.tls }} + tls: + {{- range .Values.ingress.grpc.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.grpc.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/tracoor-single/templates/ingress.yaml b/charts/tracoor-single/templates/ingress.yaml new file mode 100644 index 00000000..50c133aa --- /dev/null +++ b/charts/tracoor-single/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.http.enabled -}} +{{- $fullName := include "tracoor-single.fullname" . -}} +{{- $svcPort := include "tracoor-single.httpPort" . -}} +{{- if and .Values.ingress.http.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.http.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.http.annotations "kubernetes.io/ingress.class" .Values.ingress.http.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 "tracoor-single.labels" . | nindent 4 }} + {{- with .Values.ingress.http.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.http.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.http.className }} + {{- end }} + {{- if .Values.ingress.http.tls }} + tls: + {{- range .Values.ingress.http.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.http.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/tracoor-single/templates/pdb.yaml b/charts/tracoor-single/templates/pdb.yaml new file mode 100644 index 00000000..522a15ca --- /dev/null +++ b/charts/tracoor-single/templates/pdb.yaml @@ -0,0 +1,18 @@ +{{- if or .Values.podDisruptionBudget.minAvailable .Values.podDisruptionBudget.maxUnavailable -}} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "tracoor-single.fullname" . }} + labels: + {{- include "tracoor-single.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "tracoor-single.selectorLabels" . | nindent 6 }} + {{- if .Values.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.podDisruptionBudget.minAvailable }} + {{- end }} + {{- if .Values.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }} + {{- end }} +{{- end -}} \ No newline at end of file diff --git a/charts/tracoor-single/templates/secret.yaml b/charts/tracoor-single/templates/secret.yaml new file mode 100644 index 00000000..5bad36d4 --- /dev/null +++ b/charts/tracoor-single/templates/secret.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "tracoor-single.fullname" . }}-env + labels: + {{- include "tracoor-single.labels" . | nindent 4 }} +data: +{{- range $key, $value := .Values.secretEnv }} + {{ $key }}: {{ $value | b64enc }} +{{- end }} diff --git a/charts/tracoor-single/templates/service.yaml b/charts/tracoor-single/templates/service.yaml new file mode 100644 index 00000000..a61a051b --- /dev/null +++ b/charts/tracoor-single/templates/service.yaml @@ -0,0 +1,32 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "tracoor-single.fullname" . }} + labels: + {{- include "tracoor-single.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ include "tracoor-single.httpPort" . }} + targetPort: http + protocol: TCP + name: http + - port: {{ include "tracoor-single.grpcPort" . }} + targetPort: grpc + protocol: TCP + name: grpc + - port: {{ include "tracoor-single.metricsPort" . }} + targetPort: metrics + protocol: TCP + name: metrics + {{- if (include "tracoor-single.pprofPort" .) }} + - port: {{ include "tracoor-single.pprofPort" . }} + targetPort: pprof + protocol: TCP + name: pprof + {{- end }} + {{- if .Values.extraPorts }} + {{ toYaml .Values.extraPorts | nindent 4}} + {{- end }} + selector: + {{- include "tracoor-single.selectorLabels" . | nindent 4 }} diff --git a/charts/tracoor-single/templates/serviceaccount.yaml b/charts/tracoor-single/templates/serviceaccount.yaml new file mode 100644 index 00000000..b6522d8e --- /dev/null +++ b/charts/tracoor-single/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "tracoor-single.serviceAccountName" . }} + labels: + {{- include "tracoor-single.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/charts/tracoor-single/templates/servicemonitor.yaml b/charts/tracoor-single/templates/servicemonitor.yaml new file mode 100644 index 00000000..d1d18597 --- /dev/null +++ b/charts/tracoor-single/templates/servicemonitor.yaml @@ -0,0 +1,43 @@ +{{- if .Values.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "tracoor-single.fullname" . }} + {{- if .Values.serviceMonitor.namespace }} + namespace: {{ .Values.serviceMonitor.namespace }} + {{- end }} + labels: + {{- include "tracoor-single.labels" . | nindent 4 }} + {{- if .Values.serviceMonitor.labels }} + {{- toYaml .Values.serviceMonitor.labels | nindent 4 }} + {{- end }} + {{- if .Values.serviceMonitor.annotations }} + annotations: + {{ toYaml .Values.serviceMonitor.annotations | nindent 4 }} + {{- end }} +spec: + endpoints: + - interval: {{ .Values.serviceMonitor.interval }} + {{- if .Values.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} + {{- end }} + honorLabels: true + port: metrics + path: {{ .Values.serviceMonitor.path }} + scheme: {{ .Values.serviceMonitor.scheme }} + {{- if .Values.serviceMonitor.tlsConfig }} + tlsConfig: + {{- toYaml .Values.serviceMonitor.tlsConfig | nindent 6 }} + {{- end }} + {{- if .Values.serviceMonitor.relabelings }} + relabelings: + {{- toYaml .Values.serviceMonitor.relabelings | nindent 4 }} + {{- end }} + jobLabel: "{{ .Release.Name }}" + selector: + matchLabels: + {{- include "tracoor-single.selectorLabels" . | nindent 8 }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} +{{- end }} diff --git a/charts/tracoor-single/values.yaml b/charts/tracoor-single/values.yaml new file mode 100644 index 00000000..aef70498 --- /dev/null +++ b/charts/tracoor-single/values.yaml @@ -0,0 +1,284 @@ +# -- Overrides the chart's name +nameOverride: "" + +# -- Overrides the chart's computed fullname +fullnameOverride: "" + +# -- Number of replicas +replicas: 1 + +autoscaling: + # -- Autoscaling configuration + enabled: false + # -- Minimum number of replicas + minReplicas: 2 + # -- Maximum number of replicas + maxReplicas: 3 + # -- Target CPU utilization percentage + targetCPUUtilizationPercentage: 85 + +image: + # -- tracoor container image repository + repository: ethpandaops/tracoor + # -- tracoor container image tag + tag: latest + # -- tracoor container pull policy + pullPolicy: IfNotPresent + +# -- Secret env variables injected via a created secret +secretEnv: {} + +# -- Command arguments +args: [] + +config: + shared: + metricsAddr: ":9091" + logging: "debug" + indexer: + address: localhost:8081 + store: + type: fs + config: + base_path: "/tmp/tracoor" + + server: + addr: ":8081" + gatewayAddr: ":8080" + pprofAddr: ":6060" + preStopSleepSeconds: 1 + ntpServer: time.google.com + + persistence: + dsn: "file:/tmp/tracoor.db" + driver_name: sqlite + + services: + indexer: + retention: + beaconStates: 30m + executionBlockTraces: 30m + beaconBlocks: 30m + + agents: + - name: instance-1 + ethereum: + overrideNetworkName: mainnet + # features: + # fetchBeaconState: true + # fetchBeaconBlock: true + # fetchBeaconBadBlock: true + # fetchBeaconBadBlob: true + # fetchExecutionBlockTrace: true + # fetchExecutionBadBlock: true + beacon: + nodeAddress: http://localhost:5052 + # Prysm + # requires --save-invalid-block-temp and --save-invalid-blob-temp flags enabled + # Always stored in os.tmpdir(), eg. /tmp + # invalidGossipVerifiedBlocksPath: /tmp + # invalidGossipVerifiedBlobsPath: /tmp + + # Nimbus + # requires --dump flag enabled + # replace data-dir with the --data-dir flag value + # invalidGossipVerifiedBlocksPath: /data-dir/dump/invalid + + # Lighthouse + # requires --invalid-gossip-verified-blocks-path flag set eg. =/data/invalid + # invalidGossipVerifiedBlocksPath: /data/invalid + execution: + nodeAddress: http://localhost:8545 + traceDisableMemory: true + traceDisableStack: true + traceDisableStorage: true + +ingress: + grpc: + # -- Ingress resource for GRPC + 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 + http: + # -- Ingress resource for the HTTP API + 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 + +# -- Custom args for the tracoor container +customArgs: [] + +# -- Command replacement for the tracoor container +customCommand: [] # Only change this if you need to change the default command + +service: + # -- Service type + type: ClusterIP + +# -- Affinity configuration for pods +affinity: {} + +# -- Image pull secrets for Docker images +imagePullSecrets: [] + +# -- Annotations for the Deployment +annotations: {} + +# -- Liveness probe +# @default -- See `values.yaml` +livenessProbe: + tcpSocket: + port: grpc + initialDelaySeconds: 60 + periodSeconds: 120 + +# -- Readiness probe +# @default -- See `values.yaml` +readinessProbe: + tcpSocket: + port: grpc + initialDelaySeconds: 10 + periodSeconds: 10 + +# -- Node selector for pods +nodeSelector: {} + +# -- Pod labels +podLabels: {} + +# -- Pod annotations +podAnnotations: {} + +# -- Extra Pod ports +extraPodPorts: [] + +# -- 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: false + # -- 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: "" + +# -- Lifecycle hooks +# @default -- See `values.yaml` +lifecycle: + preStop: + exec: + command: + - /bin/sleep + - "30" + +# -- How long to wait until the pod is forcefully terminated +terminationGracePeriodSeconds: 90 + +# -- 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 + +# -- 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: [] + +serviceMonitor: + # -- If true, a ServiceMonitor CRD is created for a prometheus operator + # https://github.com/coreos/prometheus-operator + enabled: false + # -- Path to scrape + path: /metrics + # -- Alternative namespace for ServiceMonitor + namespace: null + # -- Additional ServiceMonitor labels + labels: {} + # -- Additional ServiceMonitor annotations + annotations: {} + # -- ServiceMonitor scrape interval + interval: 15s + # -- ServiceMonitor scheme + scheme: http + # -- ServiceMonitor TLS configuration + tlsConfig: {} + # -- ServiceMonitor scrape timeout + scrapeTimeout: 30s + # -- ServiceMonitor relabelings + relabelings: []