Skip to content

Commit

Permalink
rename chart to aztec-network.
Browse files Browse the repository at this point in the history
add proper smoke test
  • Loading branch information
just-mitch committed Aug 20, 2024
1 parent 7f852cd commit 9e60d71
Show file tree
Hide file tree
Showing 19 changed files with 177 additions and 77 deletions.
6 changes: 3 additions & 3 deletions helm-charts/aztec-network/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: spartan-network
description: A Helm chart for deploying the spartan-network
name: aztec-network
description: A Helm chart for deploying the aztec network
type: application
version: 0.1.0
appVersion: '1.0.0'
appVersion: "1.0.0"
24 changes: 12 additions & 12 deletions helm-charts/aztec-network/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "spartan-network.name" -}}
{{- define "aztec-network.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "spartan-network.chart" -}}
{{- define "aztec-network.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

Expand All @@ -17,7 +17,7 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "spartan-network.fullname" -}}
{{- define "aztec-network.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -33,9 +33,9 @@ If release name contains chart name it will be used as a full name.
{{/*
Common labels
*/}}
{{- define "spartan-network.labels" -}}
helm.sh/chart: {{ include "spartan-network.chart" . }}
{{ include "spartan-network.selectorLabels" . }}
{{- define "aztec-network.labels" -}}
helm.sh/chart: {{ include "aztec-network.chart" . }}
{{ include "aztec-network.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -45,15 +45,15 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "spartan-network.selectorLabels" -}}
app.kubernetes.io/name: {{ include "spartan-network.name" . }}
{{- define "aztec-network.selectorLabels" -}}
app.kubernetes.io/name: {{ include "aztec-network.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "spartan-network.ethereumHost" -}}
http://{{ include "spartan-network.fullname" . }}-ethereum.{{ .Release.Namespace }}:{{ .Values.ethereum.service.port }}
{{- define "aztec-network.ethereumHost" -}}
http://{{ include "aztec-network.fullname" . }}-ethereum.{{ .Release.Namespace }}:{{ .Values.ethereum.service.port }}
{{- end -}}

{{- define "spartan-network.pxeUrl" -}}
http://{{ include "spartan-network.fullname" . }}-pxe.{{ .Release.Namespace }}:{{ .Values.pxe.service.port }}
{{- define "aztec-network.pxeUrl" -}}
http://{{ include "aztec-network.fullname" . }}-pxe.{{ .Release.Namespace }}:{{ .Values.pxe.service.port }}
{{- end -}}
8 changes: 4 additions & 4 deletions helm-charts/aztec-network/templates/anvil.deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "spartan-network.fullname" . }}-ethereum
name: {{ include "aztec-network.fullname" . }}-ethereum
labels:
{{- include "spartan-network.labels" . | nindent 4 }}
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.ethereum.replicas }}
selector:
matchLabels:
{{- include "spartan-network.selectorLabels" . | nindent 6 }}
{{- include "aztec-network.selectorLabels" . | nindent 6 }}
app: ethereum
template:
metadata:
labels:
{{- include "spartan-network.selectorLabels" . | nindent 8 }}
{{- include "aztec-network.selectorLabels" . | nindent 8 }}
app: ethereum
spec:
containers:
Expand Down
6 changes: 3 additions & 3 deletions helm-charts/aztec-network/templates/anvil.service.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "spartan-network.fullname" . }}-ethereum
name: {{ include "aztec-network.fullname" . }}-ethereum
labels:
{{- include "spartan-network.labels" . | nindent 4 }}
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
type: {{ .Values.ethereum.service.type }}
selector:
{{- include "spartan-network.selectorLabels" . | nindent 4 }}
{{- include "aztec-network.selectorLabels" . | nindent 4 }}
app: ethereum
ports:
- protocol: TCP
Expand Down
6 changes: 3 additions & 3 deletions helm-charts/aztec-network/templates/boot-node.service.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "spartan-network.fullname" . }}-boot-node
name: {{ include "aztec-network.fullname" . }}-boot-node
labels:
{{- include "spartan-network.labels" . | nindent 4 }}
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
clusterIP: None
selector:
{{- include "spartan-network.selectorLabels" . | nindent 4 }}
{{- include "aztec-network.selectorLabels" . | nindent 4 }}
app: boot-node
ports:
- port: {{ .Values.bootNode.service.p2pPort }}
Expand Down
20 changes: 10 additions & 10 deletions helm-charts/aztec-network/templates/boot-node.stateful-set.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "spartan-network.fullname" . }}-boot-node
name: {{ include "aztec-network.fullname" . }}-boot-node
labels:
{{- include "spartan-network.labels" . | nindent 4 }}
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
serviceName: {{ include "spartan-network.fullname" . }}-boot-node
serviceName: {{ include "aztec-network.fullname" . }}-boot-node
replicas: {{ .Values.bootNode.replicas }}
selector:
matchLabels:
{{- include "spartan-network.selectorLabels" . | nindent 6 }}
{{- include "aztec-network.selectorLabels" . | nindent 6 }}
app: boot-node
template:
metadata:
labels:
{{- include "spartan-network.selectorLabels" . | nindent 8 }}
{{- include "aztec-network.selectorLabels" . | nindent 8 }}
app: boot-node
spec:
initContainers:
Expand All @@ -26,7 +26,7 @@ spec:
- |
until curl -s -X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' \
{{ include "spartan-network.ethereumHost" . }} | grep -q anvil; do
{{ include "aztec-network.ethereumHost" . }} | grep -q anvil; do
echo "Waiting for Ethereum node..."
sleep 5
done
Expand All @@ -46,7 +46,7 @@ spec:
mountPath: /scripts
env:
- name: ETHEREUM_HOST
value: {{ include "spartan-network.ethereumHost" . | quote }}
value: {{ include "aztec-network.ethereumHost" . | quote }}
containers:
- name: aztec
image: {{ .Values.images.aztec.image }}
Expand All @@ -69,15 +69,15 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: POD_DNS_NAME
value: "$(POD_NAME).{{ include "spartan-network.fullname" . }}-boot-node.$(POD_NAMESPACE).svc.cluster.local"
value: "$(POD_NAME).{{ include "aztec-network.fullname" . }}-boot-node.$(POD_NAMESPACE).svc.cluster.local"
- name: PORT
value: "{{ .Values.bootNode.service.nodePort }}"
- name: LOG_LEVEL
value: "{{ .Values.bootNode.logLevel }}"
- name: DEBUG
value: "{{ .Values.bootNode.debug }}"
- name: ETHEREUM_HOST
value: {{ include "spartan-network.ethereumHost" . | quote }}
value: {{ include "aztec-network.ethereumHost" . | quote }}
- name: P2P_ENABLED
value: "{{ .Values.bootNode.p2p.enabled }}"
- name: P2P_TCP_ANNOUNCE_ADDR
Expand All @@ -100,4 +100,4 @@ spec:
emptyDir: {}
- name: scripts
configMap:
name: {{ include "spartan-network.fullname" . }}-deploy-contracts-script
name: {{ include "aztec-network.fullname" . }}-deploy-contracts-script
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "spartan-network.fullname" . }}-configure-validator-env
name: {{ include "aztec-network.fullname" . }}-configure-validator-env
labels:
{{- include "spartan-network.labels" . | nindent 4 }}
{{- include "aztec-network.labels" . | nindent 4 }}
data:
configure-validator-env.sh: |
#!/bin/sh
set -e
# Ask the bootnode for l1 contract addresses
output=$(node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js get-node-info -u http://{{ include "spartan-network.fullname" . }}-boot-node-0.{{ include "spartan-network.fullname" . }}-boot-node.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.bootNode.service.nodePort }})
output=$(node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js get-node-info -u http://{{ include "aztec-network.fullname" . }}-boot-node-0.{{ include "aztec-network.fullname" . }}-boot-node.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.bootNode.service.nodePort }})
echo "$output"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "spartan-network.fullname" . }}-deploy-contracts-script
name: {{ include "aztec-network.fullname" . }}-deploy-contracts-script
labels:
{{- include "spartan-network.labels" . | nindent 4 }}
{{- include "aztec-network.labels" . | nindent 4 }}
data:
deploy-contracts.sh: |
#!/bin/sh
Expand Down
28 changes: 22 additions & 6 deletions helm-charts/aztec-network/templates/pxe.deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "spartan-network.fullname" . }}-pxe
name: {{ include "aztec-network.fullname" . }}-pxe
labels:
{{- include "spartan-network.labels" . | nindent 4 }}
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.pxe.replicas }}
selector:
matchLabels:
{{- include "spartan-network.selectorLabels" . | nindent 6 }}
{{- include "aztec-network.selectorLabels" . | nindent 6 }}
app: pxe
template:
metadata:
labels:
{{- include "spartan-network.selectorLabels" . | nindent 8 }}
{{- include "aztec-network.selectorLabels" . | nindent 8 }}
app: pxe
spec:
containers:
Expand All @@ -26,12 +26,28 @@ spec:
node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --pxe
env:
- name: ETHEREUM_HOST
value: "http://{{ include "spartan-network.fullname" . }}-ethereum.{{ .Release.Namespace }}:{{ .Values.ethereum.service.port }}"
value: "http://{{ include "aztec-network.fullname" . }}-ethereum.{{ .Release.Namespace }}:{{ .Values.ethereum.service.port }}"
- name: AZTEC_NODE_URL
value: "http://{{ include "spartan-network.fullname" . }}-boot-node-0.{{ include "spartan-network.fullname" . }}-boot-node.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.bootNode.service.nodePort }}"
value: "http://{{ include "aztec-network.fullname" . }}-boot-node-0.{{ include "aztec-network.fullname" . }}-boot-node.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.bootNode.service.nodePort }}"
ports:
- name: http
containerPort: {{ .Values.pxe.service.port }}
protocol: TCP
readinessProbe:
exec:
command:
- /bin/bash
- -c
- |
curl -s -X POST -H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","method":"pxe_getNodeInfo","params":[],"id":67}' \
127.0.0.1:{{ .Values.pxe.service.port }} > /tmp/probe_output.txt && \
cat /tmp/probe_output.txt && \
grep -q '"enr:-' /tmp/probe_output.txt
initialDelaySeconds: {{ .Values.pxe.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.pxe.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.pxe.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.pxe.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.pxe.readinessProbe.failureThreshold }}
resources:
{{- toYaml .Values.pxe.resources | nindent 12 }}
6 changes: 3 additions & 3 deletions helm-charts/aztec-network/templates/pxe.service.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "spartan-network.fullname" . }}-pxe
name: {{ include "aztec-network.fullname" . }}-pxe
labels:
{{- include "spartan-network.labels" . | nindent 4 }}
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
type: {{ .Values.pxe.service.type }}
selector:
{{- include "spartan-network.selectorLabels" . | nindent 4 }}
{{- include "aztec-network.selectorLabels" . | nindent 4 }}
app: pxe
ports:
- protocol: TCP
Expand Down
5 changes: 2 additions & 3 deletions helm-charts/aztec-network/templates/tests/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ apiVersion: v1
kind: Pod
metadata:
name: "{{ .Release.Name }}-test"
labels:
{{- include "spartan-network.labels" . | nindent 4 }}
labels: {{- include "aztec-network.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
Expand All @@ -17,4 +16,4 @@ spec:
- name: SCENARIO
value: {{ .Values.scenario }}
- name: PXE_URL
value: {{ include "spartan-network.pxeUrl" . | quote }}
value: {{ include "aztec-network.pxeUrl" . | quote }}
6 changes: 3 additions & 3 deletions helm-charts/aztec-network/templates/validator.service.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "spartan-network.fullname" . }}-validator
name: {{ include "aztec-network.fullname" . }}-validator
labels:
{{- include "spartan-network.labels" . | nindent 4 }}
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
clusterIP: None
selector:
{{- include "spartan-network.selectorLabels" . | nindent 4 }}
{{- include "aztec-network.selectorLabels" . | nindent 4 }}
app: validator
ports:
- port: {{ .Values.validator.service.p2pPort }}
Expand Down
18 changes: 9 additions & 9 deletions helm-charts/aztec-network/templates/validator.stateful-set.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "spartan-network.fullname" . }}-validator
name: {{ include "aztec-network.fullname" . }}-validator
labels:
{{- include "spartan-network.labels" . | nindent 4 }}
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
serviceName: {{ include "spartan-network.fullname" . }}-validator
serviceName: {{ include "aztec-network.fullname" . }}-validator
replicas: {{ .Values.validator.replicas }}
selector:
matchLabels:
{{- include "spartan-network.selectorLabels" . | nindent 6 }}
{{- include "aztec-network.selectorLabels" . | nindent 6 }}
app: validator
template:
metadata:
labels:
{{- include "spartan-network.selectorLabels" . | nindent 8 }}
{{- include "aztec-network.selectorLabels" . | nindent 8 }}
app: validator
spec:
initContainers:
Expand All @@ -32,7 +32,7 @@ spec:
mountPath: /scripts
env:
- name: ETHEREUM_HOST
value: {{ include "spartan-network.ethereumHost" . | quote }}
value: {{ include "aztec-network.ethereumHost" . | quote }}
containers:
- name: aztec
image: "{{ .Values.images.aztec.image }}"
Expand All @@ -54,15 +54,15 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: POD_DNS_NAME
value: "$(POD_NAME).{{ include "spartan-network.fullname" . }}-validator.$(POD_NAMESPACE).svc.cluster.local"
value: "$(POD_NAME).{{ include "aztec-network.fullname" . }}-validator.$(POD_NAMESPACE).svc.cluster.local"
- name: PORT
value: "{{ .Values.validator.service.nodePort }}"
- name: LOG_LEVEL
value: "{{ .Values.validator.logLevel }}"
- name: DEBUG
value: "{{ .Values.validator.debug }}"
- name: ETHEREUM_HOST
value: {{ include "spartan-network.ethereumHost" . | quote }}
value: {{ include "aztec-network.ethereumHost" . | quote }}
- name: P2P_ENABLED
value: "{{ .Values.validator.p2p.enabled }}"
- name: P2P_TCP_ANNOUNCE_ADDR
Expand All @@ -83,4 +83,4 @@ spec:
emptyDir: {}
- name: scripts
configMap:
name: {{ include "spartan-network.fullname" . }}-configure-validator-env
name: {{ include "aztec-network.fullname" . }}-configure-validator-env
Loading

0 comments on commit 9e60d71

Please sign in to comment.