Skip to content

Commit

Permalink
[TF] Add health check for waypoint service in GCP testnet-addons
Browse files Browse the repository at this point in the history
Also, add a default for "gke_maintenance_policy" in the
aptos-node-testnet module.
  • Loading branch information
sionescu committed Jun 8, 2023
1 parent b998002 commit fb415a4
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
2 changes: 1 addition & 1 deletion terraform/aptos-node-testnet/gcp/addons.tf
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ resource "helm_release" "testnet-addons" {
}
ingress = {
gce_static_ip = "aptos-${local.workspace_name}-testnet-addons-ingress"
gce_managed_certificate = "aptos-${local.workspace_name}-testnet-addons"
gce_managed_certificate = "aptos-${local.workspace_name}-${var.zone_name}-testnet-addons"
}
load_test = {
fullnodeGroups = try(var.aptos_node_helm_values.fullnode.groups, [])
Expand Down
8 changes: 5 additions & 3 deletions terraform/aptos-node-testnet/gcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ module "validator" {
region = var.region

# DNS
zone_name = var.zone_name # keep empty if you don't want a DNS name
zone_project = var.zone_project
record_name = var.record_name
zone_name = var.zone_name # keep empty if you don't want a DNS name
zone_project = var.zone_project
record_name = var.record_name
workspace_dns = var.workspace_dns
# dns_prefix_name = var.dns_prefix_name
# do not create the main fullnode and validator DNS records
# instead, rely on external-dns from the testnet-addons
create_dns_records = var.create_dns_records
Expand Down
8 changes: 7 additions & 1 deletion terraform/aptos-node-testnet/gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,11 @@ variable "gke_maintenance_policy" {
recurrence = string
})
})
default = null
default = {
recurring_window = {
start_time = "2023-06-01T14:00:00Z"
end_time = "2023-06-01T18:00:00Z"
recurrence = "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR"
}
}
}
28 changes: 25 additions & 3 deletions terraform/helm/testnet-addons/templates/waypoint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ metadata:
{{- include "testnet-addons.labels" . | nindent 4 }}
app: {{ include "testnet-addons.fullname" . }}-waypoint
annotations:
alb.ingress.kubernetes.io/healthcheck-path: /health
{{- if eq .Values.cloud "EKS" }}
alb.ingress.kubernetes.io/healthcheck-path: /waypoint.txt
{{- end }}
{{- if eq .Values.cloud "GKE" }}
cloud.google.com/backend-config: '{"default":"{{ include "testnet-addons.fullname" . }}-waypoint"}'
cloud.google.com/neg: '{"ingress": true}'
{{- end }}
spec:
selector:
{{- include "testnet-addons.selectorLabels" . | nindent 4 }}
Expand All @@ -15,9 +21,25 @@ spec:
- port: 80
targetPort: 8080
type: NodePort

---

{{- if eq .Values.cloud "GKE" }}
apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
name: {{ include "testnet-addons.fullname" . }}-waypoint
namespace: default
spec:
healthCheck:
checkIntervalSec: 30
timeoutSec: 5
healthyThreshold: 1
unhealthyThreshold: 2
type: HTTP
requestPath: /waypoint.txt
# container targetPort
port: 8080
{{- end }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down

0 comments on commit fb415a4

Please sign in to comment.