-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
1,340 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: v2 | ||
name: heimdall | ||
description: Polygon Heimdall consensus layer node Helm chart | ||
|
||
version: 0.0.1 | ||
appVersion: "1.0.1" | ||
|
||
keywords: | ||
- heimdall | ||
- polygon | ||
- matic | ||
- cryptocurrency | ||
- blockchain | ||
- consensus | ||
|
||
sources: | ||
- https://github.com/dysnix/charts | ||
|
||
maintainers: | ||
- name: VladStarr | ||
email: vlad.derigin@dysnix.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "heimdall.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 "heimdall.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 "heimdall.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "heimdall.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create -}} | ||
{{ default (include "heimdall.fullname" .) .Values.serviceAccount.name }} | ||
{{- else -}} | ||
{{ default "default" .Values.serviceAccount.name }} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "heimdall.labels" -}} | ||
helm.sh/chart: {{ include "heimdall.chart" . }} | ||
app.kubernetes.io/name: {{ include "heimdall.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "heimdall.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "heimdall.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- with .Values.podLabels }} | ||
{{ toYaml . | indent 0 }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Convert Golang slice to Toml array | ||
*/}} | ||
{{- define "toml.list" -}} | ||
{{- print "[" }} | ||
{{- range $idx, $element := . }} | ||
{{- if $idx }}, {{ end }} | ||
{{- $element | quote }} | ||
{{- end -}} | ||
{{ print "]" -}} | ||
{{- end }} | ||
|
||
{{/* | ||
Render Toml properties | ||
*/}} | ||
{{- define "toml.properties" -}} | ||
{{- $root := index . 0 }} | ||
{{- $context := index . 1 }} | ||
{{- range $k, $v := $root }} | ||
{{- if not (kindIs "map" $v) }} | ||
{{- if kindIs "string" $v }} | ||
{{- if contains "{{" $v }} {{- /* render templated values */}} | ||
{{- $v = tpl $v $context }} | ||
{{- if not (or (regexMatch "^[0-9]+$" $v) (regexMatch "^(true|false)$" $v)) }} | ||
{{- $v = quote $v }} | ||
{{- end }} | ||
{{- else }} | ||
{{- $v = quote $v }} | ||
{{- end }} | ||
{{- else if or (kindIs "int" $v) (kindIs "float64" $v) }} | ||
{{- $v = int $v }} | ||
{{- else if kindIs "slice" $v }} | ||
{{- $v = include "toml.list" $v }} | ||
{{- end }} | ||
{{- if contains "." $k }} | ||
{{- $k = quote $k }} | ||
{{- end }} | ||
{{ $k }} = {{ $v }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Render full Toml config including tables | ||
*/}} | ||
{{- define "toml.config" -}} | ||
{{- $context := index . 0 }} | ||
{{- $root := index . 1 }} | ||
{{- include "toml.properties" (list $root $context) }} {{- /* top-level table */}} | ||
{{- range $k, $v := $root }} | ||
{{- if kindIs "map" $v }} | ||
{{- if contains "." $k }} | ||
{{- $k = quote $k }} | ||
{{- end }} | ||
|
||
[{{ $k }}] | ||
{{- include "toml.properties" (list $v $context) }} {{- /* 1st-level table */}} | ||
{{- range $i, $j := $v }} | ||
{{- if kindIs "map" $j }} | ||
{{- if contains "." $i }} | ||
{{- $i = quote $i }} | ||
{{- end }} | ||
{{- $i = print $k "." $i }} | ||
|
||
[{{ $i }}] | ||
{{- include "toml.properties" (list $j $context) }} {{- /* 2nd-level table */}} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "heimdall.healthcheck" -}} | ||
{{- $context := index . 0 }} | ||
{{- $root := index . 1 }} | ||
{{- if and $root.exec (kindIs "string" $root.exec.command) }} | ||
{{- omit $root "enabled" "exec" | toYaml }} | ||
exec: | ||
command: | ||
{{- tpl $root.exec.command $context | nindent 4 }} | ||
{{- else }} | ||
{{- omit $root "enabled" | toYaml }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "heimdall.fullname" . }}-scripts | ||
labels: | ||
{{- include "heimdall.labels" . | nindent 4 }} | ||
data: | ||
init-genesis.sh: |- | ||
{{- include (print $.Template.BasePath "/scripts/_init-genesis.tpl") . | nindent 4 }} | ||
download-snapshot.sh: |- | ||
{{- include (print $.Template.BasePath "/scripts/_download-snapshot.tpl") . | nindent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "heimdall.fullname" . }}-config | ||
labels: | ||
{{- include "heimdall.labels" . | nindent 4 }} | ||
data: | ||
config.toml: |- | ||
{{- include "toml.config" (list $ .Values.tendermintConfig) | indent 4 }} | ||
heimdall-config.toml: |- | ||
{{- include "toml.config" (list $ .Values.heimdallConfig) | indent 4 }} | ||
app.toml: |- | ||
{{- include "toml.config" (list $ .Values.appConfig) | indent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{{- if and .Values.services.rest.enabled .Values.ingress.rest.enabled -}} | ||
{{- $fullName := include "heimdall.fullname" . -}} | ||
{{- $svcPort := .Values.services.rest.port -}} | ||
{{- if and .Values.ingress.rest.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} | ||
{{- if not (hasKey .Values.ingress.rest.annotations "kubernetes.io/ingress.class") }} | ||
{{- $_ := set .Values.ingress.rest.annotations "kubernetes.io/ingress.class" .Values.ingress.rest.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 }}-rest | ||
labels: | ||
{{- include "heimdall.labels" . | nindent 4 }} | ||
{{- with .Values.ingress.rest.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if and .Values.ingress.rest.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} | ||
ingressClassName: {{ .Values.ingress.rest.className }} | ||
{{- end }} | ||
{{- if .Values.ingress.rest.tls }} | ||
tls: | ||
{{- range .Values.ingress.rest.tls }} | ||
- hosts: | ||
{{- range .hosts }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
secretName: {{ .secretName }} | ||
{{- end }} | ||
{{- end }} | ||
rules: | ||
{{- range .Values.ingress.rest.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 }}-rest | ||
port: | ||
number: {{ $svcPort }} | ||
{{- else }} | ||
serviceName: {{ $fullName }}-rest | ||
servicePort: {{ $svcPort }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{{- if and .Values.services.rpc.enabled .Values.ingress.rpc.enabled -}} | ||
{{- $fullName := include "heimdall.fullname" . -}} | ||
{{- $svcPort := .Values.services.rpc.port -}} | ||
{{- if and .Values.ingress.rpc.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} | ||
{{- if not (hasKey .Values.ingress.rpc.annotations "kubernetes.io/ingress.class") }} | ||
{{- $_ := set .Values.ingress.rpc.annotations "kubernetes.io/ingress.class" .Values.ingress.rpc.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 }}-rpc | ||
labels: | ||
{{- include "heimdall.labels" . | nindent 4 }} | ||
{{- with .Values.ingress.rpc.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if and .Values.ingress.rpc.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} | ||
ingressClassName: {{ .Values.ingress.rpc.className }} | ||
{{- end }} | ||
{{- if .Values.ingress.rpc.tls }} | ||
tls: | ||
{{- range .Values.ingress.rpc.tls }} | ||
- hosts: | ||
{{- range .hosts }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
secretName: {{ .secretName }} | ||
{{- end }} | ||
{{- end }} | ||
rules: | ||
{{- range .Values.ingress.rpc.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 }}-rpc | ||
port: | ||
number: {{ $svcPort }} | ||
{{- else }} | ||
serviceName: {{ $fullName }}-rpc | ||
servicePort: {{ $svcPort }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
if [ ! -f /data/.downloaded ]; then | ||
apt-get -y update && apt-get -y install wget | ||
wget -qO download.sh https://snapshot-download.polygon.technology/snapdown.sh | ||
sed -i 's/sudo//g' download.sh | ||
chmod +x download.sh | ||
|
||
./download.sh --network {{ .Values.network }} --client heimdall --extract-dir /data/data --validate-checksum true | ||
touch /data/.downloaded | ||
else | ||
echo "Initial snapshot already downloaded, skipping." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
if [ ! -f /data/.initialized ]; then | ||
/usr/bin/heimdalld init --home /data | ||
wget -O /data/config/genesis.json {{ .Values.init.genesis.url }} | ||
touch /data/.initialized | ||
else | ||
echo "Heimdall is already initialized, skipping init." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{{- with .Values.services.metrics }} | ||
{{- if .enabled }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "heimdall.fullname" $ }}-metrics | ||
{{- with .annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
labels: | ||
service-type: metrics | ||
{{- include "heimdall.labels" $ | nindent 4 }} | ||
spec: | ||
type: {{ .type }} | ||
{{- with .loadBalancerIP }} | ||
loadBalancerIP: {{ . }} | ||
{{- end }} | ||
{{- with .clusterIP }} | ||
clusterIP: {{ . }} | ||
{{- end }} | ||
{{- with .externalTrafficPolicy }} | ||
externalTrafficPolicy: {{ . }} | ||
{{- end }} | ||
{{- with .internalTrafficPolicy }} | ||
internalTrafficPolicy: {{ . }} | ||
{{- end }} | ||
{{- with .publishNotReadyAddresses }} | ||
publishNotReadyAddresses: {{ . }} | ||
{{- end }} | ||
ports: | ||
- name: metrics | ||
port: {{ .port }} | ||
targetPort: metrics | ||
{{- with .nodePort }} | ||
nodePort: {{ . }} | ||
{{- end }} | ||
selector: | ||
{{- include "heimdall.selectorLabels" $ | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.