From nobody Thu May 13 20:33:00 2016 Content-Type: multipart/mixed; boundary="====================================" MIME-Version: 1.0 --==================================== MIME-Version: 1.0 Content-Type: text/upstart-job; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kube-install-node.conf" #upstart-job description "Download and install k8s binaries and configurations" start on cloud-config script { set -o errexit set -o nounset # Fetch the script for installing nodes binary and configuration files. curl --fail --retry 5 --retry-delay 3 --silent --show-error \ -H "X-Google-Metadata-Request: True" \ -o /etc/kube-configure.sh \ http://metadata.google.internal/computeMetadata/v1/instance/attributes/configure-sh . /etc/kube-configure.sh set_broken_motd echo "Downloading kube-env file" download_kube_env . /etc/kube-env echo "Install kube nodes binary and configuration files" install_kube_binary_config } 2>&1 | logger --priority daemon.info -t ${UPSTART_JOB} end script --==================================== MIME-Version: 1.0 Content-Type: text/upstart-job; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kube-env.conf" #upstart-job description "Prepare kube node environment" start on stopped kube-install-node script { set -o errexit set -o nounset . /etc/kube-configure-helper.sh . /etc/kube-env echo "Configuring hostname" config_hostname echo "Configuring IP firewall rules" config_ip_firewall echo "Creating required directories" create_dirs echo "Creating kubelet kubeconfig file" create_kubelet_kubeconfig echo "Creating kube-proxy kubeconfig file" create_kubeproxy_kubeconfig echo "Assemble kubelet command line" # Kubelet command flags will be in /etc/default/kubelet assemble_kubelet_flags } 2>&1 | logger --priority daemon.info -t ${UPSTART_JOB} end script --==================================== MIME-Version: 1.0 Content-Type: text/upstart-job; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kube-install-packages.conf" #upstart-job description "Install packages needed to run kubernetes" start on stopped kube-install-node script { set -o errexit set -o nounset . /etc/kube-configure-helper.sh install_critical_packages } 2>&1 | logger --priority daemon.info -t ${UPSTART_JOB} end script --==================================== MIME-Version: 1.0 Content-Type: text/upstart-job; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kube-install-additional-packages.conf" #upstart-job description "Install additional packages used by kubernetes" start on stopped kube-install-packages script { set -o errexit set -o nounset . /etc/kube-configure-helper.sh install_additional_packages } 2>&1 | logger --priority daemon.info -t ${UPSTART_JOB} end script --==================================== MIME-Version: 1.0 Content-Type: text/upstart-job; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kubelet.conf" #upstart-job description "Run kubelet service" start on stopped kube-install-packages and stopped kube-env respawn script { set -o errexit set -o nounset . /etc/kube-configure-helper.sh start_kubelet } 2>&1 | logger --priority daemon.info -t ${UPSTART_JOB} end script # Wait for 10s to start kubelet again. post-stop exec sleep 10 --==================================== MIME-Version: 1.0 Content-Type: text/upstart-job; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kube-docker.conf" #upstart-job description "Restart docker daemon" start on started kubelet script { set -o errexit set -o nounset . /etc/kube-configure-helper.sh . /etc/kube-env restart_docker_daemon } 2>&1 | logger --priority daemon.info -t ${UPSTART_JOB} end script --==================================== MIME-Version: 1.0 Content-Type: text/upstart-job; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kube-proxy.conf" #upstart-job description "Start kube-proxy static pod" start on stopped kube-docker script { set -o errexit set -o nounset . /etc/kube-configure-helper.sh . /etc/kube-env prepare_log_file "/var/log/kube-proxy.log" # Load the docker image from file /home/kubernetes/kube-docker-files/kube-proxy.tar. echo "Try to load docker image file kube-proxy.tar" timeout 30 docker load -i /home/kubernetes/kube-docker-files/kube-proxy.tar # Copy the manifest to /tmp to manipulate tmp_file="/tmp/kube-proxy.manifest" cp -f /home/kubernetes/kube-manifests/kubernetes/kube-proxy.manifest ${tmp_file} # Remove the lines of salt configuration and replace variables with values. # NOTE: Changes to variable names in cluster/saltbase/salt/kube-proxy/kube-proxy.manifest # may break this upstart job. sed -i "/^ *{%/d" ${tmp_file} kubeconfig="--kubeconfig=\/var\/lib\/kube-proxy\/kubeconfig" kube_docker_registry="gcr.io\/google_containers" if [ -n "${KUBE_DOCKER_REGISTRY:-}" ]; then kube_docker_registry=${KUBE_DOCKER_REGISTRY} fi kube_proxy_docker_tag=$(cat /home/kubernetes/kube-docker-files/kube-proxy.docker_tag) test_args="" if [ -n "${KUBEPROXY_TEST_ARGS:-}" ]; then test_args="${KUBEPROXY_TEST_ARGS}" fi log_level="--v=2" if [ -n "${KUBEPROXY_TEST_LOG_LEVEL:-}" ]; then log_level="${KUBEPROXY_TEST_LOG_LEVEL}" fi api_servers="--master=https://${KUBERNETES_MASTER_NAME}" sed -i -e "s@{{kubeconfig}}@${kubeconfig}@g" ${tmp_file} sed -i -e "s@{{pillar\['kube_docker_registry'\]}}@${kube_docker_registry}@g" ${tmp_file} sed -i -e "s@{{pillar\['kube-proxy_docker_tag'\]}}@${kube_proxy_docker_tag}@g" ${tmp_file} sed -i -e "s@{{test_args}}@${test_args}@g" ${tmp_file} sed -i -e "s@{{ cpurequest }}@100m@g" ${tmp_file} sed -i -e "s@{{log_level}}@${log_level}@g" ${tmp_file} sed -i -e "s@{{api_servers_with_port}}@${api_servers}@g" ${tmp_file} if [ -n "${CLUSTER_IP_RANGE:-}" ]; then sed -i -e "s@{{cluster_cidr}}@--cluster-cidr=${CLUSTER_IP_RANGE}@g" ${tmp_file} fi mv -f ${tmp_file} /etc/kubernetes/manifests/ } 2>&1 | logger --priority daemon.info -t ${UPSTART_JOB} end script --==================================== MIME-Version: 1.0 Content-Type: text/upstart-job; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kube-addons.conf" #upstart-job description "Install kubelet add-on manifest files" start on stopped kube-docker script { set -o errexit set -o nounset . /etc/kube-configure-helper.sh . /etc/kube-env # Kube-registry-proxy if [ "${ENABLE_CLUSTER_REGISTRY:-}" = "true" ]; then cp /home/kubernetes/kube-manifests/kubernetes/kube-registry-proxy.yaml /etc/kubernetes/manifests/ fi reset_motd } 2>&1 | logger --priority daemon.info -t ${UPSTART_JOB} end script --==================================== MIME-Version: 1.0 Content-Type: text/upstart-job; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kube-node-health-monitoring.conf" description "Kubernetes node health monitoring" start on stopped kube-docker respawn script { set -o nounset set -o errexit # Wait for a minute to let docker, kubelet, and kube-proxy processes finish initialization. # TODO(andyzheng0831): replace it with a more reliable method if possible. sleep 60 . /etc/kube-configure-helper.sh . /etc/kube-env health_monitoring } 2>&1 | logger --priority daemon.info -t ${UPSTART_JOB} end script # Wait for 10s to start it again. post-stop exec sleep 10 --====================================--