mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-03-09 19:58:07 +03:00
Support new version of 'calicoctl' (>=v1.0.0)
Since version 'v1.0.0-beta' calicoctl is written in Go and its API differs from old Python based utility. Added support of both old and new version of the utility.
This commit is contained in:
@@ -31,7 +31,7 @@ logfile="/var/log/$prog"
|
||||
|
||||
do_status()
|
||||
{
|
||||
if [ $($dockerexec ps | awk '{ print $2 }' | grep calico/node | wc -l) -ne 1 ]; then
|
||||
if [ $($dockerexec ps --format "{{.Image}}" | grep -cw 'calico/node') -ne 1 ]; then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -53,7 +53,11 @@ do_start() {
|
||||
if [ $retval -ne 0 ]; then
|
||||
printf "Starting $prog:\t"
|
||||
echo "\n$(date)\n" >> $logfile
|
||||
$exec node --ip=${DEFAULT_IPV4} &>>$logfile
|
||||
{% if legacy_calicoctl %}
|
||||
$exec node --ip=${DEFAULT_IPV4} &>>$logfile
|
||||
{% else %}
|
||||
$exec node run --ip=${DEFAULT_IPV4} &>>$logfile
|
||||
{% endif %}
|
||||
success
|
||||
echo
|
||||
else
|
||||
@@ -65,7 +69,12 @@ do_start() {
|
||||
|
||||
do_stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
{% if legacy_calicoctl %}
|
||||
$exec node stop >> /dev/null || $exec node stop --force >> /dev/null
|
||||
{% else %}
|
||||
echo "Current version of ${exec} doesn't support 'node stop' command!"
|
||||
return 1
|
||||
{% endif %}
|
||||
retval=$?
|
||||
echo
|
||||
return $retval
|
||||
|
||||
Reference in New Issue
Block a user