diff --git a/README.md b/README.md index b6290ac2..910ebfef 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,8 @@ Tooling - [`ethereum-address-metrics-exporter`](charts/ethereum-address-metrics-exporter) - A prometheus exporter for Ethereum externally owned account and contract addresses. - [`smart-contract-verifier-http`](charts/smart-contract-verifier-http) - Smart contract verification service. - [`web3signer`](charts/web3signer) - An open-source remote signing service. +- [`xatu-sentry`](charts/xatu-sentry) - Ethereum p2p monitoring tool that runs along side a [Ethereum consensus client](https://ethereum.org/en/developers/docs/nodes-and-clients/#consensus-clients) and collects data via the consensus client's [Beacon API](https://ethereum.github.io/beacon-APIs/). +- [`xatu-server`](charts/xatu-server) - Ethereum p2p monitoring tool that collects events from and controls various Xatu clients. ## Development diff --git a/charts/xatu/.helmignore b/charts/xatu-sentry/.helmignore similarity index 100% rename from charts/xatu/.helmignore rename to charts/xatu-sentry/.helmignore diff --git a/charts/xatu-sentry/Chart.yaml b/charts/xatu-sentry/Chart.yaml new file mode 100644 index 00000000..5b5e1b0d --- /dev/null +++ b/charts/xatu-sentry/Chart.yaml @@ -0,0 +1,11 @@ +apiVersion: v2 +name: xatu-sentry +description: Ethereum p2p monitoring tool that runs along side a Ethereum consensus client and collects data via the consensus client's Beacon API. +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 diff --git a/charts/xatu/README.md b/charts/xatu-sentry/README.md similarity index 95% rename from charts/xatu/README.md rename to charts/xatu-sentry/README.md index 8efbce8a..415de236 100644 --- a/charts/xatu/README.md +++ b/charts/xatu-sentry/README.md @@ -1,9 +1,9 @@ -# xatu +# xatu-sentry ![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 +Ethereum p2p monitoring tool that runs along side a Ethereum consensus client and collects data via the consensus client's Beacon API. **Homepage:** @@ -18,14 +18,13 @@ Ethereum p2p monitoring tool | config.logging | string | `"info"` | | | config.metricsAddr | string | `":9090"` | | | config.name | string | `"example-instance"` | | +| config.ntp_server | string | `"time.google.com"` | | | config.outputs[0].config.address | string | `"http://localhost:8080"` | | | config.outputs[0].config.batch_timeout | string | `"5s"` | | | config.outputs[0].config.export_timeout | string | `"30s"` | | | config.outputs[0].config.headers.Authorization | string | `"Someb64Value"` | | | config.outputs[0].config.max_export_batch_size | int | `512` | | | config.outputs[0].config.max_queue_size | int | `51200` | | -| config.outputs[0].config.ntp_server | string | `"pool.ntp.org"` | | -| config.outputs[0].config.type | string | `"http"` | | | config.outputs[0].name | string | `"basic"` | | | config.outputs[0].type | string | `"http"` | | | containerSecurityContext | object | See `values.yaml` | The security context for containers | diff --git a/charts/xatu/README.md.gotmpl b/charts/xatu-sentry/README.md.gotmpl similarity index 100% rename from charts/xatu/README.md.gotmpl rename to charts/xatu-sentry/README.md.gotmpl diff --git a/charts/xatu/templates/NOTES.txt b/charts/xatu-sentry/templates/NOTES.txt similarity index 69% rename from charts/xatu/templates/NOTES.txt rename to charts/xatu-sentry/templates/NOTES.txt index 182336ce..4d4ba2fb 100644 --- a/charts/xatu/templates/NOTES.txt +++ b/charts/xatu-sentry/templates/NOTES.txt @@ -1,15 +1,15 @@ 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.fullname" . }}) + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "xatu-sentry.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.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "xatu.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ include "xatu.httpPort" . }} + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "xatu-sentry.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "xatu-sentry.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ include "xatu-sentry.httpPort" . }} {{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "xatu.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "xatu-sentry.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 diff --git a/charts/xatu/templates/_helpers.tpl b/charts/xatu-sentry/templates/_helpers.tpl similarity index 73% rename from charts/xatu/templates/_helpers.tpl rename to charts/xatu-sentry/templates/_helpers.tpl index 228e11a4..117a478e 100644 --- a/charts/xatu/templates/_helpers.tpl +++ b/charts/xatu-sentry/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Expand the name of the chart. */}} -{{- define "xatu.name" -}} +{{- define "xatu-sentry.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} @@ -10,7 +10,7 @@ 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.fullname" -}} +{{- define "xatu-sentry.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "xatu.chart" -}} +{{- define "xatu-sentry.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "xatu.labels" -}} -helm.sh/chart: {{ include "xatu.chart" . }} -{{ include "xatu.selectorLabels" . }} +{{- define "xatu-sentry.labels" -}} +helm.sh/chart: {{ include "xatu-sentry.chart" . }} +{{ include "xatu-sentry.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -45,22 +45,22 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "xatu.selectorLabels" -}} -app.kubernetes.io/name: {{ include "xatu.name" . }} +{{- define "xatu-sentry.selectorLabels" -}} +app.kubernetes.io/name: {{ include "xatu-sentry.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "xatu.serviceAccountName" -}} +{{- define "xatu-sentry.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "xatu.fullname" .) .Values.serviceAccount.name }} +{{- default (include "xatu-sentry.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} -{{- define "xatu.metricsPort" -}} +{{- define "xatu-sentry.metricsPort" -}} {{ (split ":" .Values.config.metricsAddr)._1 | default ":9090" }} {{- end -}} diff --git a/charts/xatu/templates/configmap.yaml b/charts/xatu-sentry/templates/configmap.yaml similarity index 54% rename from charts/xatu/templates/configmap.yaml rename to charts/xatu-sentry/templates/configmap.yaml index 50e1b7ab..2be6bfef 100644 --- a/charts/xatu/templates/configmap.yaml +++ b/charts/xatu-sentry/templates/configmap.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "xatu.fullname" . }} + name: {{ include "xatu-sentry.fullname" . }} labels: - {{- include "xatu.labels" . | nindent 4 }} + {{- include "xatu-sentry.labels" . | nindent 4 }} data: config.yaml: |- {{ toYaml .Values.config | nindent 4 }} diff --git a/charts/xatu/templates/deployment.yaml b/charts/xatu-sentry/templates/deployment.yaml similarity index 86% rename from charts/xatu/templates/deployment.yaml rename to charts/xatu-sentry/templates/deployment.yaml index 72986e00..145d4875 100644 --- a/charts/xatu/templates/deployment.yaml +++ b/charts/xatu-sentry/templates/deployment.yaml @@ -1,20 +1,20 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "xatu.fullname" . }} + name: {{ include "xatu-sentry.fullname" . }} labels: - {{- include "xatu.labels" . | nindent 4 }} + {{- include "xatu-sentry.labels" . | nindent 4 }} annotations: {{- toYaml .Values.annotations | nindent 4 }} spec: replicas: {{ .Values.replicas }} selector: matchLabels: - {{- include "xatu.selectorLabels" . | nindent 6 }} + {{- include "xatu-sentry.selectorLabels" . | nindent 6 }} template: metadata: labels: - {{- include "xatu.selectorLabels" . | nindent 8 }} + {{- include "xatu-sentry.selectorLabels" . | nindent 8 }} {{- with .Values.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} @@ -25,7 +25,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} spec: - serviceAccountName: {{ include "xatu.serviceAccountName" . }} + serviceAccountName: {{ include "xatu-sentry.serviceAccountName" . }} {{- if .Values.priorityClassName }} priorityClassName: {{ .Values.priorityClassName }} {{- end }} @@ -70,7 +70,7 @@ spec: {{- end }} ports: - name: metrics - containerPort: {{ include "xatu.metricsPort" . }} + containerPort: {{ include "xatu-sentry.metricsPort" . }} protocol: TCP livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }} @@ -83,7 +83,7 @@ spec: - name: {{ $key }} valueFrom: secretKeyRef: - name: {{ include "xatu.fullname" $ }}-env + name: {{ include "xatu-sentry.fullname" $ }}-env key: {{ $key }} {{- end }} {{- if .Values.extraEnv }} @@ -105,4 +105,4 @@ spec: {{- end }} - name: config configMap: - name: {{ include "xatu.fullname" . }} + name: {{ include "xatu-sentry.fullname" . }} diff --git a/charts/xatu/templates/secret.yaml b/charts/xatu-sentry/templates/secret.yaml similarity index 58% rename from charts/xatu/templates/secret.yaml rename to charts/xatu-sentry/templates/secret.yaml index 7e5f1b75..1d306c16 100644 --- a/charts/xatu/templates/secret.yaml +++ b/charts/xatu-sentry/templates/secret.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Secret metadata: - name: {{ include "xatu.fullname" . }}-env + name: {{ include "xatu-sentry.fullname" . }}-env labels: - {{- include "xatu.labels" . | nindent 4 }} + {{- include "xatu-sentry.labels" . | nindent 4 }} data: {{- range $key, $value := .Values.secretEnv }} {{ $key }}: {{ $value | b64enc }} diff --git a/charts/xatu/templates/service.yaml b/charts/xatu-sentry/templates/service.yaml similarity index 55% rename from charts/xatu/templates/service.yaml rename to charts/xatu-sentry/templates/service.yaml index bf693e4a..f45fe922 100644 --- a/charts/xatu/templates/service.yaml +++ b/charts/xatu-sentry/templates/service.yaml @@ -1,13 +1,13 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "xatu.fullname" . }} + name: {{ include "xatu-sentry.fullname" . }} labels: - {{- include "xatu.labels" . | nindent 4 }} + {{- include "xatu-sentry.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: - - port: {{ include "xatu.metricsPort" . }} + - port: {{ include "xatu-sentry.metricsPort" . }} targetPort: metrics protocol: TCP name: metrics @@ -15,4 +15,4 @@ spec: {{ toYaml .Values.extraPorts | nindent 4}} {{- end }} selector: - {{- include "xatu.selectorLabels" . | nindent 4 }} + {{- include "xatu-sentry.selectorLabels" . | nindent 4 }} diff --git a/charts/xatu/templates/serviceaccount.yaml b/charts/xatu-sentry/templates/serviceaccount.yaml similarity index 69% rename from charts/xatu/templates/serviceaccount.yaml rename to charts/xatu-sentry/templates/serviceaccount.yaml index 2dd12e97..663a25a7 100644 --- a/charts/xatu/templates/serviceaccount.yaml +++ b/charts/xatu-sentry/templates/serviceaccount.yaml @@ -2,9 +2,9 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "xatu.serviceAccountName" . }} + name: {{ include "xatu-sentry.serviceAccountName" . }} labels: - {{- include "xatu.labels" . | nindent 4 }} + {{- include "xatu-sentry.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/xatu/templates/servicemonitor.yaml b/charts/xatu-sentry/templates/servicemonitor.yaml similarity index 87% rename from charts/xatu/templates/servicemonitor.yaml rename to charts/xatu-sentry/templates/servicemonitor.yaml index d14c940a..148fa2fc 100644 --- a/charts/xatu/templates/servicemonitor.yaml +++ b/charts/xatu-sentry/templates/servicemonitor.yaml @@ -2,12 +2,12 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: - name: {{ include "xatu.fullname" . }} + name: {{ include "xatu-sentry.fullname" . }} {{- if .Values.serviceMonitor.namespace }} namespace: {{ .Values.serviceMonitor.namespace }} {{- end }} labels: - {{- include "xatu.labels" . | nindent 4 }} + {{- include "xatu-sentry.labels" . | nindent 4 }} {{- if .Values.serviceMonitor.labels }} {{- toYaml .Values.serviceMonitor.labels | nindent 4 }} {{- end }} @@ -22,7 +22,7 @@ spec: scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} {{- end }} honorLabels: true - port: http + port: metrics path: {{ .Values.serviceMonitor.path }} scheme: {{ .Values.serviceMonitor.scheme }} {{- if .Values.serviceMonitor.tlsConfig }} @@ -36,7 +36,7 @@ spec: jobLabel: "{{ .Release.Name }}" selector: matchLabels: - {{- include "xatu.selectorLabels" . | nindent 8 }} + {{- include "xatu-sentry.selectorLabels" . | nindent 8 }} namespaceSelector: matchNames: - {{ .Release.Namespace }} diff --git a/charts/xatu/values.yaml b/charts/xatu-sentry/values.yaml similarity index 98% rename from charts/xatu/values.yaml rename to charts/xatu-sentry/values.yaml index f1c35548..422110dd 100644 --- a/charts/xatu/values.yaml +++ b/charts/xatu-sentry/values.yaml @@ -25,15 +25,14 @@ config: logging: "info" metricsAddr: ":9090" name: example-instance + ntp_server: time.google.com ethereum: beacon_node_address: http://localhost:5052 outputs: - name: basic type: http config: - type: http address: http://localhost:8080 - ntp_server: pool.ntp.org headers: Authorization: Someb64Value max_queue_size: 51200 diff --git a/charts/xatu-server/.helmignore b/charts/xatu-server/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/charts/xatu-server/.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/xatu/Chart.yaml b/charts/xatu-server/Chart.yaml similarity index 63% rename from charts/xatu/Chart.yaml rename to charts/xatu-server/Chart.yaml index 833c29bd..1b57a0e0 100644 --- a/charts/xatu/Chart.yaml +++ b/charts/xatu-server/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 -name: xatu -description: Ethereum p2p monitoring tool +name: xatu-server +description: Ethereum p2p monitoring tool that collects events from and controls various Xatu clients. home: https://github.com/ethpandaops/xatu type: application version: 0.0.1 diff --git a/charts/xatu-server/README.md b/charts/xatu-server/README.md new file mode 100644 index 00000000..e3088161 --- /dev/null +++ b/charts/xatu-server/README.md @@ -0,0 +1,84 @@ + +# xatu-server + +![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 events from and controls various Xatu clients. + +**Homepage:** + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | Affinity configuration for pods | +| annotations | object | `{}` | Annotations for the Deployment | +| args | list | `[]` | Command arguments | +| config.addr | string | `":8080"` | | +| config.logging | string | `"info"` | | +| config.metricsAddr | string | `":9090"` | | +| config.ntp_server | string | `"time.google.com"` | | +| config.services.coordinator.enabled | bool | `false` | | +| config.services.coordinator.persistence.batch_timeout | string | `"5s"` | | +| config.services.coordinator.persistence.connection_string | string | `"postgres://postgres:password@localhost:5432/xatu?sslmode=disable"` | | +| config.services.coordinator.persistence.driver_name | string | `"postgres"` | | +| config.services.coordinator.persistence.export_timeout | string | `"30s"` | | +| config.services.coordinator.persistence.max_export_batch_size | int | `512` | | +| config.services.coordinator.persistence.max_queue_size | int | `51200` | | +| config.services.event_ingester.enabled | bool | `true` | | +| config.services.event_ingester.outputs[0].config.address | string | `"http://localhost:8080"` | | +| config.services.event_ingester.outputs[0].config.batch_timeout | string | `"5s"` | | +| config.services.event_ingester.outputs[0].config.export_timeout | string | `"30s"` | | +| config.services.event_ingester.outputs[0].config.headers.Authorization | string | `"Someb64Value"` | | +| config.services.event_ingester.outputs[0].config.max_export_batch_size | int | `512` | | +| config.services.event_ingester.outputs[0].config.max_queue_size | int | `51200` | | +| config.services.event_ingester.outputs[0].name | string | `"basic"` | | +| config.services.event_ingester.outputs[0].type | string | `"http"` | | +| 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 | +| 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"` | 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 | +| ingress.annotations | object | `{}` | Annotations for Ingress | +| ingress.enabled | bool | `false` | Ingress resource for the HTTP API | +| 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 | +| 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 | `30` | How long to wait until the pod is forcefully terminated | +| tolerations | list | `[]` | Tolerations for pods | diff --git a/charts/xatu-server/README.md.gotmpl b/charts/xatu-server/README.md.gotmpl new file mode 100644 index 00000000..54549956 --- /dev/null +++ b/charts/xatu-server/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/xatu-server/templates/NOTES.txt b/charts/xatu-server/templates/NOTES.txt new file mode 100644 index 00000000..debdb97b --- /dev/null +++ b/charts/xatu-server/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 "xatu-server.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-server.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "xatu-server.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ include "xatu-server.httpPort" . }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "xatu-server.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/xatu-server/templates/_helpers.tpl b/charts/xatu-server/templates/_helpers.tpl new file mode 100644 index 00000000..4e893597 --- /dev/null +++ b/charts/xatu-server/templates/_helpers.tpl @@ -0,0 +1,70 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "xatu-server.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-server.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-server.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "xatu-server.labels" -}} +helm.sh/chart: {{ include "xatu-server.chart" . }} +{{ include "xatu-server.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "xatu-server.selectorLabels" -}} +app.kubernetes.io/name: {{ include "xatu-server.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "xatu-server.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "xatu-server.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{- define "xatu-server.httpPort" -}} +{{ (split ":" .Values.config.addr)._1 | default ":8080" }} +{{- end }} + +{{- define "xatu-server.metricsPort" -}} +{{ (split ":" .Values.config.metricsAddr)._1 | default ":9090" }} +{{- end -}} diff --git a/charts/xatu-server/templates/configmap.yaml b/charts/xatu-server/templates/configmap.yaml new file mode 100644 index 00000000..9d024784 --- /dev/null +++ b/charts/xatu-server/templates/configmap.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "xatu-server.fullname" . }} + labels: + {{- include "xatu-server.labels" . | nindent 4 }} +data: + config.yaml: |- + {{ toYaml .Values.config | nindent 4 }} diff --git a/charts/xatu-server/templates/deployment.yaml b/charts/xatu-server/templates/deployment.yaml new file mode 100644 index 00000000..7963f29e --- /dev/null +++ b/charts/xatu-server/templates/deployment.yaml @@ -0,0 +1,114 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "xatu-server.fullname" . }} + labels: + {{- include "xatu-server.labels" . | nindent 4 }} + annotations: + {{- toYaml .Values.annotations | nindent 4 }} +spec: + replicas: {{ .Values.replicas }} + selector: + matchLabels: + {{- include "xatu-server.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "xatu-server.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 "xatu-server.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 }} + - "/xatu" + - "server" + - --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 12 }} + {{- end }} + ports: + - name: http + containerPort: {{ include "xatu-server.httpPort" . }} + protocol: TCP + - name: metrics + containerPort: {{ include "xatu-server.metricsPort" . }} + protocol: TCP + {{- if .Values.extraPodPorts }} + {{ toYaml .Values.extraPodPorts | nindent 10 }} + {{- end }} + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + env: + {{- range $key, $value := .Values.secretEnv }} + - name: {{ $key }} + valueFrom: + secretKeyRef: + name: {{ include "xatu-server.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 }} + terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} + volumes: + {{- if .Values.extraVolumes }} + {{ toYaml .Values.extraVolumes | nindent 8}} + {{- end }} + - name: config + configMap: + name: {{ include "xatu-server.fullname" . }} diff --git a/charts/xatu-server/templates/ingress.yaml b/charts/xatu-server/templates/ingress.yaml new file mode 100644 index 00000000..6ae9678f --- /dev/null +++ b/charts/xatu-server/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "xatu-server.fullname" . -}} +{{- $svcPort := include "xatu-server.httpPort" . -}} +{{- 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 "xatu-server.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/xatu-server/templates/secret.yaml b/charts/xatu-server/templates/secret.yaml new file mode 100644 index 00000000..3d3cae6f --- /dev/null +++ b/charts/xatu-server/templates/secret.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "xatu-server.fullname" . }}-env + labels: + {{- include "xatu-server.labels" . | nindent 4 }} +data: +{{- range $key, $value := .Values.secretEnv }} + {{ $key }}: {{ $value | b64enc }} +{{- end }} diff --git a/charts/xatu-server/templates/service.yaml b/charts/xatu-server/templates/service.yaml new file mode 100644 index 00000000..f0ad07e9 --- /dev/null +++ b/charts/xatu-server/templates/service.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "xatu-server.fullname" . }} + labels: + {{- include "xatu-server.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ include "xatu-server.httpPort" . }} + targetPort: http + protocol: TCP + name: http + - port: {{ include "xatu-server.metricsPort" . }} + targetPort: metrics + protocol: TCP + name: metrics + {{- if .Values.extraPorts }} + {{ toYaml .Values.extraPorts | nindent 4}} + {{- end }} + selector: + {{- include "xatu-server.selectorLabels" . | nindent 4 }} diff --git a/charts/xatu-server/templates/serviceaccount.yaml b/charts/xatu-server/templates/serviceaccount.yaml new file mode 100644 index 00000000..84f20586 --- /dev/null +++ b/charts/xatu-server/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "xatu-server.serviceAccountName" . }} + labels: + {{- include "xatu-server.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/charts/xatu-server/templates/servicemonitor.yaml b/charts/xatu-server/templates/servicemonitor.yaml new file mode 100644 index 00000000..c6f39e5e --- /dev/null +++ b/charts/xatu-server/templates/servicemonitor.yaml @@ -0,0 +1,43 @@ +{{- if .Values.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "xatu-server.fullname" . }} + {{- if .Values.serviceMonitor.namespace }} + namespace: {{ .Values.serviceMonitor.namespace }} + {{- end }} + labels: + {{- include "xatu-server.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-server.selectorLabels" . | nindent 8 }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} +{{- end }} diff --git a/charts/xatu-server/values.yaml b/charts/xatu-server/values.yaml new file mode 100644 index 00000000..bbf5b50e --- /dev/null +++ b/charts/xatu-server/values.yaml @@ -0,0 +1,211 @@ +# -- Overrides the chart's name +nameOverride: "" + +# -- Overrides the chart's computed fullname +fullnameOverride: "" + +# -- Number of replicas +replicas: 1 + +image: + # -- xatu container image repository + repository: ethpandaops/xatu + # -- xatu container image tag + tag: latest + # -- xatu container pull policy + pullPolicy: IfNotPresent + +# -- Secret env variables injected via a created secret +secretEnv: {} + +# -- Command arguments +args: [] + +config: + logging: "info" # panic,fatal,warn,info,debug,trace + addr: ":8080" + metricsAddr: ":9090" + ntp_server: time.google.com + services: + coordinator: + enabled: false + persistence: + driver_name: postgres + connection_string: postgres://postgres:password@localhost:5432/xatu?sslmode=disable + max_queue_size: 51200 + batch_timeout: 5s + export_timeout: 30s + max_export_batch_size: 512 + event_ingester: + enabled: true + outputs: + - name: basic + type: http + config: + address: http://localhost:8080 + headers: + Authorization: Someb64Value + max_queue_size: 51200 + batch_timeout: 5s + export_timeout: 30s + max_export_batch_size: 512 + +ingress: + # -- 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 xatu container +customArgs: [] + +# -- Command replacement for the xatu 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: 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: {} + +# -- 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: "" + +# -- 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: [] + +# -- 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: []