Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

one process per baker #517

Merged
merged 3 commits into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions charts/tezos/scripts/baker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ EOF
fi
extra_args="--votefile ${per_block_vote_file}"

tezos_version=$(octez-client --version | sed -e 's/ //g')
if [[ "$tezos_version" == *"13.0"* ]]; then
# version 13 of octez mandates CLI flag as well as vote file
extra_args="$extra_args --liquidity-baking-toggle-vote on"
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 "
printf "due to uneven numer of bakers within the statefulset\n"
sleep 300
done
fi

my_baker_account="$(cat /etc/tezos/baker-account )"

CLIENT="$TEZ_BIN/octez-client -d $CLIENT_DIR"
CMD="$TEZ_BIN/tezos-baker-$proto_command -d $CLIENT_DIR"

Expand Down
40 changes: 29 additions & 11 deletions charts/tezos/templates/_containers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@
{{- end }}
- name: DAEMON
value: {{ .type }}
{{- if .baker_index }}
- name: BAKER_INDEX
value: "{{ .baker_index }}"
{{- end }}
{{- $envdict := dict }}
{{- $lenv := $.node_vals.env | default dict }}
{{- $genv := $.Values.node_globals.env | default dict }}
Expand Down Expand Up @@ -267,17 +271,31 @@
{{- define "tezos.container.bakers" }}
{{- if has "baker" $.node_vals.runs }}
{{- $node_vals_images := $.node_vals.images | default dict }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this line was not introduced in this PR but i don't see why it is needed.

{{- range .Values.protocols }}
{{- if (not .vote) }}
{{ fail (print "You did not specify the liquidity baking toggle vote in 'protocols' for protocol " .command ".") }}
{{- end -}}
{{- $_ := set $ "command_in_tpl" .command }}
{{- include "tezos.generic_container" (dict "root" $
"name" (print "baker-"
(lower .command))
"type" "baker"
"image" "octez"
) | nindent 0 }}
{{/* calculate the max number of bakers accross instances */}}
{{- $max_baker_num := 0 }}
{{- range $i := $.node_vals.instances }}
{{- if hasKey $i "bake_using_account" }}
{{- $max_baker_num = max 1 $max_baker_num }}
{{- else }}
{{- $max_baker_num = max (len (get $i "bake_using_accounts")) $max_baker_num }}
{{- end }}
{{- end }}
{{- range $n := until (int $max_baker_num) }}
{{- range $.Values.protocols }}
{{- if (not .vote) }}
{{ fail (print "You did not specify the liquidity baking toggle vote in 'protocols' for protocol " .command ".") }}
{{- end -}}
{{- $_ := set $ "command_in_tpl" .command }}
{{- include "tezos.generic_container" (dict "root" $
"name" (print "baker-"
print $n
print "-"
(lower .command))
"type" "baker"
"image" "octez"
"baker_index" (print $n)
) | nindent 0 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Expand Down
Loading