Skip to content

Commit 104fb29

Browse files
Merge branch 'refactor/consolidate-p2p-modules' into fix/raintree
* refactor/consolidate-p2p-modules: chore: update changelog switch to new dns introduced with helm charts [Consensus] Log warnings if server module is not enabled (#679) chore: update changelog add generated helm docs chore: update validator chart P2P hostname config chore: remove `use_libp2p` from validator chart [Peristence] Fix `TxIndexer` to index sender and recipient transactions with height and index suffixes (#677) Update e2e/docs/CHANGELOG.md (#681) Update devlog5.md (#672) [Infra] validator helm chart for LocalNet (#658) Update issue.md
2 parents d01d4f7 + 90cf45e commit 104fb29

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1056
-297
lines changed

.github/ISSUE_TEMPLATE/issue.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ assignees: ""
7070
- [ ] **New tests or benchmarks**: `make ...`
7171
- [ ] **All tests**: `make test_all`
7272
- [ ] **LocalNet**: verify a `LocalNet` is still functioning correctly by following the instructions at [docs/development/README.md](https://github.com/pokt-network/pocket/tree/main/docs/development)
73-
- [ ] ***k8s LocalNet**: verify a `k8s LocalNet` is still functioning correctly by following the instructions [here](https://github.com/pokt-network/pocket/blob/main/build/localnet/README.md)
73+
- [ ] **k8s LocalNet**: verify a `k8s LocalNet` is still functioning correctly by following the instructions [here](https://github.com/pokt-network/pocket/blob/main/build/localnet/README.md)
7474

7575
---
7676

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Generate helm docs
2+
on:
3+
pull_request:
4+
paths:
5+
- "charts/**/README.md.gotmpl"
6+
- "charts/**/values.yaml"
7+
jobs:
8+
docs:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
with:
13+
ref: ${{ github.event.pull_request.head.ref }}
14+
- name: Install helm-docs
15+
uses: envoy/[email protected]
16+
with:
17+
# Helm Docs Version to install (Mandatory)
18+
version: 1.11.0
19+
- name: Generate helm docs
20+
run: helm-docs --chart-search-root=charts
21+
- run: |
22+
git config user.name github-actions
23+
git config user.email [email protected]
24+
25+
if [[ -n $(git status --porcelain) ]]; then
26+
git add .
27+
git commit -m "add generated helm docs"
28+
git push
29+
else
30+
echo "No changes detected, skipping commit and push."
31+
fi

.github/workflows/main.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,17 @@ jobs:
6363
- name: Output test failures
6464
# Makes it easier to find failed tests so no need to scroll through the whole log.
6565
if: ${{ failure() && env.TARGET_GOLANG_VERSION == matrix.go }}
66-
run: jq --argjson fail_tests "$(jq -c -r 'select(.Action == "fail") | select(.Test) | .Test' test_results.json | jq -R -s -c -r 'split("\n") | map(select(length>0))')" 'select(.Test as $t | ($fail_tests | arrays)[] | select($t == .)) | select(.Output) | .Output' test_results.json | jq -r | sed ':a;N;$!ba;s/\n\n/\n/g'
66+
run: |
67+
jq --argjson fail_tests "$(jq -c -r 'select(.Action == "fail") | select(.Test) | .Test' test_results.json | jq -R -s -c -r 'split("\n") | map(select(length>0))')" 'select(.Test as $t | ($fail_tests | arrays)[] | select($t == .)) | select(.Output) | .Output' test_results.json | jq -r | sed ':a;N;$!ba;s/\n\n/\n/g' > test_failures.json
68+
cat test_failures.json
69+
exit 1
6770
- name: Upload test results
6871
if: ${{ always() && env.TARGET_GOLANG_VERSION == matrix.go }}
6972
uses: actions/upload-artifact@v3
7073
with:
7174
name: test-results
7275
path: |
73-
test_results.json
76+
test_*.json
7477
- name: Annotate tests on GitHub
7578
# Only annotate if the test failed on target version to avoid duplicated annotations on GitHub.
7679
if: ${{ always() && env.TARGET_GOLANG_VERSION == matrix.go }}

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ libp2p/types/mocks/*
4141
persistence/types/mocks/*
4242
!persistence/types/mocks/mocks.go
4343

44-
4544
# TODO(team): Does the `types` directory contain generated or raw type files?
4645
# types/
4746

@@ -72,6 +71,7 @@ build/config/gen*.json
7271
# Binary downloads and manipulations by helm
7372
**/charts
7473
**/tmpcharts
74+
!/charts
7575

7676
# Ignored generated files by build
7777
bin/*
@@ -88,6 +88,5 @@ localnet_config.yaml
8888
# Local files created during https://github.com/pokt-network/pocket/wiki creation
8989
tools/wiki
9090

91-
9291
# ignore highest precedence config file read by default
9392
/config.json

Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,8 @@ localnet_logs_validators_follow: ## Outputs logs from all validators and follows
513513
kubectl logs -l v1-purpose=validator --all-containers=true --max-log-requests=1000 --tail=-1 -f
514514

515515
.PHONY: localnet_down
516-
localnet_down: ## Stops LocalNet and cleans up dependencies (tl;dr `tilt down` + postgres database)
516+
localnet_down: ## Stops LocalNet and cleans up dependencies (tl;dr `tilt down`)
517517
tilt down --file=build/localnet/Tiltfile
518-
kubectl delete pvc --ignore-not-found=true data-dependencies-postgresql-0
519518

520519
.PHONY: localnet_db_cli
521520
localnet_db_cli: ## Open a CLI to the local containerized postgres instancedb_cli:

app/client/doc/CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
## [0.0.0.28] - 2023-04-14
10+
## [0.0.0.28] - 2023-04-17
1111

1212
- Refactor debug CLI post P2P module re-consolidation
1313

build/docs/CHANGELOG.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
## [0.0.0.34] - 2023-04-14
10+
## [0.0.0.35] - 2023-04-17
1111

1212
- Removed runtime/configs.Config#UseLibp2p field
1313
- Use pod IP for validator DNS resolution tilt localnet
1414
- Add `LIBP2P_DEBUG` env var
1515

16+
## [0.0.0.34] - 2023-04-14
17+
18+
- Changed LocalNet validators to use the new `pocket-validator` helm chart instead of templating the manifests with `sed`.
19+
- Each validator now has it's own postgres instance (as a helm chart dependency), which allows for clean scale up/down of the validators.
20+
- Cleaned up old manifests and scripts that are no longer needed.
21+
- Changed LocalNet documentation to reflect the new changes.
22+
1623
## [0.0.0.33] - 2023-04-13
1724

1825
- Add persistent txIndexerPath to node configs

build/localnet/README.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,13 @@ For example:
151151

152152
## How to change configuration files
153153

154-
Currently, we provide [a config file](./manifests/configs.yaml) that is shared between all validators and a pocket client. We make use of `pocket` client feature that allows us to override configuration via environment variables. You can check a [validator template](./templates/v1-validator-template.yaml.tpl) as a reference.
154+
Configurations can be changed in helm charts where network protocol actor configs are maintained. You can find them in [this directory](../../charts).
155+
156+
`config.json` file is created using the `config` section content in`values.yaml`. For example, you can find the configuration for a validator [here](../../charts/pocket-validator/values.yaml#70).
157+
158+
If you need to add a new parameter – feel free to modify the section in place. Some of the parameters that contain secrets (e.g. private key), are stored in Secrets object and injected as environment variables.
159+
160+
Please refer to helm charts documentation for more details.
155161

156162
## How does it work?
157163

@@ -205,12 +211,9 @@ build/localnet
205211
│   │   ├── dashboards.yml
206212
│   │   └── datasources.yml
207213
│   └── values.yaml # Configuration values that override the default values of the dependencies, this allows us to connect dependencies together and make them available to our LocalNet services
208-
├── manifests # Static YAML Kubernetes manifests that are consumed by `tilt`
209-
│   ├── cli-client.yaml # Pod that has the latest binary of the pocket client. Makefile targets run CLI in this pod.
210-
│   ├── configs.yaml # Location of the config files (default configs for all validators and a genesis file) that are shared across all actors
211-
│   ├── network.yaml # Networking configuration that is shared between different actors, currently a Service that points to all validators
212-
│   └── private-keys.yaml # Pre-generated private keys with a semantic format for easier development
213-
└── templates # Templates for Kubernetes manifests that are consumed by `tilt`
214-
├── v1-validator-template.sh # Shell script that generates Kubenetes manifests for validators, consumed by `tilt`
215-
└── v1-validator-template.yaml.tpl # Template for a single validator, consumed by `v1-validator-template.sh`
214+
└── manifests # Static YAML Kubernetes manifests that are consumed by `tilt`
215+
   ├── cli-client.yaml # Pod that has the latest binary of the pocket client. Makefile targets run CLI in this pod.
216+
   ├── configs.yaml # Location of the config files (default configs for all validators and a genesis file) that are shared across all actors
217+
   ├── network.yaml # Networking configuration that is shared between different actors, currently a Service that points to all validators
218+
   └── private-keys.yaml # Pre-generated private keys with a semantic format for easier development
216219
```

build/localnet/Tiltfile

+29-44
Original file line numberDiff line numberDiff line change
@@ -44,40 +44,22 @@ deps = [
4444

4545
deps_full_path = [root_dir + "/" + depdir for depdir in deps]
4646

47-
# Deploy dependencies (grafana, postgres, prometheus) and wire it up with localnet
48-
helm_repo(
49-
"grafana",
50-
"https://grafana.github.io/helm-charts",
51-
resource_name="helm-repo-grafana",
52-
labels=["helm"]
53-
)
54-
helm_repo(
55-
"prometheus-community",
56-
"https://prometheus-community.github.io/helm-charts",
57-
resource_name="helm-repo-prometheus",
58-
labels=["helm"]
59-
)
60-
helm_repo(
61-
"bitnami",
62-
"https://charts.bitnami.com/bitnami",
63-
resource_name="helm-repo-bitnami",
64-
labels=["helm"]
65-
)
47+
# Avoid downloading dependencies if no missing/outdated charts are found
48+
def check_helm_dependencies_for_chart(path):
49+
check_helm_dependencies = local(
50+
"helm dependency list " + path + " | awk '{print $4}' | grep -Ev 'ok|STATUS'"
51+
)
52+
helm_dependencies_not_ok_count = len(str(check_helm_dependencies).splitlines())
53+
if helm_dependencies_not_ok_count > 1:
54+
local("helm dependency update " + path)
6655

67-
# Avoid downloading dependencies if no missing/outdated charts
68-
check_helm_dependencies = local(
69-
"helm dependency list dependencies | awk '{print $4}' | grep -Ev 'ok|STATUS'"
70-
)
71-
helm_dependencies_not_ok_count = len(str(check_helm_dependencies).splitlines())
72-
if helm_dependencies_not_ok_count > 1:
73-
local("helm dependency update dependencies")
56+
check_helm_dependencies_for_chart("dependencies")
7457

7558
k8s_yaml(helm("dependencies", name="dependencies", namespace="default"))
7659
k8s_resource("dependencies-prometheus-pushgateway", labels=["monitoring"])
7760
k8s_resource("dependencies-loki", labels=["monitoring"])
7861
k8s_resource("dependencies-prometheus-node-exporter", labels=["monitoring"])
7962
k8s_resource("dependencies-prometheus-alertmanager", labels=["monitoring"])
80-
k8s_resource("dependencies-postgresql", labels=["database"])
8163
k8s_resource("dependencies-grafana", labels=["monitoring"])
8264
k8s_resource("dependencies-kube-state-metrics", labels=["monitoring"])
8365
k8s_resource("dependencies-promtail", labels=["monitoring"])
@@ -122,8 +104,8 @@ WORKDIR /
122104
only=["./bin/pocket-linux"],
123105
entrypoint=[
124106
"/usr/local/bin/pocket",
125-
"-config=/configs/config.json",
126-
"-genesis=/genesis.json",
107+
"-config=/pocket/configs/config.json",
108+
"-genesis=/pocket/configs/genesis.json",
127109
],
128110
live_update=[sync("bin/pocket-linux", "/usr/local/bin/pocket")],
129111
)
@@ -176,22 +158,25 @@ k8s_yaml(["manifests/cli-client.yaml"])
176158
k8s_resource('pocket-v1-cli-client', labels=['client'])
177159
k8s_yaml(['manifests/cluster-manager.yaml'])
178160
k8s_resource('pocket-v1-cluster-manager', labels=['cluster-manager'])
179-
k8s_yaml(
180-
[
181-
local(
182-
"templates/v1-validator-template.sh %s"
183-
% localnet_config["validators"]["count"],
184-
quiet=True,
185-
),
186-
]
187-
)
188-
189161

190-
# Uncomment in order to expose postgres port to 5432 on the host machine in case the developer wants to connect to postgres directly
191-
# First port is the port on the host machine, second is the port on the container, so if you already have postgres running on the host machine, you can change the first port to something else
192-
# k8s_resource(new_name='postgres',
193-
# workload="dependencies-postgresql",
194-
# port_forwards="5432:5432")
162+
check_helm_dependencies_for_chart(root_dir + "/charts/pocket-validator")
163+
for x in range(localnet_config["validators"]["count"]):
164+
validator_number = x + 1
165+
formatted_validator_number = local('printf "%03d" ' + str(validator_number))
166+
167+
k8s_yaml(helm(root_dir + "/charts/pocket-validator",
168+
name="validator-%s" % formatted_validator_number,
169+
namespace="default",
170+
set=[
171+
"image.repository=validator-image",
172+
"privateKeySecretKeyRef.name=v1-localnet-validators-private-keys",
173+
"privateKeySecretKeyRef.key=%s" % formatted_validator_number,
174+
"genesis.preProvisionedGenesis.enabled=false",
175+
"genesis.externalConfigMap.name=v1-localnet-genesis",
176+
"genesis.externalConfigMap.key=genesis.json",
177+
"postgresql.primary.persistence.enabled=false",
178+
]
179+
))
195180

196181
# Exposes grafana
197182
k8s_resource(

build/localnet/dependencies/requirements.yaml

-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,3 @@ dependencies:
1515
condition: prometheus.enabled
1616
version: "~15.5.3"
1717
repository: "https://prometheus-community.github.io/helm-charts"
18-
- name: "postgresql"
19-
condition: postgresql.enabled
20-
version: "~12.1.8"
21-
repository: "https://charts.bitnami.com/bitnami"

build/localnet/dependencies/values.yaml

-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
global:
2-
postgresql:
3-
auth:
4-
postgresPassword: LocalNetPassword
5-
61
grafana:
72
enabled: true
83
adminPassword: none
@@ -64,9 +59,3 @@ prometheus:
6459
url: http://{{ include "prometheus.fullname" .}}:{{ .Values.prometheus.server.service.servicePort }}{{ .Values.prometheus.server.prefixURL }}
6560
datasource:
6661
jsonData: {}
67-
68-
# https://github.com/bitnami/charts/blob/main/bitnami/postgresql/values.yaml
69-
postgres:
70-
enabled: true
71-
image:
72-
tag: "14"

build/localnet/manifests/cli-client.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ spec:
1717
spec:
1818
serviceAccountName: debug-client-account
1919
initContainers:
20-
- name: wait-for-v1-validator001
20+
- name: wait-for-validator-001-pocket-validator
2121
image: busybox
2222
command:
2323
[
2424
"sh",
2525
"-c",
26-
"until nc -z v1-validator001 42069; do echo waiting for v1-validator001...; sleep 2; done;",
26+
'until wget -q -O - "http://validator-001-pocket-validator:50832/v1/health" --timeout=2 --tries=2 --spider >/dev/null 2>&1; do echo waiting for validator-001-pocket-validator to be online and healthy...; sleep 2; done;',
2727
]
2828
containers:
2929
- name: pocket
@@ -75,7 +75,7 @@ spec:
7575
value: validator1
7676
# Any host that is visible and connected to the cluster can be arbitrarily selected as the RPC host
7777
- name: RPC_HOST
78-
value: v1-validator001
78+
value: pocket-validators
7979
# TECHDEBT(#678): debug client requires hostname to participate
8080
# in P2P networking.
8181
- name: POCKET_P2P_HOSTNAME
@@ -91,7 +91,7 @@ spec:
9191
volumes:
9292
- name: config-volume
9393
configMap:
94-
name: v1-validator-default-config
94+
name: validator-001-pocket-validator-config
9595
defaultMode: 420
9696
- name: genesis-volume
9797
configMap:

build/localnet/manifests/cluster-manager.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@ metadata:
44
name: pocket-v1-cluster-manager
55
spec:
66
initContainers:
7-
- name: wait-for-v1-validator001
7+
- name: wait-for-validator-001-pocket-validator
88
image: busybox
99
command:
1010
[
1111
"sh",
1212
"-c",
13-
'until wget -q -O - "http://v1-validator001:50832/v1/health" --timeout=2 --tries=2 --spider >/dev/null 2>&1; do echo waiting for v1-validator001 to be online and healthy...; sleep 2; done;',
13+
'until wget -q -O - "http://validator-001-pocket-validator:50832/v1/health" --timeout=2 --tries=2 --spider >/dev/null 2>&1; do echo waiting for validator-001-pocket-validator to be online and healthy...; sleep 2; done;',
1414
]
1515
containers:
1616
- name: cluster-manager
1717
image: cluster-manager-image
1818
imagePullPolicy: IfNotPresent
1919
args:
2020
- cluster-manager
21+
env:
22+
- name: RPC_HOST
23+
value: pocket-validators
2124
serviceAccountName: cluster-manager-account

0 commit comments

Comments
 (0)