Tiltfile: optional pyth and explorer deployment

This adds the explorer and Pyth as optional components to improve
Tilt startup times, as originally suggested by Justin.

Defaults to true in CI.

Change-Id: Id9fffe5b11311baadc042815c0cc747de037554e
This commit is contained in:
Leo 2021-09-13 15:38:20 +02:00 committed by Leopold Schabel
parent 7914512797
commit ef0cb91ac6
2 changed files with 89 additions and 73 deletions

View File

@ -29,12 +29,18 @@ config.define_string("namespace", False, "Kubernetes namespace to use")
config.define_string("gcpProject", False, "GCP project ID for BigTable persistence")
config.define_string("bigTableKeyPath", False, "Path to BigTable json key file")
# Components
config.define_bool("pyth", False, "Enable Pyth-to-Wormhole component")
config.define_bool("explorer", False, "Enable explorer component")
cfg = config.parse()
num_guardians = int(cfg.get("num", "5"))
namespace = cfg.get("namespace", "wormhole")
gcpProject = cfg.get("gcpProject", "local-dev")
bigTableKeyPath = cfg.get("bigTableKeyPath", "./event_database/devnet_key.json")
ci = cfg.get("ci", False)
pyth = cfg.get("pyth", ci)
explorer = cfg.get("explorer", ci)
# namespace
@ -75,6 +81,7 @@ local_resource(
# node
if explorer:
k8s_yaml_with_ns(
secret_yaml_generic(
"bridge-bigtable-key",
@ -98,7 +105,19 @@ def build_node_yaml():
if container["name"] != "guardiand":
fail("container 0 is not guardiand")
container["command"] += ["--devNumGuardians", str(num_guardians)]
container["command"] += ["--bigTableGCPProject", gcpProject]
if explorer:
container["command"] += [
"--bigTablePersistenceEnabled",
"--bigTableInstanceName",
"wormhole",
"--bigTableTableName",
"v2Events",
"--bigTableKeyPath",
"/tmp/mounted-keys/bigtable-key.json",
"--bigTableGCPProject",
gcpProject,
]
return encode_yaml_stream(node_yaml)
@ -110,6 +129,7 @@ k8s_resource("guardian", resource_deps = ["proto-gen", "solana-devnet"], port_fo
port_forward(7071, name = "Public REST [:7071]"),
])
if pyth:
docker_build(
ref = "pyth",
context = ".",
@ -168,6 +188,7 @@ k8s_resource(
# pyth2wormhole client
if pyth:
docker_build(
ref = "p2w-client",
context = ".",
@ -180,9 +201,10 @@ docker_build(
k8s_yaml_with_ns("devnet/p2w-client.yaml")
k8s_resource("p2w-client",
k8s_resource(
"p2w-client",
resource_deps = ["solana-devnet", "pyth"],
port_forwards=[]
port_forwards = [],
)
# eth devnet
@ -237,6 +259,7 @@ def build_cloud_function(container_name, go_func_name, path, builder):
[path],
)
if explorer:
build_cloud_function(
container_name = "cloud-function-readrow",
go_func_name = "ReadRow",

View File

@ -105,13 +105,6 @@ spec:
- /tmp/admin.sock
- --dataDir
- /tmp/data
- --bigTablePersistenceEnabled
- --bigTableInstanceName
- wormhole
- --bigTableTableName
- v2Events
- --bigTableKeyPath
- /tmp/mounted-keys/bigtable-key.json
# - --logLevel=debug
securityContext:
capabilities: