Skip to content

Commit

Permalink
Adding helm charts for sentry support (#954)
Browse files Browse the repository at this point in the history
Refs: #481
#647

---------

Co-authored-by: Green Baneling <XgreenX9999@gmail.com>
Co-authored-by: Brandon Kite <brandonkite92@gmail.com>
  • Loading branch information
3 people authored Feb 7, 2023
1 parent 2db10e1 commit 76cd64a
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 22 deletions.
4 changes: 2 additions & 2 deletions deployment/charts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: fuel-core
description: Fuel Core Helm Chart
name: ${fuel_core_service_name}
description: ${fuel_core_service_name} Helm Chart
type: application
appVersion: "0.16.1"
version: 0.1.0
64 changes: 57 additions & 7 deletions deployment/charts/templates/fuel-core-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ spec:
app: {{ template "fuel-core.name" . }}
ports:
- name: http
port: {{ .Values.app.httpport }}
port: {{ .Values.app.http_port }}
protocol: TCP
targetPort: {{ .Values.app.targetport }}
targetPort: {{ .Values.app.target_port }}
- name: p2p
port: {{ .Values.app.peering_port }}
protocol: TCP
targetPort: {{ .Values.app.peering_port }}
---
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -72,19 +76,57 @@ spec:
- "--ip"
- "0.0.0.0"
- "--port"
- "4000"
- "{{ .Values.app.target_port }}"
- "--db-path"
- "{{ .Values.app.volume.mountPath }}"
- "--chain"
- "/mnt/config/chainspec.json"
- "--min-gas-price"
- "{{ .Values.app.min_gas_price }}"
{{- if .Values.app.utxo_validation }}
- "--utxo-validation"
{{- end}}
{{- if .Values.app.vm_backtrace }}
- "--vm-backtrace"
{{- end}}
- "--min-gas-price"
- "{{ .Values.app.min_gas_price }}"
{{- if .Values.app.reserved_nodes_only_mode }}
- "--reserved_nodes_only_mode"
{{- end}}
{{- if .Values.app.poa_instant }}
- "--poa-instant"
- "{{ .Values.app.poa_instant }}"
{{- end}}
{{- if .Values.app.poa_interval_period }}
- "--poa-interval-period"
- "{{ .Values.app.poa_interval_period }}"
{{- end}}
{{- if .Values.app.poa_hybrid_min_time }}
- "--poa-hybrid-min-time"
- "{{ .Values.app.poa_hybrid_min_time }}"
{{- end}}
{{- if .Values.app.poa_hybrid_idle_time }}
- "--poa-hybrid-idle-time"
- "{{ .Values.app.poa_hybrid_idle_time }}"
{{- end}}
{{- if .Values.app.poa_hybrid_max_time }}
- "--poa-hybrid-max-time"
- "{{ .Values.app.poa_hybrid_max_time }}"
{{- end}}
{{- if .Values.app.p2p_key }}
- "--keypair"
- "{{ .Values.app.p2p_key }}"
{{- end }}
{{- if .Values.app.peering_port }}
- "--peering_port"
- "{{ .Values.app.peering_port }}"
{{- end }}
{{- if .Values.app.allow_private_addresses }}
- "--allow_private_addresses"
{{- end }}
{{- if .Values.app.network_name }}
- "--network"
- "{{ .Values.app.network_name }}"
{{- end }}
{{- if .Values.app.relayer }}
- "--relayer"
- "{{ .Values.app.relayer }}"
Expand Down Expand Up @@ -121,12 +163,15 @@ spec:
imagePullPolicy: {{ .Values.app.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.app.targetport }}
containerPort: {{ .Values.app.target_port }}
protocol: TCP
- name: p2p
containerPort: {{ .Values.app.peering_port }}
protocol: TCP
livenessProbe:
httpGet:
path: /health
port: {{ .Values.app.targetport }}
port: {{ .Values.app.target_port }}
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 10
Expand All @@ -138,6 +183,11 @@ spec:
env:
- name: HUMAN_LOGGING
value: {{ .Values.app.human_logging | quote }}
- name: RESERVED_NODES
value: {{ .Values.app.reserved_nodes | quote }}
- name: BOOTSTRAP_NODES
value: {{ .Values.app.bootstrap_nodes | quote }}
# TODO: do we need to do anything to make this more optional for non-consensus nodes?
- name: CONSENSUS_KEY_SECRET
valueFrom:
secretKeyRef:
Expand Down
23 changes: 17 additions & 6 deletions deployment/charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,26 @@
# Declare variables to be passed into your templates.

app:
name: fuel-core
name: ${fuel_core_service_name}
replicas: ${fuel_core_pod_replicas}
httpport: 80
httpsport: 443
targetport: 4000
http_port: 80
target_port: 4000
peering_port: 30333
network_name: ${fuel_core_network_name}
p2p_key: ${fuel_core_p2p_key}
allow_private_addresses: ${fuel_core_allow_private_addresses}
human_logging: ${fuel_core_human_logging}
utxo_validation: ${fuel_core_utxo_validation}
vm_backtrace: ${fuel_core_vm_backtrace}
min_gas_price: ${fuel_core_min_gas_price}
reserved_nodes_only_mode: ${fuel_core_reserved_only}
poa_instant: "${fuel_core_poa_instant}"
poa_interval_period: ${fuel_core_poa_interval_period}
poa_hybrid_min_time: ${fuel_core_poa_hybrid_min_time}
poa_hybrid_idle_time: ${fuel_core_poa_hybrid_idle_time}
poa_hybrid_max_time: ${fuel_core_poa_hybrid_max_time}
reserved_nodes: ${fuel_core_reserved_nodes}
bootstrap_nodes: ${fuel_core_bootstrap_nodes}
relayer: ${fuel_core_relayer}
relayer_v2_listening_contracts: ${fuel_core_relayer_v2_listening_contracts}
relayer_da_finalization: "${fuel_core_relayer_da_finalization}"
Expand All @@ -25,9 +36,9 @@ app:
tag: ${fuel_core_image_tag}
pullPolicy: Always
volume:
pvname: db-volume
pvname: ${fuel_core_pv_name}
mountPath: /mnt/db/
claimname: db-volume-pv-claim
claimname: ${fuel_core_pvc_name}
storageclass: ${pvc_storage_class}
storagerequests: ${pvc_storage_requests}
accessmodes: ReadWriteOnce
Expand Down
4 changes: 2 additions & 2 deletions deployment/ingress/eks/fuel-core-ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ${k8s_namespace}-ingress
name: ${fuel_core_service_name}-ingress
namespace: ${k8s_namespace}
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "7m"
Expand All @@ -20,7 +20,7 @@ spec:
pathType: Prefix
backend:
service:
name: fuel-core-service
name: ${fuel_core_service_name}-service
port:
number: ${fuel_core_ingress_http_port}
tls:
Expand Down
38 changes: 37 additions & 1 deletion deployment/scripts/.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,45 @@ fuel_core_human_logging=false
fuel_core_utxo_validation=true
fuel_core_vm_backtrace=false
fuel_core_min_gas_price=0
fuel_core_pv_name="db-pv"
fuel_core_pvc_name="db-pv-claim"

# consensus key secret
fuel_core_consensus_key_secret="dGVzdA=="

# The validator should have disabled production. It can be done by uncommenting the `fuel_core_poa_instant=false` below.
# fuel_core_poa_instant=false

# The block producer of the network should enable one of the three modes listed below.
# Either instant
# fuel_core_poa_instant=true
# Or interval, where teh value can be `10s` in seconds, `1m` minutes, or `1h` hours.
# fuel_core_poa_interval_period="3s"
# Or hybrid, all 3 fields should be set.
# fuel_core_poa_hybrid_min_time="2s"
# fuel_core_poa_hybrid_idle_time="500ms"
# fuel_core_poa_hybrid_max_time="1h"

# allow multiple fuel-core nodes in the same namespace, also used for setting up reserved nodes
fuel_core_service_name="fuel-core"

fuel_core_p2p_key="0x123123123123"
# disables discovery using internal ip addresses
fuel_core_allow_private_addresses=false
# A unique ID for this set of fuel core nodes, they will not connect to anyone with a different network name,
# so it should be the same for the network.
fuel_core_network_name="beta-3"
# whether we allow connections from non-reserved nodes
fuel_core_reserved_only=false
# a list of other fuel core's that we must always remain connected to
fuel_core_reserved_nodes="/dns4/test.test.svc.cluster.local/tcp/30333/p2p/16Uiu2HAmEB6RQuDfEZjvosRRundrEddfGqgRq51EReNV9E4pfDw5,/dns4/sentry-3/tcp/30333/16Uiu2HAmEB6RQuDfEZjvosRRundrEddfGqgRq51EReNV9E4pfDw5"
# Can be empty:
# fuel_core_bootstrap_nodes=""
# or with some predefined nodes:
# fuel_core_bootstrap_nodes="/dns4/test.test.svc.cluster.local/tcp/30333/p2p/16Uiu2HAmEB6RQuDfEZjvosRRundrEddfGqgRq51EReNV9E4pfDw5,/dns4/sentry-3/tcp/30333/16Uiu2HAmEB6RQuDfEZjvosRRundrEddfGqgRq51EReNV9E4pfDw5"


# Ingress Environment variables
fuel_core_ingress_dns="node.example.com"
fuel_core_ingress_secret="node-example-com"
fuel_core_ingress_http_port="80"
fuel_core_ingress_http_port="80"
2 changes: 1 addition & 1 deletion deployment/scripts/fuel-core-delete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ "${k8s_provider}" == "eks" ]; then
echo "Updating your kube context locally ...."
aws eks update-kubeconfig --name ${TF_VAR_eks_cluster_name}
echo "Deleting fuel-core helm chart on ${TF_VAR_eks_cluster_name} ...."
helm delete fuel-core \
helm delete ${fuel_core_service_name} \
--namespace ${k8s_namespace} \
--wait \
--timeout 8000s \
Expand Down
8 changes: 5 additions & 3 deletions deployment/scripts/fuel-core-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ if [ "${k8s_provider}" == "eks" ]; then
kubectl create ns ${k8s_namespace} || true
kubectl delete -f fuel-core-secret.yaml || true
kubectl apply -f fuel-core-secret.yaml
kubectl get secrets -n ${k8s_namespace} | grep fuel-core-secret
cd ../charts
mv Chart.yaml Chart.template
envsubst < Chart.template > Chart.yaml
rm Chart.template
mv values.yaml values.template
envsubst < values.template > values.yaml
rm values.template
echo "Deploying fuel-core helm chart to ${TF_VAR_eks_cluster_name} ...."
helm upgrade fuel-core . \
echo "Deploying ${fuel_core_service_name} helm chart to ${TF_VAR_eks_cluster_name} ...."
helm upgrade ${fuel_core_service_name} . \
--values values.yaml \
--install \
--create-namespace \
Expand Down

0 comments on commit 76cd64a

Please sign in to comment.