Skip to content

Cenness/elect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leader Election for use in scripts

A trivial modification of the reference

Basic usage:

curl -L -o e.tgz https://github.com/Cenness/elect/releases/download/1.0.0/elect.tar.gz
tar xf e.tgz && rm -f e.tgz
chmod +x elect && mv elect /opt

/opt/elect \
  -kubeconfig=/path/to/kubeconfig \
  -logtostderr=true \
  -lease-lock-name=example \
  -lease-lock-namespace=default \
  -id=1 &
elect_pid="$!"
  
while true; do
  if [ -f example.leader ]; then
    break
  fi
  sleep 4
done

dowork

> example.done
wait $elect_pid

License

Licensed under Apache License version 2.0. See the LICENSE file for details.