diff --git a/terraform/fullnode/fullnode/templates/service.yaml b/terraform/fullnode/fullnode/templates/service.yaml index 096068a350268..7e1960cef8c96 100644 --- a/terraform/fullnode/fullnode/templates/service.yaml +++ b/terraform/fullnode/fullnode/templates/service.yaml @@ -1,3 +1,40 @@ +{{- $fullName := include "pfn.fullname" . -}} +{{- $labels := include "pfn.labels" . -}} +{{- $domain := .Values.service.domain -}} +{{- $loadBalancerSourceRanges := .Values.service.fullnode.loadBalancerSourceRanges -}} + +{{- if .Values.service.fullnode.enableOnchainDiscovery }} +# create internet facing network address for fullnode +# to allow onchain discovery +{{- range $i, $e := .Values.service.fullnode.numFullnodes | int | until }} +apiVersion: v1 +kind: Service +metadata: + name: {{ printf "%s-fullnode-%d" $fullName $i | quote }} + labels: + {{- $labels | nindent 4 }} + annotations: + service.beta.kubernetes.io/aws-load-balancer-type: nlb + {{- if $domain }} + external-dns.alpha.kubernetes.io/hostname: {{ printf "pfn%d.%s" $i $domain | quote }} + {{- end }} + alb.ingress.kubernetes.io/healthcheck-path: /-/healthy +spec: + selector: + app.kubernetes.io/instance: {{ printf "pfn%d" $i | quote }} + app.kubernetes.io/part-of: aptos-fullnode + app.kubernetes.io/name: fullnode + ports: + - name: aptosnet + port: 6182 + type: LoadBalancer + externalTrafficPolicy: Local + loadBalancerSourceRanges: + {{- toYaml $loadBalancerSourceRanges | nindent 4 }} +--- +{{- end }} +{{- end }} + {{- if .Values.service.fullnode.exposeApi }} apiVersion: v1 kind: Service diff --git a/terraform/fullnode/fullnode/values.yaml b/terraform/fullnode/fullnode/values.yaml index 59a9ec40a1879..ffbc64670b822 100644 --- a/terraform/fullnode/fullnode/values.yaml +++ b/terraform/fullnode/fullnode/values.yaml @@ -16,6 +16,7 @@ service: fullnode: numFullnodes: exposeApi: true + enableOnchainDiscovery: false loadBalancerSourceRanges: domain: aws_tags: diff --git a/terraform/fullnode/main.tf b/terraform/fullnode/main.tf index fffa619ed479e..93b2f6b9b3487 100644 --- a/terraform/fullnode/main.tf +++ b/terraform/fullnode/main.tf @@ -114,7 +114,6 @@ resource "helm_release" "fullnode" { wait = false values = [ - jsonencode(var.fullnode_helm_values), jsonencode({ chain = { era = var.era @@ -132,6 +131,8 @@ resource "helm_release" "fullnode" { class = "gp2" } }), + jsonencode(var.fullnode_helm_values), + jsonencode(var.fullnode_helm_values_list == {} ? {} : var.fullnode_helm_values_list[count.index]), ] set { @@ -149,7 +150,6 @@ resource "helm_release" "pfn-logger" { wait = false values = [ - jsonencode(var.pfn_logger_helm_values), jsonencode({ logger = { name = "pfn" @@ -158,6 +158,7 @@ resource "helm_release" "pfn-logger" { name = "aptos-${terraform.workspace}" } }), + jsonencode(var.pfn_logger_helm_values), ] set { diff --git a/terraform/fullnode/variables.tf b/terraform/fullnode/variables.tf index 5fcae15ea8d1b..ba36d795fe5c0 100644 --- a/terraform/fullnode/variables.tf +++ b/terraform/fullnode/variables.tf @@ -74,6 +74,12 @@ variable "fullnode_helm_values" { default = {} } +variable "fullnode_helm_values_list" { + description = "List of values to pass to public fullnode, for setting different value per node. length(fullnode_helm_values_list) must equal var.num_fullnodes" + type = any + default = {} +} + variable "zone_id" { description = "Route53 Zone ID to create records in" default = ""