Skip to content

Commit

Permalink
feat(armiarma): Initial chart (#264)
Browse files Browse the repository at this point in the history
* feat(armiarma): Initial chart

* feat(armiarma): Initial chart

* chore: linting

* fix: Launch args

* fix: Launch args

* fix: Launch args

* fix: Launch args

* fix: Launch args

* fix: Launch args

* fix: Launch args

* fix: Launch args

* fix: Launch args

* fix: Launch args

* fix: Launch args

* fix: Launch args
  • Loading branch information
samcm authored Dec 5, 2023
1 parent 5a0053d commit a10dfe7
Show file tree
Hide file tree
Showing 16 changed files with 763 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/armiarma/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions charts/armiarma/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 13.2.23
digest: sha256:29f892fc9caea67e8d827f6e81cb2783de11c282832e07cabbc04fb429971184
generated: "2023-12-05T10:41:26.555587+10:00"
14 changes: 14 additions & 0 deletions charts/armiarma/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v2
name: armiarma
description: A distributed p2p network monitoring tool
home: https://github.com/migalabs/armiarma
type: application
version: 0.1.0
maintainers:
- name: samcm
email: sam.calder-mason@ethereum.org
dependencies:
- name: postgresql
version: 13.2.23
repository: "https://charts.bitnami.com/bitnami"
condition: postgresql.enabled
70 changes: 70 additions & 0 deletions charts/armiarma/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@

# armiarma

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)

A distributed p2p network monitoring tool

**Homepage:** <https://github.com/migalabs/armiarma>

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| https://charts.bitnami.com/bitnami | postgresql | 13.2.23 |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | Affinity configuration for pods |
| annotations | object | `{}` | Annotations for the StatefulSet |
| containerSecurityContext | object | See `values.yaml` | The security context for containers |
| customArgs | list | `["eth2","--persist-connevents=false","--persist-msgs=false"]` | Custom args for the armiarma container |
| customCommand | list | `[]` | Command replacement for the armiarma container |
| extraContainers | list | `[]` | Additional containers |
| extraEnv | list | `[]` | Additional env variables |
| extraPorts | list | `[]` | Additional ports. Useful when using extraContainers |
| extraVolumeMounts | list | `[]` | Additional volume mounts |
| extraVolumes | list | `[]` | Additional volumes |
| fullnameOverride | string | `""` | Overrides the chart's computed fullname |
| global | object | `{"postgresql":{"auth":{"database":"armiarmadb","password":"postgres","postgresqlPassword":"postgres","user":"postgres"}}}` | Global values |
| image.pullPolicy | string | `"IfNotPresent"` | armiarma container pull policy |
| image.repository | string | `"ethpandaops/armiarma"` | armiarma container image repository |
| image.tag | string | `"master"` | armiarma container image tag |
| imagePullSecrets | list | `[]` | Image pull secrets for Docker images |
| ingress.annotations | object | `{}` | Annotations for Ingress |
| ingress.enabled | bool | `false` | Ingress resource for exposing the SSE port |
| ingress.hosts[0].host | string | `"chart-example.local"` | |
| ingress.hosts[0].paths | list | `[]` | |
| ingress.tls | list | `[]` | Ingress TLS |
| initContainers | list | `[]` | Additional init containers |
| livenessProbe | object | See `values.yaml` | Liveness probe |
| metricsPort | int | `9080` | Metrics port |
| nameOverride | string | `""` | Overrides the chart's name |
| nodeSelector | object | `{}` | Node selector for pods |
| p2pNodePort.enabled | bool | `false` | Expose P2P port via NodePort |
| p2pNodePort.initContainer.image.pullPolicy | string | `"IfNotPresent"` | Container pull policy |
| p2pNodePort.initContainer.image.repository | string | `"lachlanevenson/k8s-kubectl"` | Container image to fetch nodeport information |
| p2pNodePort.initContainer.image.tag | string | `"v1.21.3"` | Container tag |
| p2pNodePort.port | int | `31000` | NodePort to be used |
| podAnnotations | object | `{}` | Pod annotations |
| podDisruptionBudget | object | `{}` | Define the PodDisruptionBudget spec If not set then a PodDisruptionBudget will not be created |
| podLabels | object | `{}` | Pod labels |
| podManagementPolicy | string | `"OrderedReady"` | Pod management policy |
| postgresql | object | `{"enabled":true,"image":{"repository":"bitnami/postgresql","tag":"14-debian-11"},"nameOverride":"postgresql","postgresqlDatabase":"armiarmadb","postgresqlPassword":"postgres","postgresqlUsername":"postgres","primary":{"persistence":{"enabled":true,"size":"8Gi"}}}` | Postgresql subchart configuration |
| priorityClassName | string | `nil` | Pod priority class |
| readinessProbe | object | See `values.yaml` | Readiness probe |
| resources | object | `{}` | Resource requests and limits |
| secretEnv | object | `{"ARMIARMA_BACKUP_INTERVAL":"12h","ARMIARMA_FORK_DIGEST":"0x4a26c58b","ARMIARMA_GOSSIP_TOPICS":"beacon_block","ARMIARMA_LOG_LEVEL":"info","ARMIARMA_PSQL":"postgres://{{ $.Values.global.postgresql.auth.user }}:{{ $.Values.global.postgresql.auth.password }}@{{ include \"armiarma.fullname\" $ }}-postgresql:5432/{{ $.Values.global.postgresql.auth.database }}","ARMIARMA_SUBNETS":"all"}` | Env variables injected via a created secret |
| securityContext | object | See `values.yaml` | The security context for pods |
| service.type | string | `"ClusterIP"` | Service type |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
| ssePort | int | `9099` | SSE port |
| terminationGracePeriodSeconds | int | `30` | How long to wait until the pod is forcefully terminated |
| tolerations | list | `[]` | Tolerations for pods |
| topologySpreadConstraints | list | `[]` | Topology Spread Constraints for pods |
| updateStrategy | object | `{"type":"RollingUpdate"}` | Update stategy for the Statefulset |
| updateStrategy.type | string | `"RollingUpdate"` | Update stategy type |
15 changes: 15 additions & 0 deletions charts/armiarma/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" . }}
8 changes: 8 additions & 0 deletions charts/armiarma/ci/default-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
secretEnv:
HCAPTCHA_SECRET: "your_hcaptcha_secret"
HCAPTCHA_SITEKEY: "your_hcaptcha_site_key"
APP_ETHKEY: "6c9bd4919736ead6bdeb0441cd8124c16e45a881aef5d11de24be12ee9ecafe3"
APP_AMOUNT: "1000000000000000000" # 1 ETH
APP_CHAINS: "5"
#APP_IMAGEURL:
APP_TITLE: "%CHAINNAME armiarma"
22 changes: 22 additions & 0 deletions charts/armiarma/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "armiarma.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "armiarma.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "armiarma.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ include "armiarma.httpPort" . }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "armiarma.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
83 changes: 83 additions & 0 deletions charts/armiarma/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "armiarma.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "armiarma.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "armiarma.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

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

{{- define "armiarma.metricsPort" -}}
{{ .Values.metricsPort }}
{{- end -}}

{{- define "armiarma.ssePort" -}}
{{ .Values.ssePort }}
{{- end -}}

{{- define "armiarma.secretEnv" -}}
ARMIARMA_PORT: {{ tpl (.Values.p2pNodePort.port | toString) . | b64enc }}
ARMIARMA_METRICS_PORT: {{ tpl (.Values.metricsPort | toString) . | b64enc }}
ARMIARMA_SSE_PORT: {{ tpl (.Values.ssePort | toString) . | b64enc }}
{{- range $key, $value := .Values.secretEnv }}
{{ $key }}: {{ tpl (toString ($value | toYaml)) $ | b64enc }}
{{- end -}}
{{- end -}}

{{- define "armiarma.p2pPort" -}}
{{- print .Values.p2pNodePort.port }}
{{- end -}}
61 changes: 61 additions & 0 deletions charts/armiarma/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "armiarma.fullname" . -}}
{{- $svcPort := include "armiarma.ssePort" . -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "armiarma.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
8 changes: 8 additions & 0 deletions charts/armiarma/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "armiarma.fullname" . }}-env
labels:
{{- include "armiarma.labels" . | nindent 4 }}
data:
{{- include "armiarma.secretEnv" . | nindent 2 }}
22 changes: 22 additions & 0 deletions charts/armiarma/templates/service-headless.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "armiarma.fullname" . }}-headless
labels:
{{- include "armiarma.labels" . | nindent 4 }}
spec:
clusterIP: None
ports:
- port: {{ include "armiarma.metricsPort" . }}
targetPort: metrics
protocol: TCP
name: metrics
- port: {{ include "armiarma.ssePort" . }}
targetPort: sse
protocol: TCP
name: sse
{{- if .Values.extraPorts }}
{{ toYaml .Values.extraPorts | nindent 4}}
{{- end }}
selector:
{{- include "armiarma.selectorLabels" . | nindent 4 }}
28 changes: 28 additions & 0 deletions charts/armiarma/templates/service.p2p.nodeport.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.p2pNodePort.enabled -}}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "armiarma.fullname" $ }}-p2p-0
labels:
{{- include "armiarma.labels" $ | nindent 4 }}
pod: {{ include "armiarma.fullname" $ }}-0
type: p2p
spec:
type: NodePort
externalTrafficPolicy: Local
ports:
- name: p2p-tcp
port: {{ include "armiarma.p2pPort" $ }}
protocol: TCP
targetPort: p2p-tcp
nodePort: {{ include "armiarma.p2pPort" $ }}
- name: p2p-udp
port: {{ include "armiarma.p2pPort" $ }}
protocol: UDP
targetPort: p2p-udp
nodePort: {{ include "armiarma.p2pPort" $ }}
selector:
{{- include "armiarma.selectorLabels" $ | nindent 4 }}
statefulset.kubernetes.io/pod-name: "{{ include "armiarma.fullname" $ }}-0"
{{- end }}
22 changes: 22 additions & 0 deletions charts/armiarma/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "armiarma.fullname" . }}
labels:
{{- include "armiarma.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ include "armiarma.metricsPort" . }}
targetPort: metrics
protocol: TCP
name: metrics
- port: {{ include "armiarma.ssePort" . }}
targetPort: sse
protocol: TCP
name: sse
{{- if .Values.extraPorts }}
{{ toYaml .Values.extraPorts | nindent 4}}
{{- end }}
selector:
{{- include "armiarma.selectorLabels" . | nindent 4 }}
Loading

0 comments on commit a10dfe7

Please sign in to comment.