Skip to content

Commit

Permalink
add an option to override the network name for snapshot metadata (#614)
Browse files Browse the repository at this point in the history
* add an option to override the network name for snapshot metadata

* fix tests

* fix other test
  • Loading branch information
nicolasochem authored Nov 29, 2023
1 parent 69240ec commit 03923a2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions charts/tezos/templates/configs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ data:
ROLLING_TARBALL_URL: "{{ .Values.rolling_tarball_url }}"
ARCHIVE_TARBALL_URL: "{{ .Values.archive_tarball_url }}"
PREFER_TARBALLS: "{{ .Values.prefer_tarballs }}"
SNAPSHOT_METADATA_NETWORK_NAME: "{{ .Values.snapshot_metadata_network_name }}"
SNAPSHOT_SOURCE: "{{ .Values.snapshot_source }}"
OCTEZ_VERSION: "{{ .Values.images.octez }}"
NODE_GLOBALS: |
Expand Down
6 changes: 5 additions & 1 deletion charts/tezos/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,10 @@ snapshot_source: https://xtz-shots.io/tezos-snapshots.json
# If you prefer tarballs, set to "true" below.
prefer_tarballs: false

# In case the network name in the snapshot metadata does not correspond to the
# network_name configured in `node_config_network`, hardcode the value here.
# snapshot_metadata_network_name: "weeklynet"

# By default, tezos-k8s will attempt to download the right artifact from
# `snapshot_source` set above. You can override and hard-code a snapshot URL
# source below. When any of the below variables are set, `snapshot_source` above
Expand Down Expand Up @@ -397,7 +401,7 @@ expected_proof_of_work: 26
## - Specify the name of the network which must be recognized by the
## octez-node binary of the Octez image being used.
## - Pass a url that returns the config.json of the network. Example:
## "https://teztnets.xyz/mondaynet". It is helpful for running
## "https://teztnets.xyz/weeklynet". It is helpful for running
## testnets and shouldn't be needed in general.
node_config_network:
chain_name: mainnet
Expand Down
1 change: 1 addition & 0 deletions test/charts/mainnet.expect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ data:
ROLLING_TARBALL_URL: ""
ARCHIVE_TARBALL_URL: ""
PREFER_TARBALLS: "false"
SNAPSHOT_METADATA_NETWORK_NAME: ""
SNAPSHOT_SOURCE: "https://xtz-shots.io/tezos-snapshots.json"
OCTEZ_VERSION: "tezos/tezos:v17.3"
NODE_GLOBALS: |
Expand Down
1 change: 1 addition & 0 deletions test/charts/mainnet2.expect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ data:
ROLLING_TARBALL_URL: ""
ARCHIVE_TARBALL_URL: ""
PREFER_TARBALLS: "false"
SNAPSHOT_METADATA_NETWORK_NAME: ""
SNAPSHOT_SOURCE: "https://xtz-shots.io/tezos-snapshots.json"
OCTEZ_VERSION: "tezos/tezos:v17.3"
NODE_GLOBALS: |
Expand Down
1 change: 1 addition & 0 deletions test/charts/private-chain.expect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ data:
ROLLING_TARBALL_URL: ""
ARCHIVE_TARBALL_URL: ""
PREFER_TARBALLS: "false"
SNAPSHOT_METADATA_NETWORK_NAME: ""
SNAPSHOT_SOURCE: ""
OCTEZ_VERSION: "tezos/tezos:v15-release"
NODE_GLOBALS: |
Expand Down
5 changes: 4 additions & 1 deletion utils/config-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,10 @@ def create_node_config_json(
def create_node_snapshot_config_json(history_mode):
"""Create this node's snapshot config"""

network_name = NETWORK_CONFIG.get("chain_name")
if os.environ.get("SNAPSHOT_METADATA_NETWORK_NAME"):
network_name = os.environ.get("SNAPSHOT_METADATA_NETWORK_NAME")
else:
network_name = NETWORK_CONFIG.get("chain_name")
prefer_tarballs = os.environ.get("PREFER_TARBALLS", "").lower() in (
"true",
"1",
Expand Down

0 comments on commit 03923a2

Please sign in to comment.