Skip to content

Commit

Permalink
feat: boilerplate helm chart (#121)
Browse files Browse the repository at this point in the history
Signed-off-by: Deepak Mishra <deepak@swirldslabs.com>
  • Loading branch information
deepak-swirlds authored Jun 28, 2023
1 parent 6b40d2d commit 70c66ca
Show file tree
Hide file tree
Showing 9 changed files with 235 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/hedera-network/.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/
4 changes: 4 additions & 0 deletions charts/hedera-network/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v2
name: hedera-network
description: A Helm chart for the Hedera network
version: 0.1.0
2 changes: 2 additions & 0 deletions charts/hedera-network/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1. Get the application URL by running these commands:
...
17 changes: 17 additions & 0 deletions charts/hedera-network/templates/configmaps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: uploader-mirror-config
data:
# add your data here
property1: value1
property2: value2
---
apiVersion: v1
kind: ConfigMap
metadata:
name: backup-config
data:
# add your data here
property1: value1
property2: value2
52 changes: 52 additions & 0 deletions charts/hedera-network/templates/network-node-statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

{{ range $nodeName, $nodeConfig := ($.Values.hedera.nodes) }}
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: network-{{ $nodeName }}
labels:
app: network-{{ $nodeName }}
spec:
replicas: 1
serviceName: "network-node-{{ $nodeName }}"
selector:
matchLabels:
app: network-{{ $nodeName }}
template:
metadata:
labels:
app: network-{{ $nodeName }}
spec:
containers:
- name: root-container
image: {{ $.Values.infrastructure.docker.registry }}/{{ $.Values.infrastructure.docker.images.root }}
resources:
requests:
memory: 50Mi
cpu: {{ index (index $.Values.hedera.nodes $nodeName) "cpu" }}
limits:
memory: 100Mi
cpu: 100m
- name: record-stream-uploader
image: {{ $.Values.infrastructure.docker.registry }}/{{ $.Values.infrastructure.docker.images.streamuploader }}
envFrom:
- configMapRef:
name: uploader-mirror-config
- secretRef:
name: uploader-mirror-secrets
- name: event-stream-uploader
image: {{ $.Values.infrastructure.docker.registry }}/{{ $.Values.infrastructure.docker.images.streamuploader }}
envFrom:
- configMapRef:
name: uploader-mirror-config
- secretRef:
name: uploader-mirror-secrets
- name: backup-uploader
image: {{ $.Values.infrastructure.docker.registry }}/{{ $.Values.infrastructure.docker.images.backupuploader }}
envFrom:
- configMapRef:
name: backup-config
- secretRef:
name: backup-secrets
{{ end }}
59 changes: 59 additions & 0 deletions charts/hedera-network/templates/proxy-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{{ range $nodeName, $nodeConfig := ($.Values.hedera.nodes) }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: haproxy-{{ $nodeName }}
spec:
replicas: {{ $.Values.haproxyReplicaCount }}
selector:
matchLabels:
app: haproxy-{{ $nodeName }}
template:
metadata:
labels:
app: haproxy-{{ $nodeName }}
spec:
containers:
- name: haproxy
image: {{ $.Values.infrastructure.docker.registry }}/{{ $.Values.infrastructure.docker.images.haproxy }}
imagePullPolicy: Always
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: envoy-proxy-{{ $nodeName }}
spec:
replicas: {{ $.Values.envoyProxyReplicaCount }}
selector:
matchLabels:
app: envoy-proxy-{{ $nodeName }}
template:
metadata:
labels:
app: envoy-proxy-{{ $nodeName }}
spec:
containers:
- name: envoy-proxy
image: {{ $.Values.infrastructure.docker.registry }}/{{ $.Values.infrastructure.docker.images.envoyproxy }}
imagePullPolicy: Always
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: json-rpc-relay-{{ $nodeName }}
spec:
replicas: 1
selector:
matchLabels:
app: json-rpc-relay-{{ $nodeName }}
template:
metadata:
labels:
app: json-rpc-relay-{{ $nodeName }}
spec:
containers:
- name: json-rpc-relay
image: {{ $.Values.infrastructure.docker.registry }}/{{ $.Values.infrastructure.docker.images.jsonrpcrelay }}
imagePullPolicy: Always
{{- end }}
21 changes: 21 additions & 0 deletions charts/hedera-network/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v1
kind: Secret
metadata:
name: uploader-mirror-secrets
type: Opaque
data:
# add your secrets here
# Note: Kubernetes secrets should be base64 encoded
secret1: "c2VjcmV0"
secret2: "c2VjcmV0"
---
apiVersion: v1
kind: Secret
metadata:
name: backup-secrets
type: Opaque
data:
# add your secrets here
# Note: Kubernetes secrets should be base64 encoded
secret1: "c2VjcmV0"
secret2: "c2VjcmV0"
14 changes: 14 additions & 0 deletions charts/hedera-network/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{ range $nodeName, $nodeConfig := ($.Values.hedera.nodes) }}
---
apiVersion: v1
kind: Service
metadata:
name: service-network-{{ $nodeName }}
spec:
selector:
app: network-{{ $nodeName }}
ports:
- protocol: TCP
port: 50211
targetPort: 50211
{{- end }}
43 changes: 43 additions & 0 deletions charts/hedera-network/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
hedera:
# TODO: do we need an easy way (to avoid repetition) to create multiple notes if they all have the same configuration?
nodes:
node-1:
# TODO: Configuration like address ( and similar ), can be autogenerated by helm, do we need to think about this ?
address: 0.0.1
cpu: 1
memory: 1GB
latency: 10ms
bandwidth: 1 Mbps
node-2:
address: 0.0.2
cpu: 1
memory: 1GB
latency: 10ms
bandwidth: 2 Mbps
node-3:
address: 0.0.3
cpu: 1
memory: 1GB
latency: 10ms
bandwidth: 3 Mbps

infrastructure:
docker:
registry: docker.io
images:
root: docker:24.0.2-dind
envoyproxy: envoyproxy/envoy:v1.26-latest
haproxy: haproxy:lts-alpine3.18
jsonrpcrelay: jsonrpcrelay
streamuploader: ubuntu
backupuploader: ubuntu

proxies:
# 1 Haproxy Deployment is created for 1 hedera network node (StatefulSet)
# This controls how many replicas within a deployment are needed, in production we use 3
haproxyReplicas: 1
envoyProxyReplicas: 1




0 comments on commit 70c66ca

Please sign in to comment.