Skip to content

Commit

Permalink
feat(xatu-cl-mimicry): Initial (#309)
Browse files Browse the repository at this point in the history
* feat(xatu-cl-mimicry): Initial

* feat(xatu-cl-mimicry): Initial
  • Loading branch information
samcm committed Apr 17, 2024
1 parent df3dfaa commit 07ca262
Show file tree
Hide file tree
Showing 15 changed files with 700 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-charts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@ jobs:
--excluded-charts beacon-metrics-gazer
--excluded-charts tracoor-server
--excluded-charts tracoor-agent
--excluded-charts xatu-cl-mimicry
23 changes: 23 additions & 0 deletions charts/xatu-cl-mimicry/.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/
11 changes: 11 additions & 0 deletions charts/xatu-cl-mimicry/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v2
name: xatu-cl-mimicry
description: Ethereum p2p monitoring tool that collects data from the consensus layer.
home: https://github.com/ethpandaops/xatu
type: application
version: 0.0.1
maintainers:
- name: samcm
email: sam.calder-mason@ethereum.org
- name: savid
email: andrew.davis@ethereum.org
88 changes: 88 additions & 0 deletions charts/xatu-cl-mimicry/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@

# xatu-cl-mimicry

![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 p2p monitoring tool that collects data from the consensus layer.

**Homepage:** <https://github.com/ethpandaops/xatu>

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | Affinity configuration for pods |
| annotations | object | `{}` | Annotations for the Deployment |
| args | list | `[]` | Command arguments |
| config.ethereum.network | string | `"mainnet"` | |
| config.logging | string | `"info"` | |
| config.metricsAddr | string | `":9090"` | |
| config.name | string | `"example-instance"` | |
| config.node.devp2pHost | string | `"0.0.0.0"` | |
| config.node.devp2pPort | int | `0` | |
| config.node.dialConcurrency | int | `16` | |
| config.node.dialTimeout | string | `"5s"` | |
| config.node.libp2pHost | string | `"0.0.0.0"` | |
| config.node.libp2pPort | int | `0` | |
| config.node.maxPeers | int | `30` | |
| config.node.privateKeyStr | string | `""` | |
| config.node.prysmHost | string | `"127.0.0.1"` | |
| config.node.prysmPortGrpc | int | `4000` | |
| config.node.prysmPortHttp | int | `5052` | |
| config.ntpServer | string | `"time.google.com"` | |
| config.outputs[0].config.address | string | `"http://localhost:8080"` | |
| config.outputs[0].config.batchTimeout | string | `"5s"` | |
| config.outputs[0].config.exportTimeout | string | `"30s"` | |
| config.outputs[0].config.headers.authorization | string | `"Someb64Value"` | |
| config.outputs[0].config.maxExportBatchSize | int | `512` | |
| config.outputs[0].config.maxQueueSize | int | `51200` | |
| config.outputs[0].name | string | `"basic"` | |
| config.outputs[0].type | string | `"http"` | |
| config.probeAddr | string | `":8080"` | |
| containerSecurityContext | object | See `values.yaml` | The security context for containers |
| customArgs | list | `[]` | Custom args for the xatu container |
| customCommand | list | `[]` | Command replacement for the xatu 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 |
| image.pullPolicy | string | `"IfNotPresent"` | xatu container pull policy |
| image.repository | string | `"ethpandaops/xatu"` | xatu container image repository |
| image.tag | string | `"latest"` | xatu container image tag |
| imagePullSecrets | list | `[]` | Image pull secrets for Docker images |
| 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 |
| podManagementPolicy | string | `"OrderedReady"` | Pod management policy |
| 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 |
| updateStrategy | object | `{"type":"RollingUpdate"}` | Update stategy for the Statefulset |
| updateStrategy.type | string | `"RollingUpdate"` | Update stategy type |
15 changes: 15 additions & 0 deletions charts/xatu-cl-mimicry/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -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" . }}
16 changes: 16 additions & 0 deletions charts/xatu-cl-mimicry/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "xatu-cl-mimicry.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 "xatu-cl-mimicry.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "xatu-cl-mimicry.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ include "xatu-cl-mimicry.httpPort" . }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "xatu-cl-mimicry.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 }}
78 changes: 78 additions & 0 deletions charts/xatu-cl-mimicry/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "xatu-cl-mimicry.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 "xatu-cl-mimicry.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 "xatu-cl-mimicry.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "xatu-cl-mimicry.labels" -}}
helm.sh/chart: {{ include "xatu-cl-mimicry.chart" . }}
{{ include "xatu-cl-mimicry.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "xatu-cl-mimicry.selectorLabels" -}}
app.kubernetes.io/name: {{ include "xatu-cl-mimicry.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "xatu-cl-mimicry.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "xatu-cl-mimicry.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{- define "xatu-cl-mimicry.metricsPort" -}}
{{ (split ":" .Values.config.metricsAddr)._1 | default ":9090" }}
{{- end -}}

{{- define "xatu-cl-mimicry.pprofPort" -}}
{{- if .Values.config.pprofAddr -}}
{{ (split ":" .Values.config.pprofAddr)._1 | default "6060" }}
{{- end -}}
{{- end -}}

{{- define "xatu-cl-mimicry.probePort" -}}
{{- if .Values.config.probeAddr -}}
{{ (split ":" .Values.config.probeAddr)._1 | default "8080" }}
{{- end -}}
{{- end -}}
9 changes: 9 additions & 0 deletions charts/xatu-cl-mimicry/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "xatu-cl-mimicry.fullname" . }}
labels:
{{- include "xatu-cl-mimicry.labels" . | nindent 4 }}
data:
config.yaml: |-
{{ toYaml .Values.config | nindent 4 }}
18 changes: 18 additions & 0 deletions charts/xatu-cl-mimicry/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if or .Values.podDisruptionBudget.minAvailable .Values.podDisruptionBudget.maxUnavailable -}}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "xatu-cl-mimicry.fullname" . }}
labels:
{{- include "xatu-cl-mimicry.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "xatu-cl-mimicry.selectorLabels" . | nindent 6 }}
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
{{- end -}}
10 changes: 10 additions & 0 deletions charts/xatu-cl-mimicry/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "xatu-cl-mimicry.fullname" . }}-env
labels:
{{- include "xatu-cl-mimicry.labels" . | nindent 4 }}
data:
{{- range $key, $value := .Values.secretEnv }}
{{ $key }}: {{ $value | b64enc }}
{{- end }}
30 changes: 30 additions & 0 deletions charts/xatu-cl-mimicry/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "xatu-cl-mimicry.fullname" . }}
labels:
{{- include "xatu-cl-mimicry.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ include "xatu-cl-mimicry.metricsPort" . }}
targetPort: metrics
protocol: TCP
name: metrics
{{- if (include "xatu-cl-mimicry.pprofPort" .) }}
- port: {{ include "xatu-cl-mimicry.pprofPort" . }}
targetPort: pprof
protocol: TCP
name: pprof
{{- end }}
{{- if (include "xatu-cl-mimicry.probePort" .) }}
- port: {{ include "xatu-cl-mimicry.probePort" . }}
targetPort: probe
protocol: TCP
name: probe
{{- end }}
{{- if .Values.extraPorts }}
{{ toYaml .Values.extraPorts | nindent 4}}
{{- end }}
selector:
{{- include "xatu-cl-mimicry.selectorLabels" . | nindent 4 }}
13 changes: 13 additions & 0 deletions charts/xatu-cl-mimicry/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "xatu-cl-mimicry.serviceAccountName" . }}
labels:
{{- include "xatu-cl-mimicry.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
namespace: {{ .Release.Namespace }}
{{- end }}
43 changes: 43 additions & 0 deletions charts/xatu-cl-mimicry/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "xatu-cl-mimicry.fullname" . }}
{{- if .Values.serviceMonitor.namespace }}
namespace: {{ .Values.serviceMonitor.namespace }}
{{- end }}
labels:
{{- include "xatu-cl-mimicry.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 "xatu-cl-mimicry.selectorLabels" . | nindent 8 }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
{{- end }}
Loading

0 comments on commit 07ca262

Please sign in to comment.