Skip to content

Commit 8ab97ad

Browse files
authored
feat(dir): dht test (#51)
* feat: initial dir network configs * fix: don't generate keyfile if exists * chore: update dirctl peer ID generation command * chore: use released chart Signed-off-by: Peter Balogh <p.balogh.sa@gmail.com>
1 parent 4352d2f commit 8ab97ad

File tree

3 files changed

+81
-6
lines changed

3 files changed

+81
-6
lines changed

integrations/Taskfile.yaml

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ vars:
1212
## Image config
1313
IMAGE_REPO: '{{ .IMAGE_REPO | default "ghcr.io/agntcy" }}'
1414
GATEWAY_IMAGE_TAG: '{{ .GATEWAY_IMAGE_TAG | default "0.3.2" }}'
15-
DIRECTORY_IMAGE_TAG: '{{ .DIRECTORY_IMAGE_TAG | default "v0.2.0" }}'
15+
DIRECTORY_IMAGE_TAG: '{{ .DIRECTORY_IMAGE_TAG | default "v0.2.1" }}'
1616

1717
IMAGE_BAKE_OPTS: '{{ .IMAGE_BAKE_OPTS | default "--set *.platform=linux/arm64" }}'
1818
TEST_APP_TAG: '{{ .TEST_APP_TAG | default "v0.0.3" }}'
@@ -21,8 +21,9 @@ vars:
2121
AZURE_OPENAI_ENDPOINT: '{{ .AZURE_OPENAI_ENDPOINT | default "" }}'
2222

2323
HELM_NAMESPACE: '{{ .HELM_NAMESPACE | default "default" }}'
24-
2524
REMOVE_CONTAINERS: '{{ .REMOVE_CONTAINERS | default "true" }}'
25+
REGCRED_CREATE: '{{ .REGCRED_CREATE | default "false" }}'
26+
2627

2728
RUNNER_TYPE: '{{ .RUNNER_TYPE | default "docker" }}'
2829

@@ -48,7 +49,7 @@ vars:
4849
else
4950
printf $DIRCTL_BIN_PATH
5051
fi
51-
DIRCTL_BIN_VERSION: '{{ .DIRCTL_BIN_VERSION | default "v0.2.0" }}'
52+
DIRCTL_BIN_VERSION: '{{ .DIRCTL_BIN_VERSION | default "v0.2.1" }}'
5253

5354
tasks:
5455
kind:create:
@@ -86,8 +87,6 @@ tasks:
8687

8788
test:env:directory:deploy:
8889
desc: Deploy Agntcy directory test env
89-
vars:
90-
REGCRED_CREATE: '{{ .REGCRED_CREATE | default "false" }}'
9190
cmds:
9291
- |
9392
helm dependency build ./agntcy-dir/components/helm
@@ -102,6 +101,64 @@ tasks:
102101
--wait-for-jobs \
103102
--timeout "15m"
104103
104+
test:env:directory:bootstrap:deploy:
105+
desc: Deploy Directory network peers
106+
deps:
107+
- download:dirctl-bin
108+
env:
109+
DIRECTORY_LOGGER_LOG_LEVEL: ERROR
110+
cmds:
111+
- |
112+
test -f /tmp/node.privkey || openssl genpkey -algorithm ED25519 -out /tmp/node.privkey
113+
bootstrap_peerid=$(./agntcy-dir/tests/.bin/dirctl network info /tmp/node.privkey)
114+
echo "PEER ID: ${bootstrap_peerid}"
115+
echo BOOTSTRAP_PEER_ID="${bootstrap_peerid}" > .env
116+
helm dependency build ./agntcy-dir/components/helm
117+
helm upgrade agntcy-dir \
118+
./agntcy-dir/components/helm \
119+
--set dir.apiserver.image.tag="{{ .DIRECTORY_IMAGE_TAG }}" \
120+
--set regcred.create="{{ .REGCRED_CREATE }}" \
121+
--set dir.apiserver.privKey="$(cat /tmp/node.privkey)" \
122+
-f ./agntcy-dir/components/config/bootstrap.yaml \
123+
--namespace bootstrap \
124+
--create-namespace \
125+
--install \
126+
--wait \
127+
--wait-for-jobs \
128+
--timeout "15m"
129+
130+
test:env:directory:network:deploy:
131+
desc: Deploy Directory network peers
132+
deps:
133+
- test:env:directory:bootstrap:deploy
134+
cmds:
135+
- for:
136+
matrix:
137+
PEER: [ "peer1", "peer2", "peer3" ]
138+
cmd: |
139+
export $(cat .env)
140+
helm upgrade agntcy-dir \
141+
./agntcy-dir/components/helm \
142+
--set dir.apiserver.image.tag="{{ .DIRECTORY_IMAGE_TAG }}" \
143+
--set regcred.create="{{ .REGCRED_CREATE }}" \
144+
--set dir.apiserver.config.routing.bootstrap_peers[0]="/dns4/agntcy-dir-apiserver-routing.bootstrap.svc.cluster.local/tcp/8999/p2p/${BOOTSTRAP_PEER_ID}" \
145+
--namespace "{{ .ITEM.PEER }}" \
146+
--create-namespace \
147+
--install \
148+
--wait \
149+
--wait-for-jobs \
150+
--timeout "15m"
151+
152+
test:env:directory:network:cleanup:
153+
desc: Remove Directory network peers
154+
cmds:
155+
- for:
156+
matrix:
157+
PEER: [ "bootstrap", "peer1", "peer2", "peer3" ]
158+
cmd: |
159+
helm delete --namespace {{ .ITEM.PEER }} agntcy-dir
160+
161+
105162
test:env:directory:cleanup:
106163
desc: Remove agntcy directory test env
107164
cmds:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright AGNTCY Contributors (https://github.com/agntcy)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
dir:
5+
apiserver:
6+
config:
7+
# Routing settings for the peer-to-peer network.
8+
routing:
9+
# Address to use for routing
10+
listen_address: "/ip4/0.0.0.0/tcp/8999"
11+
12+
# Path to private key file for peer ID.
13+
key_path: /etc/agntcy/dir/node.privkey
14+
15+
# Nodes to use for bootstrapping of the DHT.
16+
# We read initial routing tables here and get introduced
17+
# to the network.
18+
bootstrap_peers: []

integrations/agntcy-dir/components/helm/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ appVersion: "0.1.0"
2828

2929
dependencies:
3030
- name: dir
31-
version: "v0.2.0"
31+
version: "v0.2.1"
3232
repository: oci://ghcr.io/agntcy/dir/helm-charts

0 commit comments

Comments
 (0)