Pārlūkot izejas kodu

devnet: use wormhole namespace by default

Leo 5 gadi atpakaļ
vecāks
revīzija
594592e2f6
3 mainītis faili ar 42 papildinājumiem un 8 dzēšanām
  1. 17 2
      DEVELOP.md
  2. 24 5
      Tiltfile
  3. 1 1
      bridge/e2e/k8s.go

+ 17 - 2
DEVELOP.md

@@ -22,10 +22,16 @@ The minikube default is too low, adjust it like this:
 
 This should work on Linux, MacOS and possibly even Windows.
 
+By default, the devnet is deployed to the `wormhole` namespace rather than `default`. This makes it easy to clean up the
+entire deployment by simply removing the namespace, which isn't possible with `default`. Change your default namespace
+to avoid having to specify `-n wormhole` for all commands:
+
+    kubectl config set-context --current --namespace=wormhole
+
 After installing all dependencies, just run `tilt up --update-mode=exec`. 
 Whenever you modify a file, the devnet is automatically rebuilt and a rolling update is done.
 
-Specify number of guardians nodes to run (default is five):
+Launch the devnet while specifying the number of guardians nodes to run (default is five):
 
     tilt up --update-mode=exec -- --num=1
 
@@ -54,12 +60,21 @@ Generate test Solana -> Ethereum transfers:
 
     scripts/send-solana-lockups.sh
 
+Run end-to-end tests:
+
+    cd bridge
+    go test github.com/certusone/wormhole/bridge/e2e
+
 Adjust number of nodes in running cluster:
 
     tilt args -- --num=2
+
+Tear down cluster:
+
+    tilt down --delete-namespaces
     
 (this is only useful if you want to test scenarios where the number
-of nodes diverges from the guardian set - otherwise, `tilt down` and restart the cluster)
+of nodes diverges from the guardian set - otherwise, `tilt down --delete-namespaces` and restart the cluster)
 
 Once you're done, press Ctrl-C. Run `tilt down` to tear down the devnet.
 

+ 24 - 5
Tiltfile

@@ -28,9 +28,28 @@
 #                                                                   +-----------------+
 #
 
+load('ext://namespace', 'namespace_inject', 'namespace_create')
+
+# Runtime configuration
+
 config.define_string("num", False, "Number of guardian nodes to run")
+
+# You do not usually need to set this argument - this argument is for debugging only. If you do use a different
+# namespace, note that the "wormhole" namespace is hardcoded in the e2e test and don't forget specifying the argument
+# when running "tilt down".
+#
+config.define_string("namespace", False, "Kubernetes namespace to use")
+
 cfg = config.parse()
 num_guardians = int(cfg.get("num", "5"))
+namespace = cfg.get("namespace", "wormhole")
+
+# namespace
+
+namespace_create(namespace)
+
+def k8s_yaml_with_ns(objects):
+    return k8s_yaml(namespace_inject(objects, namespace))
 
 # protos
 
@@ -62,7 +81,7 @@ def build_bridge_yaml():
     return encode_yaml_stream(bridge_yaml)
 
 
-k8s_yaml(build_bridge_yaml())
+k8s_yaml_with_ns(build_bridge_yaml())
 
 k8s_resource("guardian", resource_deps=["proto-gen"], port_forwards=[
     port_forward(6060, name="Debug Server [:6060]"),
@@ -96,7 +115,7 @@ docker_build(
     dockerfile = "third_party/solana/Dockerfile",
 )
 
-k8s_yaml("devnet/solana-devnet.yaml")
+k8s_yaml_with_ns("devnet/solana-devnet.yaml")
 
 k8s_resource("solana-devnet", port_forwards=[
     port_forward(8899, name="Solana RPC [:8899]"),
@@ -124,7 +143,7 @@ docker_build(
     ],
 )
 
-k8s_yaml("devnet/eth-devnet.yaml")
+k8s_yaml_with_ns("devnet/eth-devnet.yaml")
 
 k8s_resource("eth-devnet", port_forwards=[
     port_forward(8545, name="Ganache RPC [:8545]")
@@ -144,7 +163,7 @@ docker_build(
     ],
 )
 
-k8s_yaml("devnet/web.yaml")
+k8s_yaml_with_ns("devnet/web.yaml")
 
 k8s_resource("web", port_forwards=[
     port_forward(3000, name="Experimental Web UI [:3000]")
@@ -164,7 +183,7 @@ docker_build(
     dockerfile = "./terra/Dockerfile",
 )
 
-k8s_yaml("devnet/terra-devnet.yaml")
+k8s_yaml_with_ns("devnet/terra-devnet.yaml")
 
 k8s_resource(
     "terra-lcd",

+ 1 - 1
bridge/e2e/k8s.go

@@ -20,7 +20,7 @@ import (
 )
 
 const (
-	TiltDefaultNamespace = metav1.NamespaceDefault // hardcoded Tilt assumption
+	TiltDefaultNamespace = "wormhole" // hardcoded in Tiltfile
 )
 
 func getk8sClient() *kubernetes.Clientset {