Add glide.yaml and vendor deps

This commit is contained in:
Dalton Hubble 2016-12-03 22:43:32 -08:00
parent db918f12ad
commit 5b3d5e81bd
18880 changed files with 5166045 additions and 1 deletions

View file

@ -0,0 +1,87 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script is intended to start the docker and then loop until
# it detects a failure. It then exits, and supervisord restarts it
# which in turn restarts docker.
main() {
if ! healthy 60; then
stop_docker
start_docker
echo "waiting 30s for startup"
sleep 30
healthy 60
fi
while healthy; do
sleep 10
done
echo "Docker failed!"
exit 2
}
# Performs health check on docker. If a parameter is passed, it is treated as
# the number of seconds to keep trying for a healthy result. If none is passed
# we make only one attempt.
healthy() {
max_retry_sec="$1"
shift
starttime=$(date +%s)
while ! timeout 60 docker ps > /dev/null; do
if [[ -z "$max_retry_sec" || $(( $(date +%s) - starttime )) -gt "$max_retry_sec" ]]; then
echo "docker ps did not succeed"
return 2
else
echo "waiting 5s before retry"
sleep 5
fi
done
echo "docker is healthy"
return 0
}
stop_docker() {
/etc/init.d/docker stop
# Make sure docker gracefully terminated before start again
starttime=`date +%s`
while pidof docker > /dev/null; do
currenttime=`date +%s`
((elapsedtime = currenttime - starttime))
# after 60 seconds, forcefully terminate docker process
if test $elapsedtime -gt 60; then
echo "attempting to kill docker process with sigkill signal"
kill -9 `pidof docker` || sleep 10
else
echo "waiting clean shutdown"
sleep 10
fi
done
}
start_docker() {
echo "docker is not running. starting docker"
# cleanup docker network checkpoint to avoid running into known issue
# of docker (https://github.com/docker/docker/issues/18283)
rm -rf /var/lib/docker/network
/etc/init.d/docker start
}
main

View file

@ -0,0 +1,6 @@
[program:docker]
command=/usr/sbin/docker-checker.sh
stderr_logfile=/var/log/supervisor/docker-stderr.log
stdout_logfile=/var/log/supervisor/docker-stdout.log
autorestart=true
startretries=1000000

View file

@ -0,0 +1,102 @@
{% if not pillar.get('is_systemd') %}
supervisor:
pkg:
- installed
monit:
pkg:
- purged
/etc/supervisor/conf.d/docker.conf:
file:
- managed
- source: salt://supervisor/docker.conf
- user: root
- group: root
- mode: 644
- makedirs: True
- require_in:
- pkg: supervisor
- require:
- file: /usr/sbin/docker-checker.sh
/usr/sbin/docker-checker.sh:
file:
- managed
- source: salt://supervisor/docker-checker.sh
- user: root
- group: root
- mode: 755
- makedirs: True
/etc/supervisor/conf.d/kubelet.conf:
file:
- managed
- source: salt://supervisor/kubelet.conf
- user: root
- group: root
- mode: 644
- makedirs: True
- require_in:
- pkg: supervisor
- require:
- file: /usr/sbin/kubelet-checker.sh
/usr/sbin/kubelet-checker.sh:
file:
- managed
- source: salt://supervisor/kubelet-checker.sh
- template: jinja
- user: root
- group: root
- mode: 755
- makedirs: True
{% if grains['roles'][0] == 'kubernetes-master' -%}
/etc/supervisor/conf.d/kube-addons.conf:
file:
- managed
- source: salt://supervisor/kube-addons.conf
- user: root
- group: root
- mode: 644
- makedirs: True
- require_in:
- pkg: supervisor
- require:
- file: /usr/sbin/kube-addons-checker.sh
/usr/sbin/kube-addons-checker.sh:
file:
- managed
- source: salt://supervisor/kube-addons-checker.sh
- user: root
- group: root
- mode: 755
- makedirs: True
{% endif %}
/etc/supervisor/supervisor_watcher.sh:
file.managed:
- source: salt://supervisor/supervisor_watcher.sh
- user: root
- group: root
- mode: 755
- makedirs: True
crontab -l | { cat; echo "* * * * * /etc/supervisor/supervisor_watcher.sh 2>&1 | logger"; } | crontab -:
cmd.run:
- unless: crontab -l | grep "* * * * * /etc/supervisor/supervisor_watcher.sh 2>&1 | logger"
supervisor-service:
service:
- running
- name: supervisor
- watch:
- pkg: supervisor
- file: /etc/supervisor/conf.d/*
- require:
- pkg: supervisor
{% endif %}

View file

@ -0,0 +1,34 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script is intended to start the kube-addons and then loop until
# it detects a failure. It then exits, and supervisord restarts it
# which in turn restarts the kube-addons.
/etc/init.d/kube-addons stop
/etc/init.d/kube-addons start
echo "waiting a minute for startup"
sleep 60
while true; do
if ! /etc/init.d/kube-addons status > /dev/null; then
echo "kube-addons failed!"
exit 2
fi
sleep 10
done

View file

@ -0,0 +1,6 @@
[program:kube-addons]
command=/usr/sbin/kube-addons-checker.sh
stderr_logfile=/var/log/supervisor/kube-addons-stderr.log
stdout_logfile=/var/log/supervisor/kube-addons-stdout.log
autorestart=true
startretries=1000000

View file

@ -0,0 +1,42 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script is intended to start the kubelet and then loop until
# it detects a failure. It then exits, and supervisord restarts it
# which in turn restarts the kubelet.
{% set kubelet_port = "10250" -%}
{% if pillar['kubelet_port'] is defined -%}
{% set kubelet_port = pillar['kubelet_port'] -%}
{% endif -%}
/etc/init.d/kubelet stop
/etc/init.d/kubelet start
echo "waiting a minute for startup"
sleep 60
max_seconds=10
while true; do
if ! curl --insecure -m ${max_seconds} -f -s https://127.0.0.1:{{kubelet_port}}/healthz > /dev/null; then
echo "kubelet failed!"
curl --insecure https://127.0.0.1:{{kubelet_port}}/healthz
exit 2
fi
sleep 10
done

View file

@ -0,0 +1,6 @@
[program:kubelet]
command=/usr/sbin/kubelet-checker.sh
stderr_logfile=/var/log/supervisor/kubelet-stderr.log
stdout_logfile=/var/log/supervisor/kubelet-stdout.log
autorestart=true
startretries=1000000

View file

@ -0,0 +1,34 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script is invoked by crond every minute to check if supervisord is
# up and oom protected. If down it restarts supervisord; otherwise, it exits
# after applying oom_score_adj
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
if ! /etc/init.d/supervisor status > /dev/null; then
service supervisor start
sleep 10
fi
# Apply oom_score_adj: -901 to processes
pids=$(cat /var/run/supervisord.pid)
for pid in "${pids}"; do
echo -901 > /proc/$pid/oom_score_adj
done