Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add graph-node to charts. #1489

Merged
merged 20 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
387 changes: 188 additions & 199 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions charts/deploy.just
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ deploy-metrics-server:
deploy-ingress-controller:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml

deploy-graph-node namespace=defaultNamespace: (deploy-chart "graph-node" namespace)
delete-graph-node namespace=defaultNamespace: (delete-chart "graph-node" namespace)
delete-graph-node-pvc namespace=defaultNamespace:
kubectl delete pvc -n namespace \
-l 'app.kubernetes.io/instance=graph-node-chart' \
-o name | xargs -r kubectl delete -n ${namespace} && \
kubectl delete pvc -n namespace \
-l 'app.kubernetes.io/managed-by=Helm' \
--field-selector 'metadata.name in (ipfs-pvc,postgres-pvc)'

[private]
deploy-celestia-local namespace=defaultNamespace: (deploy-chart "celestia-local" namespace)

Expand Down
23 changes: 23 additions & 0 deletions charts/graph-node/.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/
13 changes: 13 additions & 0 deletions charts/graph-node/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v2
name: graph-node
description: A Helm chart for Graph Node deployment
version: 0.1.0
appVersion: "0.0.1"

maintainers:
- name: wafflesvonmaple
url: astria.org
- name: quasystaty1
url: astria.org
- name: joroshiba
url: astria.org
7 changes: 7 additions & 0 deletions charts/graph-node/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- define "graph-node.name" -}}
{{ .Release.Name }}
{{- end }}

{{- define "graph-node.fullname" -}}
{{ include "graph-node.name" . }}-graph-node
{{- end }}
123 changes: 123 additions & 0 deletions charts/graph-node/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: graph-node
sambukowski marked this conversation as resolved.
Show resolved Hide resolved
namespace: {{ .Values.global.namespaceOverride | default .Release.Namespace }}
spec:
replicas: {{ .Values.graphNode.replicas }}
selector:
matchLabels:
app: graph-node
template:
metadata:
labels:
app: graph-node
spec:
containers:
- name: graph-node
image: {{ .Values.graphNode.image }}:{{ .Values.graphNode.tag }}
ports:
- containerPort: {{ .Values.graphNode.ports.http | default 8000 }}
- containerPort: {{ .Values.graphNode.ports.jsonRpc | default 8001 }}
- containerPort: {{ .Values.graphNode.ports.indexNode | default 8020 }}
- containerPort: {{ .Values.graphNode.ports.metrics | default 8030 }}
- containerPort: {{ .Values.graphNode.ports.subgraphMetrics | default 8040 }}
env:
- name: postgres_host
value: postgres
- name: postgres_user
value: {{ .Values.postgres.user }}
- name: postgres_pass
value: {{ .Values.postgres.password }}
- name: postgres_db
value: {{ .Values.postgres.database }}
- name: ipfs
value: ipfs:5001
- name: ethereum
value: {{ .Values.environment.ethereumNetwork }}:{{ .Values.environment.ethereumRPC }}
- name: GRAPH_LOG
value: info
sambukowski marked this conversation as resolved.
Show resolved Hide resolved

---
apiVersion: apps/v1
kind: StatefulSet
sambukowski marked this conversation as resolved.
Show resolved Hide resolved
metadata:
name: ipfs
namespace: {{ .Values.global.namespaceOverride | default .Release.Namespace }}
spec:
replicas: 1
selector:
matchLabels:
app: ipfs
template:
metadata:
labels:
app: ipfs
spec:
containers:
- name: ipfs
image: {{ .Values.ipfs.image }}:{{ .Values.ipfs.tag }}
ports:
- containerPort: {{ .Values.ipfs.ports.api | default 5001 }}
volumeMounts:
- name: ipfs-storage
mountPath: /data/ipfs
volumes:
- name: ipfs-storage
persistentVolumeClaim:
claimName: ipfs-pvc

sambukowski marked this conversation as resolved.
Show resolved Hide resolved
---
apiVersion: apps/v1
sambukowski marked this conversation as resolved.
Show resolved Hide resolved
kind: StatefulSet
metadata:
name: postgres
namespace: {{ .Values.global.namespaceOverride | default .Release.Namespace }}
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
securityContext:
fsGroup: 999
containers:
- name: postgres
image: {{ .Values.postgres.image }}:{{ .Values.postgres.tag }}
ports:
- containerPort: {{ .Values.postgres.ports.postgres | default 5432 }}
env:
- name: POSTGRES_USER
value: {{ .Values.postgres.user }}
- name: POSTGRES_PASSWORD
value: {{ .Values.postgres.password }}
- name: POSTGRES_DB
value: {{ .Values.postgres.database }}
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
- name: POSTGRES_INITDB_ARGS
value: "--lc-collate=C --lc-ctype=C --encoding=UTF8"
securityContext:
runAsUser: 999
runAsGroup: 999
volumeMounts:
- name: postgres-storage
mountPath: /var/lib/postgresql/data
readinessProbe:
exec:
command: ["pg_isready", "-U", "{{ .Values.postgres.user }}"]
initialDelaySeconds: 10
periodSeconds: 5
resources:
requests:
cpu: 100m
memory: 256Mi
volumes:
- name: postgres-storage
persistentVolumeClaim:
claimName: postgres-pvc
35 changes: 35 additions & 0 deletions charts/graph-node/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: graph-node
annotations:
{{- with .Values.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
rules:
- host: {{ .Values.ingress.host | quote }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: graph-node
port:
number: 8000
sambukowski marked this conversation as resolved.
Show resolved Hide resolved
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
{{- end }}
25 changes: 25 additions & 0 deletions charts/graph-node/templates/persistent-volume-claims.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ipfs-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.ipfs.storage.size }}
storageClassName: {{ .Values.persistence.storageClass }}

sambukowski marked this conversation as resolved.
Show resolved Hide resolved
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.postgres.storage.size }}
storageClassName: {{ .Values.persistence.storageClass }}
36 changes: 36 additions & 0 deletions charts/graph-node/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{{- if and .Values.serviceMonitor.enabled (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: graph-node-metrics
labels:
app: graph-node
{{- with .Values.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
jobLabel: graph-node-metrics
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
app: graph-node
endpoints:
- port: metrics
path: /metrics
{{- with .Values.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
- port: subgraph-metrics
path: /metrics
{{- with .Values.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- end }}
53 changes: 53 additions & 0 deletions charts/graph-node/templates/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
apiVersion: v1
kind: Service
metadata:
name: graph-node
namespace: {{ .Values.global.namespaceOverride | default .Release.Namespace }}
spec:
selector:
app: graph-node
ports:
sambukowski marked this conversation as resolved.
Show resolved Hide resolved
- name: http
port: {{ .Values.graphNode.ports.http | default 8000 }}
sambukowski marked this conversation as resolved.
Show resolved Hide resolved
targetPort: {{ .Values.graphNode.ports.http | default 8000 }}
- name: json-rpc
port: {{ .Values.graphNode.ports.jsonRpc | default 8001 }}
targetPort: {{ .Values.graphNode.ports.jsonRpc | default 8001 }}
- name: index-node
port: {{ .Values.graphNode.ports.indexNode | default 8020 }}
targetPort: {{ .Values.graphNode.ports.indexNode | default 8020 }}
- name: metrics
port: {{ .Values.graphNode.ports.metrics | default 8030 }}
targetPort: {{ .Values.graphNode.ports.metrics | default 8030 }}
- name: subgraph-metrics
port: {{ .Values.graphNode.ports.subgraphMetrics | default 8040 }}
targetPort: {{ .Values.graphNode.ports.subgraphMetrics | default 8040 }}

---
apiVersion: v1
kind: Service
metadata:
name: ipfs
namespace: {{ .Values.global.namespaceOverride | default .Release.Namespace }}
spec:
selector:
app: ipfs
ports:
- name: api
port: {{ .Values.ipfs.ports.api | default 5001 }}
targetPort: {{ .Values.ipfs.ports.api | default 5001 }}

---
apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: {{ .Values.global.namespaceOverride | default .Release.Namespace }}
spec:
selector:
app: postgres
ports:
- name: postgres
port: {{ .Values.postgres.ports.postgres | default 5432 }}
targetPort: {{ .Values.postgres.ports.postgres | default 5432 }}
Loading
Loading