Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  4.  
  5. trap "exit 0" SIGTERM SIGINT SIGHUP SIGQUIT SIGKILL
  6.  
  7. if [[ ${KUBE_PROXY_NOOP} -eq 1 ]];then
  8. clean-install netcat
  9.  
  10. # mimic healthz server
  11. while true; do
  12. DATE="$(date -u "+%F %T.%N %z %Z m=+")$(perl -w -MTime::HiRes=clock_gettime,CLOCK_MONOTONIC -E 'say clock_gettime(CLOCK_MONOTONIC)')"
  13. CONTENT="{\"lastUpdated\": \"${DATE}\",\"currentTime\": \"${DATE}\"}"
  14. cat << EOF | perl -pe 'chomp if eof' | nc -s 127.0.0.1 -lp 10256 -q 1
  15. HTTP/1.1 200 OK$(printf "\r")
  16. Content-Type: application/json$(printf "\r")
  17. X-Content-Type-Options: nosniff$(printf "\r")
  18. Date: $(date -u)$(printf "\r")
  19. Content-Length: $((${#CONTENT}+0))$(printf "\r")
  20. $(printf "\r")
  21. ${CONTENT}
  22. EOF
  23.  
  24. done
  25. else
  26. # /usr/local/bin/kube-proxy
  27. exec kube-proxy "$@"
  28. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement