Skip to content

Commit

Permalink
Merge branch 'master' into evm_rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasochem committed Dec 8, 2023
2 parents 20b7564 + c1fb087 commit e1a6dba
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 31 deletions.
37 changes: 23 additions & 14 deletions charts/pyrometer/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: pyrometer
namespace: {{ .Release.Namespace }}
spec:
serviceName: pyrometer
selector:
matchLabels:
app: pyrometer
Expand All @@ -16,6 +17,8 @@ spec:
# https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
spec:
strategy:
type: Recreate
securityContext:
fsGroup: 1000
containers:
Expand All @@ -28,9 +31,9 @@ spec:
- -d
- '/data'
ports:
- name: http
containerPort: 8080
protocol: TCP
- name: http
containerPort: 8080
protocol: TCP
volumeMounts:
- name: config-volume
mountPath: /config/
Expand All @@ -39,20 +42,26 @@ spec:
- name: prom-exporter
image: {{ .Values.tezos_k8s_images.utils }}
ports:
- name: metrics
containerPort: 31732
protocol: TCP
- name: metrics
containerPort: 31732
protocol: TCP
command:
- /usr/local/bin/python
- /usr/local/bin/python
args:
- "-c"
- |
- "-c"
- |
{{ tpl ($.Files.Get (print "scripts/pyrometer_exporter.py")) $ | indent 12 }}
volumes:
- name: config-volume
configMap:
name: pyrometer-config
- name: pyrometer-volume
# Stores pyrometer's state (like pending queue items)
persistentVolumeClaim:
claimName: pyrometer-volume
volumeClaimTemplates:
- metadata:
name: pyrometer-volume
spec:
storageClassName:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
12 changes: 0 additions & 12 deletions charts/pyrometer/templates/volume.yaml

This file was deleted.

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 @@ -408,6 +408,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 @@ -445,7 +449,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
4 changes: 3 additions & 1 deletion mkchain/tqchain/mkchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ def main():
for key_type in keys:
accounts[key_type][account] = {
"key": keys[key_type],
"is_bootstrap_baker_account": False if account == "authorized-key-0" else True,
"is_bootstrap_baker_account": False
if account == "authorized-key-0"
else True,
"bootstrap_balance": "4000000000000",
}

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
18 changes: 15 additions & 3 deletions utils/config-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,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 Expand Up @@ -744,7 +747,13 @@ def create_node_snapshot_config_json(history_mode):
octez_container_version = os.environ.get("OCTEZ_VERSION")
snapshot_source = os.environ.get("SNAPSHOT_SOURCE")
if snapshot_source:
all_snapshots = requests.get(snapshot_source).json()
try:
response = requests.get(snapshot_source)
response.raise_for_status() # Raises an HTTPError if the HTTP request returned an unsuccessful status code
all_snapshots = response.json()
except (requests.exceptions.RequestException, requests.exceptions.JSONDecodeError): # Catches exceptions related to requests and invalid JSON
print(f"Error: unable to retrieve snapshot metadata from {snapshot_source}")
return
else:
return
try:
Expand Down Expand Up @@ -772,11 +781,14 @@ def create_node_snapshot_config_json(history_mode):
and s.get("chain_name") == network_name
]
if octez_version:
matching_snapshots = [
version_matching_snapshots = [
s
for s in matching_snapshots
if int(octez_version) == s.get("tezos_version").get("version").get("major")
]
if len(version_matching_snapshots):
# If we can't find snapshots of the right octez version, we just pick the most recent available.
matching_snapshots = version_matching_snapshots
matching_snapshots = sorted(matching_snapshots, key=lambda s: s.get("block_height"))

return matching_snapshots[-1] if len(matching_snapshots) else None
Expand Down

0 comments on commit e1a6dba

Please sign in to comment.