Skip to content

Commit

Permalink
Allow the config pass-through to be used at all three levels.
Browse files Browse the repository at this point in the history
  • Loading branch information
elric1 committed Dec 4, 2021
1 parent 5d731b1 commit 9530371
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 2 additions & 0 deletions charts/tezos/templates/configs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ data:
ROLLING_SNAPSHOT_URL: "{{ .Values.rolling_snapshot_url }}"
ARCHIVE_TARBALL_URL: "{{ .Values.archive_tarball_url }}"
ROLLING_TARBALL_URL: "{{ .Values.rolling_tarball_url }}"
NODE_GLOBALS: |
{{ .Values.node_globals | mustToPrettyJson | indent 4 }}
NODES: |
{{ .Values.nodes | mustToPrettyJson | indent 4 }}
SIGNERS: |
Expand Down
10 changes: 9 additions & 1 deletion charts/tezos/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,18 @@ accounts: {}
## automatically for you.
##
##
## Defaults are filled in for most of the above values.
## Defaults are filled in for most of the above values. You can also provide
## global defaults for all nodes via a node_globals: section which is also
## a dictionary. Currently, the only key defined is "config" which provides
## a default for that section in the nodes:.
##
## Example config:
##
#
# node_globals:
# config:
# shell:
# history_mode: full
# nodes:
# tezos-baking-node:
# labels:
Expand Down
11 changes: 8 additions & 3 deletions utils/config-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@

ACCOUNTS = json.loads(os.environ["ACCOUNTS"])
CHAIN_PARAMS = json.loads(os.environ["CHAIN_PARAMS"])
NODE_GLOBALS = json.loads(os.environ["NODE_GLOBALS"]) or {}
NODES = json.loads(os.environ["NODES"])
SIGNERS = json.loads(os.environ["SIGNERS"])

MY_POD_NAME = os.environ["MY_POD_NAME"]
MY_POD_TYPE = os.environ["MY_POD_TYPE"]

MY_POD_CONFIG = None
MY_POD_CLASS = {}
MY_POD_CONFIG = {}
ALL_NODES = {}
BAKING_NODES = {}

Expand All @@ -31,6 +33,7 @@
name = f"{cl}-{i}"
ALL_NODES[name] = inst
if name == MY_POD_NAME:
MY_POD_CLASS = val
MY_POD_CONFIG = inst
if "runs" in val:
if "baker" in val["runs"]:
Expand Down Expand Up @@ -525,7 +528,6 @@ def create_node_config_json(
):
"""Create the node's config.json file"""

values_node_config = MY_POD_CONFIG.get("config", {})
computed_node_config = {
"data-dir": "/var/tezos/node/data",
"rpc": {
Expand All @@ -538,7 +540,10 @@ def create_node_config_json(
},
# "log": {"level": "debug"},
}
node_config = recursive_update(values_node_config, computed_node_config)
node_config = NODE_GLOBALS.get("config", {})
node_config = recursive_update(node_config, MY_POD_CLASS.get("config", {}))
node_config = recursive_update(node_config, MY_POD_CONFIG.get("config", {}))
node_config = recursive_update(node_config, computed_node_config)

if THIS_IS_A_PUBLIC_NET:
# `tezos-node config --network ...` will have been run in config-init.sh
Expand Down

0 comments on commit 9530371

Please sign in to comment.