Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split off the sync service #11

Merged
merged 5 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
go-lint-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v2
Expand Down
4 changes: 2 additions & 2 deletions helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ $ kubectl get pods
NAME READY STATUS RESTARTS AGE
mls-validation-service-75b6b96f79-kp4jq 1/1 Running 0 6h30m
pg-postgresql-0 1/1 Running 0 6h26m
xmtpd-7dd49f6b88-mfwls 1/1 Running 0 4h56m
xmtpd-7dd49f6b88-xdk6k 1/1 Running 0 4h56m
xmtpd-api-7dd49f6b88-mfwls 1/1 Running 0 4h56m
xmtpd-sync-7dd49f6b88-dn28d 1/1 Running 0 4h56m
```

## XMTP Payer Helm Chart Installation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "xmtpd.fullname" . }}
name: {{ include "xmtpd.fullname" . }}-api
labels:
{{- include "xmtpd.labels" . | nindent 4 }}
spec:
Expand Down Expand Up @@ -37,10 +37,10 @@ spec:
env:
- name: XMTPD_REPLICATION_ENABLE
value: "true"
- name: XMTPD_SYNC_ENABLE
value: "true"
- name: XMTPD_INDEXER_ENABLE
- name: XMTPD_METRICS_ENABLE
value: "true"
- name: XMTPD_METRICS_METRICS_ADDRESS
value: "0.0.0.0"
{{- include "helpers.list-env-variables" . | indent 12 }}
ports:
- name: grpc
Expand Down
74 changes: 74 additions & 0 deletions helm/xmtpd/templates/sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "xmtpd.fullname" . }}-sync
labels:
{{- include "xmtpd.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "xmtpd.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "xmtpd.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "xmtpd.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: XMTPD_SYNC_ENABLE
value: "true"
- name: XMTPD_INDEXER_ENABLE
value: "true"
- name: XMTPD_METRICS_ENABLE
value: "true"
- name: XMTPD_METRICS_METRICS_ADDRESS
value: "0.0.0.0"
{{- include "helpers.list-env-variables" . | indent 12 }}
readinessProbe:
httpGet:
path: /metrics
port: 8008
scheme: HTTP
failureThreshold: 3
periodSeconds: 10
livenessProbe:
httpGet:
path: /metrics
port: 8008
scheme: HTTP
failureThreshold: 3
periodSeconds: 10
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
2 changes: 1 addition & 1 deletion helm/xmtpd/values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Default values for xmtpd.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 2
replicaCount: 1

# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/
image:
Expand Down
18 changes: 12 additions & 6 deletions test/testlib/xmtp_xmtpd.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,26 @@ func startXMTPDTemplate(t *testing.T, options *helm.Options, replicaCount int, n
return
}

xmtpdDeployment := helmChartReleaseName
xmtpdDeploymentSync := fmt.Sprintf("%s-sync", helmChartReleaseName)
xmtpdDeploymentApi := fmt.Sprintf("%s-api", helmChartReleaseName)

defer func() {
// collect some useful diagnostics
if t.Failed() {
// ignore any errors. This is already failed
_ = k8s.RunKubectlE(t, kubectlOptions, "describe", "deployment", xmtpdDeployment)
_ = k8s.RunKubectlE(t, kubectlOptions, "describe", "deployment", xmtpdDeploymentSync)
_ = k8s.RunKubectlE(t, kubectlOptions, "describe", "deployment", xmtpdDeploymentApi)
}
}()

AwaitNrReplicasScheduled(t, namespaceName, xmtpdDeployment, replicaCount)
AwaitNrReplicasScheduled(t, namespaceName, xmtpdDeploymentSync, replicaCount)
AwaitNrReplicasScheduled(t, namespaceName, xmtpdDeploymentApi, replicaCount)

pods := FindPodsFromChart(t, namespaceName, xmtpdDeployment)
podsSync := FindPodsFromChart(t, namespaceName, xmtpdDeploymentSync)
podsApi := FindPodsFromChart(t, namespaceName, xmtpdDeploymentApi)

for _, pod := range pods {
allPods := append(podsSync, podsApi...)
for _, pod := range allPods {
AddTeardown(TEARDOWN_XMTPD, func() {
if t.Failed() {
// dump diagnostic info to test logs
Expand All @@ -90,7 +95,8 @@ func startXMTPDTemplate(t *testing.T, options *helm.Options, replicaCount int, n
})
}

AwaitNrReplicasReady(t, namespaceName, xmtpdDeployment, replicaCount)
AwaitNrReplicasReady(t, namespaceName, xmtpdDeploymentSync, replicaCount)
AwaitNrReplicasReady(t, namespaceName, xmtpdDeploymentApi, replicaCount)

return
}
Expand Down
2 changes: 1 addition & 1 deletion test/xmtp-helm/base_xmtpd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ func TestKubernetesBasicXMTPDInstall(t *testing.T) {
}

defer testlib.Teardown(testlib.TEARDOWN_XMTPD)
testlib.StartXMTPD(t, &options, 2, namespace)
testlib.StartXMTPD(t, &options, 1, namespace)
}
Loading