From d9e088944caceba4447e4398cccc137c388027bd Mon Sep 17 00:00:00 2001 From: Leonardo <14614620+aardbol@users.noreply.github.com> Date: Thu, 19 Oct 2023 16:18:14 +0200 Subject: [PATCH] Testnet manager local setup improvements (#109) --- local-kubernetes/Makefile | 32 +++++++++++++------ local-kubernetes/README.md | 4 +-- .../charts/values-moonbase-collator.yml | 3 -- .../charts/values-testnet-manager.yml | 2 +- skaffold.yaml | 2 +- tests/stash_account_test.py | 2 +- 6 files changed, 27 insertions(+), 18 deletions(-) diff --git a/local-kubernetes/Makefile b/local-kubernetes/Makefile index 2446147..eaef74e 100644 --- a/local-kubernetes/Makefile +++ b/local-kubernetes/Makefile @@ -1,14 +1,22 @@ # ============================================================================================ -# Validator-manager Quick Deploy Makefile for Development and Testing +# Testnet Manager Quick Deploy Makefile for Development and Testing # ============================================================================================ KUBERNETES_CONTEXT = minikube # minikube or rancher-desktop # rococo or wococo (don't put space at the end of the variable it will be used as is) CHAIN_NAMESPACE = rococo +# docker or podman +MINIKUBE_DRIVER = docker # ============================================================================================ -all: kube check build install +ifeq ($(MINIKUBE_DRIVER),podman) + TARGETS := kube_minikube-podman check install +else + TARGETS := kube check install +endif + +all: $(TARGETS) # ============================================================================================ @@ -37,39 +45,43 @@ setup: setup_${KUBERNETES_CONTEXT} setup_minikube: @kubectl --context ${KUBERNETES_CONTEXT} apply -f ./kube-setup + @echo "Waiting 20 seconds for chainspec pod readiness before continuing" + @sleep 20 setup_rancher-desktop: @kubectl --context ${KUBERNETES_CONTEXT} apply -f ./kube-setup -f ./rancher-desktop/kube-setup + @echo "Waiting 20 seconds for chainspec pod readiness before continuing" + @sleep 20 build: check build_${KUBERNETES_CONTEXT} build_minikube: - cd ../. && minikube image build . -t local/testnet-manager + cd ../. && minikube image build . -t localhost/testnet-manager build_rancher-desktop: - cd ../. && docker image build -t local/testnet-manager:latest . + cd ../. && docker image build -t localhost/testnet-manager:latest . # ============================================================================================ rpc: @xdg-open 'https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer' - @kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local${CHAIN_NAMESPACE}-bootnode 9944:9944 -n ${CHAIN_NAMESPACE} + @kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local-${CHAIN_NAMESPACE}-bootnode 9944:9944 -n ${CHAIN_NAMESPACE} para-shell: @xdg-open 'https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9948#/explorer' - @kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local${CHAIN_NAMESPACE}-shell-collator-node 9948:9944 -n ${CHAIN_NAMESPACE} + @kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local-${CHAIN_NAMESPACE}-shell-collator-node 9948:9944 -n ${CHAIN_NAMESPACE} para-moon: @xdg-open 'https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9949#/explorer' - @kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local${CHAIN_NAMESPACE}-moonbase-alice-node 9949:9944 -n ${CHAIN_NAMESPACE} + @kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local-${CHAIN_NAMESPACE}-moonbase-alice-node 9949:9944 -n ${CHAIN_NAMESPACE} para-mint: @xdg-open 'https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9950#/explorer' - @kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local${CHAIN_NAMESPACE}-statemint-alice-node 9950:9944 -n ${CHAIN_NAMESPACE} + @kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local-${CHAIN_NAMESPACE}-statemint-alice-node 9950:9944 -n ${CHAIN_NAMESPACE} para-tick: @xdg-open 'https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9951#/explorer' - @kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local${CHAIN_NAMESPACE}-tick-collator-node 9951:9944 -n ${CHAIN_NAMESPACE} + @kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local-${CHAIN_NAMESPACE}-tick-collator-node 9951:9944 -n ${CHAIN_NAMESPACE} web: @xdg-open 'http://localhost:8080/' @@ -108,4 +120,4 @@ uninstall: check @kubectl --context ${KUBERNETES_CONTEXT} delete pvc -n ${CHAIN_NAMESPACE} --all cleanup: check - @kubectl --context ${KUBERNETES_CONTEXT} delete namespace ${CHAIN_NAMESPACE} + @kubectl --context ${KUBERNETES_CONTEXT} delete namespace rococo wococo diff --git a/local-kubernetes/README.md b/local-kubernetes/README.md index 617ae34..42e5cbd 100644 --- a/local-kubernetes/README.md +++ b/local-kubernetes/README.md @@ -1,7 +1,7 @@ ## Requirements 1. Helm - a. Helmdiff + a. Helm diff plugin b. Helmfile 2. Minikube or Rancher-desktop @@ -46,7 +46,7 @@ make rpc This command will open browser and port-forward the 9944 > Note: you should have port `9944` free in your host before running `make rpc` -### Validator-manager web endpoint +### Testnet Manager web endpoint Run: ``` make web diff --git a/local-kubernetes/charts/values-moonbase-collator.yml b/local-kubernetes/charts/values-moonbase-collator.yml index 832b411..a359e19 100644 --- a/local-kubernetes/charts/values-moonbase-collator.yml +++ b/local-kubernetes/charts/values-moonbase-collator.yml @@ -30,9 +30,6 @@ node: chainKeystore: *chainKeystore persistGeneratedNodeKey: true allowUnsafeRpcMethods: true - # To be removed once https://github.com/moonbeam-foundation/moonbeam/pull/2359 - # is included in release - legacyRpcFlags: true flags: - "--allow-private-ipv4" diff --git a/local-kubernetes/charts/values-testnet-manager.yml b/local-kubernetes/charts/values-testnet-manager.yml index bda898b..d369c43 100644 --- a/local-kubernetes/charts/values-testnet-manager.yml +++ b/local-kubernetes/charts/values-testnet-manager.yml @@ -1,5 +1,5 @@ image: - repository: "local/testnet-manager" + repository: "localhost/testnet-manager" tag: latest pullPolicy: IfNotPresent diff --git a/skaffold.yaml b/skaffold.yaml index 8635cf7..a69acf9 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -4,7 +4,7 @@ metadata: name: testnet-manager build: artifacts: - - image: local/testnet-manager + - image: localhost/testnet-manager docker: {} local: useBuildkit: true diff --git a/tests/stash_account_test.py b/tests/stash_account_test.py index 7812536..621a653 100644 --- a/tests/stash_account_test.py +++ b/tests/stash_account_test.py @@ -26,7 +26,7 @@ def tearDown(self): def test_get_account_funds(self): alice_key = Keypair.create_from_uri("//Alice") alice_funds = get_account_funds(self.polkadot_rpc_ws_url, alice_key.ss58_address) - self.assertEqual(alice_funds, 10000000000000000, "Alice's funds successfully retrieved") + self.assertEqual(alice_funds, 1000000000000000000, "Alice's funds successfully retrieved") if __name__ == '__main__': unittest.main()