diff --git a/deployment/charts/Chart.yaml b/deployment/charts/Chart.yaml index 587d442b3a7..96c22540b10 100644 --- a/deployment/charts/Chart.yaml +++ b/deployment/charts/Chart.yaml @@ -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 diff --git a/deployment/charts/templates/fuel-core-deploy.yaml b/deployment/charts/templates/fuel-core-deploy.yaml index e228daf44b3..93a8e4c9923 100644 --- a/deployment/charts/templates/fuel-core-deploy.yaml +++ b/deployment/charts/templates/fuel-core-deploy.yaml @@ -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 @@ -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 }}" @@ -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 @@ -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: diff --git a/deployment/charts/values.yaml b/deployment/charts/values.yaml index 665c840437e..08c0cac5cd1 100644 --- a/deployment/charts/values.yaml +++ b/deployment/charts/values.yaml @@ -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}" @@ -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 diff --git a/deployment/ingress/eks/fuel-core-ingress.yaml b/deployment/ingress/eks/fuel-core-ingress.yaml index 4c033f353b9..56cd09f8c46 100644 --- a/deployment/ingress/eks/fuel-core-ingress.yaml +++ b/deployment/ingress/eks/fuel-core-ingress.yaml @@ -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" @@ -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: diff --git a/deployment/scripts/.env b/deployment/scripts/.env index a0b36329c7d..3d4196fd068 100644 --- a/deployment/scripts/.env +++ b/deployment/scripts/.env @@ -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" \ No newline at end of file diff --git a/deployment/scripts/fuel-core-delete.sh b/deployment/scripts/fuel-core-delete.sh index 7e308f7517a..642fef4514c 100755 --- a/deployment/scripts/fuel-core-delete.sh +++ b/deployment/scripts/fuel-core-delete.sh @@ -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 \ diff --git a/deployment/scripts/fuel-core-deploy.sh b/deployment/scripts/fuel-core-deploy.sh index 6c266e354cd..2bacd180153 100755 --- a/deployment/scripts/fuel-core-deploy.sh +++ b/deployment/scripts/fuel-core-deploy.sh @@ -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 \