github.phpd.cn/cilium/cilium@v1.6.12/test/provision/wait-cilium.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  main() {
     4      local cilium_started
     5      cilium_started=false
     6  
     7      for ((i = 0 ; i < 24; i++)); do
     8          if cilium status --brief > /dev/null 2>&1; then
     9              cilium_started=true
    10              break
    11          fi
    12          sleep 5s
    13          echo "Waiting for Cilium daemon to come up..."
    14      done
    15  
    16      if [ "$cilium_started" = true ] ; then
    17          echo 'Cilium successfully started!'
    18      else
    19          >&2 echo 'Timeout waiting for Cilium to start...'
    20          journalctl -u cilium.service --since $(systemctl show -p ActiveEnterTimestamp cilium.service | awk '{print $2 $3}')
    21          >&2 echo 'Cilium failed to start'
    22          exit 1
    23      fi
    24  }
    25  
    26  main "$@"