diff --git a/charts/tezos/scripts/baker.sh b/charts/tezos/scripts/baker.sh index 404e49877..358378649 100644 --- a/charts/tezos/scripts/baker.sh +++ b/charts/tezos/scripts/baker.sh @@ -9,7 +9,10 @@ BAKER_EXTRA_ARGS_FROM_ENV=${BAKER_EXTRA_ARGS} proto_command="{{ .command_in_tpl }}" -per_block_vote_file=/etc/tezos/per-block-votes/${proto_command}-per-block-votes.json +my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )" + +per_block_vote_file=/etc/tezos/per-block-votes/${my_baker_account}-${proto_command}-per-block-votes.json + if [ $(cat $per_block_vote_file) == "null" ]; then cat << EOF You must pass per-block-votes (such as liquidity_baking_toggle_vote) in values.yaml, for example: @@ -22,8 +25,6 @@ EOF fi extra_args="--votefile ${per_block_vote_file}" -my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )" - if [ "${my_baker_account}" == "" ]; then while true; do printf "This container is not baking, but exists " diff --git a/charts/tezos/templates/configs.yaml b/charts/tezos/templates/configs.yaml index 88b2872f7..4912edf3b 100644 --- a/charts/tezos/templates/configs.yaml +++ b/charts/tezos/templates/configs.yaml @@ -76,8 +76,10 @@ metadata: {{- if (include "tezos.hasPerBlockVotes" .) }} apiVersion: v1 data: -{{- range .Values.protocols }} - {{ .command }}-per-block-votes.json: {{ .vote | toJson | quote }} +{{- range $k, $v := .Values.accounts }} +{{- range ( $v.protocols | default $.Values.protocols ) }} + {{ $k }}-{{ .command }}-per-block-votes.json: {{ .vote | toJson | quote }} +{{- end }} {{- end }} kind: ConfigMap metadata: diff --git a/charts/tezos/values.yaml b/charts/tezos/values.yaml index df3ef5a92..80791fea9 100644 --- a/charts/tezos/values.yaml +++ b/charts/tezos/values.yaml @@ -38,7 +38,8 @@ bootstrap_mutez: "4000000000000" accounts: {} # # `accounts` is a map where keys are account aliases and values are maps of -# fields `key`, `is_bootstrap_baker_account`, `bootstrap_balance` and `signer_url`. +# fields `key`, `is_bootstrap_baker_account`, `bootstrap_balance`, `signer_url` +# and `protocols`. # # The `key` field can be set to a public or private key. For a bootstrap baker, # it must be set to a private key. The key type will be recognized automatically, @@ -53,6 +54,10 @@ accounts: {} # node but they will not be bootstrap accounts. If you don't set a bootstrap # balance, it will default to the `bootstrap_mutez` field above. # +# The `protocols` fields overrides the top-level `protocols` field described +# below and has the same syntax. This allows to set specific per-block votes per +# baker. +# # Example: # # ``` @@ -66,6 +71,10 @@ accounts: {} # key: edpk... # is_bootstrap_baker_account: false # bootstrap_balance: "4000000000000" +# protocols: +# - command: PtLimaPt +# vote: +# liquidity_baking_toggle_vote: "on" # ``` # # A public key account can contain a url to a remote signer that signs with the diff --git a/test/charts/private-chain.expect.yaml b/test/charts/private-chain.expect.yaml index 49f383e67..32bd08166 100644 --- a/test/charts/private-chain.expect.yaml +++ b/test/charts/private-chain.expect.yaml @@ -186,7 +186,6 @@ metadata: # Source: tezos-chain/templates/configs.yaml apiVersion: v1 data: - 013-PtJakart-per-block-votes.json: "{\"liquidity_baking_toggle_vote\":\"pass\"}" kind: ConfigMap metadata: name: per-block-votes @@ -575,7 +574,10 @@ spec: proto_command="013-PtJakart" - per_block_vote_file=/etc/tezos/per-block-votes/${proto_command}-per-block-votes.json + my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )" + + per_block_vote_file=/etc/tezos/per-block-votes/${my_baker_account}-${proto_command}-per-block-votes.json + if [ $(cat $per_block_vote_file) == "null" ]; then cat << EOF You must pass per-block-votes (such as liquidity_baking_toggle_vote) in values.yaml, for example: @@ -588,8 +590,6 @@ spec: fi extra_args="--votefile ${per_block_vote_file}" - my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )" - if [ "${my_baker_account}" == "" ]; then while true; do printf "This container is not baking, but exists " @@ -642,7 +642,10 @@ spec: proto_command="013-PtJakart" - per_block_vote_file=/etc/tezos/per-block-votes/${proto_command}-per-block-votes.json + my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )" + + per_block_vote_file=/etc/tezos/per-block-votes/${my_baker_account}-${proto_command}-per-block-votes.json + if [ $(cat $per_block_vote_file) == "null" ]; then cat << EOF You must pass per-block-votes (such as liquidity_baking_toggle_vote) in values.yaml, for example: @@ -655,8 +658,6 @@ spec: fi extra_args="--votefile ${per_block_vote_file}" - my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )" - if [ "${my_baker_account}" == "" ]; then while true; do printf "This container is not baking, but exists " @@ -709,7 +710,10 @@ spec: proto_command="013-PtJakart" - per_block_vote_file=/etc/tezos/per-block-votes/${proto_command}-per-block-votes.json + my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )" + + per_block_vote_file=/etc/tezos/per-block-votes/${my_baker_account}-${proto_command}-per-block-votes.json + if [ $(cat $per_block_vote_file) == "null" ]; then cat << EOF You must pass per-block-votes (such as liquidity_baking_toggle_vote) in values.yaml, for example: @@ -722,8 +726,6 @@ spec: fi extra_args="--votefile ${per_block_vote_file}" - my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )" - if [ "${my_baker_account}" == "" ]; then while true; do printf "This container is not baking, but exists " @@ -776,7 +778,10 @@ spec: proto_command="013-PtJakart" - per_block_vote_file=/etc/tezos/per-block-votes/${proto_command}-per-block-votes.json + my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )" + + per_block_vote_file=/etc/tezos/per-block-votes/${my_baker_account}-${proto_command}-per-block-votes.json + if [ $(cat $per_block_vote_file) == "null" ]; then cat << EOF You must pass per-block-votes (such as liquidity_baking_toggle_vote) in values.yaml, for example: @@ -789,8 +794,6 @@ spec: fi extra_args="--votefile ${per_block_vote_file}" - my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )" - if [ "${my_baker_account}" == "" ]; then while true; do printf "This container is not baking, but exists " @@ -843,7 +846,10 @@ spec: proto_command="013-PtJakart" - per_block_vote_file=/etc/tezos/per-block-votes/${proto_command}-per-block-votes.json + my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )" + + per_block_vote_file=/etc/tezos/per-block-votes/${my_baker_account}-${proto_command}-per-block-votes.json + if [ $(cat $per_block_vote_file) == "null" ]; then cat << EOF You must pass per-block-votes (such as liquidity_baking_toggle_vote) in values.yaml, for example: @@ -856,8 +862,6 @@ spec: fi extra_args="--votefile ${per_block_vote_file}" - my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )" - if [ "${my_baker_account}" == "" ]; then while true; do printf "This container is not baking, but exists "