mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	remove support for container-linux in gce kube-up
This commit is contained in:
		@@ -414,7 +414,6 @@ function kube::release::package_kube_manifests_tarball() {
 | 
			
		||||
  cp "${salt_dir}/e2e-image-puller/e2e-image-puller.manifest" "${gci_dst_dir}/"
 | 
			
		||||
  cp "${KUBE_ROOT}/cluster/gce/gci/configure-helper.sh" "${gci_dst_dir}/gci-configure-helper.sh"
 | 
			
		||||
  cp "${KUBE_ROOT}/cluster/gce/gci/health-monitor.sh" "${gci_dst_dir}/health-monitor.sh"
 | 
			
		||||
  cp "${KUBE_ROOT}/cluster/gce/container-linux/configure-helper.sh" "${gci_dst_dir}/container-linux-configure-helper.sh"
 | 
			
		||||
  cp -r "${salt_dir}/kube-admission-controls/limit-range" "${gci_dst_dir}"
 | 
			
		||||
  local objects
 | 
			
		||||
  objects=$(cd "${KUBE_ROOT}/cluster/addons" && find . \( -name \*.yaml -or -name \*.yaml.in -or -name \*.json \) | grep -v demo)
 | 
			
		||||
 
 | 
			
		||||
@@ -436,8 +436,8 @@ function find-release-tars() {
 | 
			
		||||
 | 
			
		||||
  # This tarball is used by GCI, Ubuntu Trusty, and Container Linux.
 | 
			
		||||
  KUBE_MANIFESTS_TAR=
 | 
			
		||||
  if [[ "${MASTER_OS_DISTRIBUTION:-}" == "trusty" || "${MASTER_OS_DISTRIBUTION:-}" == "gci" || "${MASTER_OS_DISTRIBUTION:-}" == "container-linux" || "${MASTER_OS_DISTRIBUTION:-}" == "ubuntu" ]] || \
 | 
			
		||||
     [[ "${NODE_OS_DISTRIBUTION:-}" == "trusty" || "${NODE_OS_DISTRIBUTION:-}" == "gci" || "${NODE_OS_DISTRIBUTION:-}" == "container-linux" || "${NODE_OS_DISTRIBUTION:-}" == "ubuntu" ]] ; then
 | 
			
		||||
  if [[ "${MASTER_OS_DISTRIBUTION:-}" == "trusty" || "${MASTER_OS_DISTRIBUTION:-}" == "gci" || "${MASTER_OS_DISTRIBUTION:-}" == "ubuntu" ]] || \
 | 
			
		||||
     [[ "${NODE_OS_DISTRIBUTION:-}" == "trusty" || "${NODE_OS_DISTRIBUTION:-}" == "gci" || "${NODE_OS_DISTRIBUTION:-}" == "ubuntu" ]] ; then
 | 
			
		||||
    KUBE_MANIFESTS_TAR=$(find-tar kubernetes-manifests.tar.gz)
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
@@ -576,9 +576,7 @@ function build-kube-env {
 | 
			
		||||
  local server_binary_tar_url=$SERVER_BINARY_TAR_URL
 | 
			
		||||
  local salt_tar_url=$SALT_TAR_URL
 | 
			
		||||
  local kube_manifests_tar_url="${KUBE_MANIFESTS_TAR_URL:-}"
 | 
			
		||||
  if [[ "${master}" == "true" && "${MASTER_OS_DISTRIBUTION}" == "container-linux" ]] || \
 | 
			
		||||
     [[ "${master}" == "false" && "${NODE_OS_DISTRIBUTION}" == "container-linux" ]] || \
 | 
			
		||||
     [[ "${master}" == "true" && "${MASTER_OS_DISTRIBUTION}" == "ubuntu" ]] || \
 | 
			
		||||
  if [[ "${master}" == "true" && "${MASTER_OS_DISTRIBUTION}" == "ubuntu" ]] || \
 | 
			
		||||
     [[ "${master}" == "false" && "${NODE_OS_DISTRIBUTION}" == "ubuntu" ]] ; then
 | 
			
		||||
    # TODO: Support fallback .tar.gz settings on Container Linux
 | 
			
		||||
    server_binary_tar_url=$(split_csv "${SERVER_BINARY_TAR_URL}")
 | 
			
		||||
@@ -696,8 +694,8 @@ EOF
 | 
			
		||||
TERMINATED_POD_GC_THRESHOLD: $(yaml-quote ${TERMINATED_POD_GC_THRESHOLD})
 | 
			
		||||
EOF
 | 
			
		||||
  fi
 | 
			
		||||
  if [[ "${master}" == "true" && ("${MASTER_OS_DISTRIBUTION}" == "trusty" || "${MASTER_OS_DISTRIBUTION}" == "gci" || "${MASTER_OS_DISTRIBUTION}" == "container-linux") || "${MASTER_OS_DISTRIBUTION}" == "ubuntu" ]] || \
 | 
			
		||||
     [[ "${master}" == "false" && ("${NODE_OS_DISTRIBUTION}" == "trusty" || "${NODE_OS_DISTRIBUTION}" == "gci" || "${NODE_OS_DISTRIBUTION}" == "container-linux") || "${NODE_OS_DISTRIBUTION}" = "ubuntu" ]] ; then
 | 
			
		||||
  if [[ "${master}" == "true" && ("${MASTER_OS_DISTRIBUTION}" == "trusty" || "${MASTER_OS_DISTRIBUTION}" == "gci") || "${MASTER_OS_DISTRIBUTION}" == "ubuntu" ]] || \
 | 
			
		||||
     [[ "${master}" == "false" && ("${NODE_OS_DISTRIBUTION}" == "trusty" || "${NODE_OS_DISTRIBUTION}" == "gci") || "${NODE_OS_DISTRIBUTION}" = "ubuntu" ]] ; then
 | 
			
		||||
    cat >>$file <<EOF
 | 
			
		||||
KUBE_MANIFESTS_TAR_URL: $(yaml-quote ${kube_manifests_tar_url})
 | 
			
		||||
KUBE_MANIFESTS_TAR_HASH: $(yaml-quote ${KUBE_MANIFESTS_TAR_HASH})
 | 
			
		||||
@@ -942,16 +940,6 @@ EOF
 | 
			
		||||
  if [ -n "${EVICTION_HARD:-}" ]; then
 | 
			
		||||
      cat >>$file <<EOF
 | 
			
		||||
EVICTION_HARD: $(yaml-quote ${EVICTION_HARD})
 | 
			
		||||
EOF
 | 
			
		||||
  fi
 | 
			
		||||
  if [[ "${master}" == "true" && "${MASTER_OS_DISTRIBUTION}" == "container-linux" ]] || \
 | 
			
		||||
     [[ "${master}" == "false" && "${NODE_OS_DISTRIBUTION}" == "container-linux" ]]; then
 | 
			
		||||
    # Container-Linux-only env vars. TODO(yifan): Make them available on other distros.
 | 
			
		||||
    cat >>$file <<EOF
 | 
			
		||||
KUBERNETES_CONTAINER_RUNTIME: $(yaml-quote ${CONTAINER_RUNTIME:-rkt})
 | 
			
		||||
RKT_VERSION: $(yaml-quote ${RKT_VERSION:-})
 | 
			
		||||
RKT_PATH: $(yaml-quote ${RKT_PATH:-})
 | 
			
		||||
RKT_STAGE1_IMAGE: $(yaml-quote ${RKT_STAGE1_IMAGE:-})
 | 
			
		||||
EOF
 | 
			
		||||
  fi
 | 
			
		||||
  if [[ "${ENABLE_CLUSTER_AUTOSCALER}" == "true" ]]; then
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,6 @@ load("@io_kubernetes_build//defs:build.bzl", "release_filegroup")
 | 
			
		||||
pkg_tar(
 | 
			
		||||
    name = "gci-trusty-manifests",
 | 
			
		||||
    files = [
 | 
			
		||||
        "container-linux/configure-helper.sh",
 | 
			
		||||
        "gci/configure-helper.sh",
 | 
			
		||||
        "gci/health-monitor.sh",
 | 
			
		||||
        "//cluster/gce/gci/mounter",
 | 
			
		||||
@@ -15,7 +14,6 @@ pkg_tar(
 | 
			
		||||
    strip_prefix = ".",
 | 
			
		||||
    # pkg_tar doesn't support renaming the files we add, so instead create symlinks.
 | 
			
		||||
    symlinks = {
 | 
			
		||||
        "container-linux-configure-helper.sh": "container-linux/configure-helper.sh",
 | 
			
		||||
        "gci-configure-helper.sh": "gci/configure-helper.sh",
 | 
			
		||||
        "health-monitor.sh": "gci/health-monitor.sh",
 | 
			
		||||
        "gci-mounter": "gci/mounter/mounter",
 | 
			
		||||
 
 | 
			
		||||
@@ -54,12 +54,6 @@ CREATE_CUSTOM_NETWORK=${CREATE_CUSTOM_NETWORK:-false}
 | 
			
		||||
 | 
			
		||||
MASTER_OS_DISTRIBUTION=${KUBE_MASTER_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
 | 
			
		||||
NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
 | 
			
		||||
if [[ "${MASTER_OS_DISTRIBUTION}" == "coreos" ]]; then
 | 
			
		||||
    MASTER_OS_DISTRIBUTION="container-linux"
 | 
			
		||||
fi
 | 
			
		||||
if [[ "${NODE_OS_DISTRIBUTION}" == "coreos" ]]; then
 | 
			
		||||
    NODE_OS_DISTRIBUTION="container-linux"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ "${MASTER_OS_DISTRIBUTION}" == "cos" ]]; then
 | 
			
		||||
    MASTER_OS_DISTRIBUTION="gci"
 | 
			
		||||
 
 | 
			
		||||
@@ -53,13 +53,6 @@ CREATE_CUSTOM_NETWORK=${CREATE_CUSTOM_NETWORK:-false}
 | 
			
		||||
 | 
			
		||||
MASTER_OS_DISTRIBUTION=${KUBE_MASTER_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
 | 
			
		||||
NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
 | 
			
		||||
if [[ "${MASTER_OS_DISTRIBUTION}" == "coreos" ]]; then
 | 
			
		||||
    MASTER_OS_DISTRIBUTION="container-linux"
 | 
			
		||||
fi
 | 
			
		||||
if [[ "${NODE_OS_DISTRIBUTION}" == "coreos" ]]; then
 | 
			
		||||
    NODE_OS_DISTRIBUTION="container-linux"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ "${MASTER_OS_DISTRIBUTION}" == "cos" ]]; then
 | 
			
		||||
    MASTER_OS_DISTRIBUTION="gci"
 | 
			
		||||
fi
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +0,0 @@
 | 
			
		||||
approvers:
 | 
			
		||||
- euank
 | 
			
		||||
- yifan-gu
 | 
			
		||||
- ethernetdan
 | 
			
		||||
reviewers:
 | 
			
		||||
- euank
 | 
			
		||||
- yifan-gu
 | 
			
		||||
- ethernetdan
 | 
			
		||||
@@ -1,8 +0,0 @@
 | 
			
		||||
# Container Linux image
 | 
			
		||||
 | 
			
		||||
The [Container Linux Operating System](https://coreos.com/why/) is a Linux distribution optimized for running containers securely at scale.
 | 
			
		||||
CoreOS provides [a Container Linux image](https://coreos.com/os/docs/latest/booting-on-google-compute-engine.html) for Google Cloud Platform (GCP).
 | 
			
		||||
 | 
			
		||||
This folder contains configuration and tooling to allow kube-up to create a Kubernetes cluster on Google Cloud Platform running on the official Container Linux image.
 | 
			
		||||
 | 
			
		||||
[]()
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,182 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
# Copyright 2016 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.
 | 
			
		||||
 | 
			
		||||
set -o errexit
 | 
			
		||||
set -o nounset
 | 
			
		||||
set -o pipefail
 | 
			
		||||
 | 
			
		||||
# Use --retry-connrefused opt only if it's supported by curl.
 | 
			
		||||
CURL_RETRY_CONNREFUSED=""
 | 
			
		||||
if curl --help | grep -q -- '--retry-connrefused'; then
 | 
			
		||||
  CURL_RETRY_CONNREFUSED='--retry-connrefused'
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
function download-kube-env {
 | 
			
		||||
  # Fetch kube-env from GCE metadata server.
 | 
			
		||||
  local -r tmp_kube_env="/tmp/kube-env.yaml"
 | 
			
		||||
  curl --fail --retry 5 --retry-delay 3 ${CURL_RETRY_CONNREFUSED} --silent --show-error \
 | 
			
		||||
    -H "X-Google-Metadata-Request: True" \
 | 
			
		||||
    -o "${tmp_kube_env}" \
 | 
			
		||||
    http://metadata.google.internal/computeMetadata/v1/instance/attributes/kube-env
 | 
			
		||||
  # Convert the yaml format file into a shell-style file.
 | 
			
		||||
  sed 's/: /=/' < "${tmp_kube_env}" > "${KUBE_HOME}/kube-env"
 | 
			
		||||
  rm -f "${tmp_kube_env}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function validate-hash {
 | 
			
		||||
  local -r file="$1"
 | 
			
		||||
  local -r expected="$2"
 | 
			
		||||
 | 
			
		||||
  actual=$(sha1sum ${file} | awk '{ print $1 }') || true
 | 
			
		||||
  if [[ "${actual}" != "${expected}" ]]; then
 | 
			
		||||
    echo "== ${file} corrupted, sha1 ${actual} doesn't match expected ${expected} =="
 | 
			
		||||
    return 1
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Retry a download until we get it. Takes a hash and a set of URLs.
 | 
			
		||||
#
 | 
			
		||||
# $1 is the sha1 of the URL. Can be "" if the sha1 is unknown.
 | 
			
		||||
# $2+ are the URLs to download.
 | 
			
		||||
function download-or-bust {
 | 
			
		||||
  local -r hash="$1"
 | 
			
		||||
  shift 1
 | 
			
		||||
 | 
			
		||||
  local -r urls=( $* )
 | 
			
		||||
  while true; do
 | 
			
		||||
    for url in "${urls[@]}"; do
 | 
			
		||||
      local file="${url##*/}"
 | 
			
		||||
      rm -f "${file}"
 | 
			
		||||
      if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --max-time 300 --retry 6 --retry-delay 10 ${CURL_RETRY_CONNREFUSED} "${url}"; then
 | 
			
		||||
        echo "== Failed to download ${url}. Retrying. =="
 | 
			
		||||
      elif [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
 | 
			
		||||
        echo "== Hash validation of ${url} failed. Retrying. =="
 | 
			
		||||
      else
 | 
			
		||||
        if [[ -n "${hash}" ]]; then
 | 
			
		||||
          echo "== Downloaded ${url} (SHA1 = ${hash}) =="
 | 
			
		||||
        else
 | 
			
		||||
          echo "== Downloaded ${url} =="
 | 
			
		||||
        fi
 | 
			
		||||
        return
 | 
			
		||||
      fi
 | 
			
		||||
    done
 | 
			
		||||
  done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function split-commas {
 | 
			
		||||
  echo $1 | tr "," "\n"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Downloads kubernetes binaries and kube-system manifest tarball, unpacks them,
 | 
			
		||||
# and places them into suitable directories. Files are placed in /opt/kubernetes.
 | 
			
		||||
function install-kube-binary-config {
 | 
			
		||||
  cd "${KUBE_HOME}"
 | 
			
		||||
  local -r server_binary_tar_urls=( $(split-commas "${SERVER_BINARY_TAR_URL}") )
 | 
			
		||||
  local -r server_binary_tar="${server_binary_tar_urls[0]##*/}"
 | 
			
		||||
  if [[ -n "${SERVER_BINARY_TAR_HASH:-}" ]]; then
 | 
			
		||||
    local -r server_binary_tar_hash="${SERVER_BINARY_TAR_HASH}"
 | 
			
		||||
  else
 | 
			
		||||
    echo "Downloading binary release sha1 (not found in env)"
 | 
			
		||||
    download-or-bust "" "${server_binary_tar_urls[@]/.tar.gz/.tar.gz.sha1}"
 | 
			
		||||
    local -r server_binary_tar_hash=$(cat "${server_binary_tar}.sha1")
 | 
			
		||||
  fi
 | 
			
		||||
  echo "Downloading binary release tar"
 | 
			
		||||
  download-or-bust "${server_binary_tar_hash}" "${server_binary_tar_urls[@]}"
 | 
			
		||||
  tar xzf "${KUBE_HOME}/${server_binary_tar}" -C "${KUBE_HOME}" --overwrite
 | 
			
		||||
  # Copy docker_tag and image files to ${KUBE_HOME}/kube-docker-files.
 | 
			
		||||
  src_dir="${KUBE_HOME}/kubernetes/server/bin"
 | 
			
		||||
  dst_dir="${KUBE_HOME}/kube-docker-files"
 | 
			
		||||
  mkdir -p "${dst_dir}"
 | 
			
		||||
  cp "${src_dir}/"*.docker_tag "${dst_dir}"
 | 
			
		||||
  if [[ "${KUBERNETES_MASTER:-}" == "false" ]]; then
 | 
			
		||||
    cp "${src_dir}/kube-proxy.tar" "${dst_dir}"
 | 
			
		||||
  else
 | 
			
		||||
    cp "${src_dir}/kube-apiserver.tar" "${dst_dir}"
 | 
			
		||||
    cp "${src_dir}/kube-controller-manager.tar" "${dst_dir}"
 | 
			
		||||
    cp "${src_dir}/kube-scheduler.tar" "${dst_dir}"
 | 
			
		||||
    cp -r "${KUBE_HOME}/kubernetes/addons" "${dst_dir}"
 | 
			
		||||
  fi
 | 
			
		||||
  local -r kube_bin="${KUBE_HOME}/bin"
 | 
			
		||||
  mv "${src_dir}/kubelet" "${kube_bin}"
 | 
			
		||||
  mv "${src_dir}/kubectl" "${kube_bin}"
 | 
			
		||||
 | 
			
		||||
  if [[ "${NETWORK_PROVIDER:-}" == "kubenet" ]] || \
 | 
			
		||||
     [[ "${NETWORK_PROVIDER:-}" == "cni" ]]; then
 | 
			
		||||
    local -r cni_version="v0.6.0"
 | 
			
		||||
    local -r cni_tar="cni-plugins-amd64-${cni_version}.tgz"
 | 
			
		||||
    local -r cni_sha1="d595d3ded6499a64e8dac02466e2f5f2ce257c9f"
 | 
			
		||||
    download-or-bust "${cni_sha1}" "https://storage.googleapis.com/kubernetes-release/network-plugins/${cni_tar}"
 | 
			
		||||
    local -r cni_dir="${KUBE_HOME}/cni"
 | 
			
		||||
    mkdir -p "${cni_dir}/bin"
 | 
			
		||||
    tar xzf "${KUBE_HOME}/${cni_tar}" -C "${cni_dir}/bin" --overwrite
 | 
			
		||||
    mv "${cni_dir}/bin"/* "${kube_bin}"
 | 
			
		||||
    rmdir "${cni_dir}/bin"
 | 
			
		||||
    rm -f "${KUBE_HOME}/${cni_tar}"
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  mv "${KUBE_HOME}/kubernetes/LICENSES" "${KUBE_HOME}"
 | 
			
		||||
  mv "${KUBE_HOME}/kubernetes/kubernetes-src.tar.gz" "${KUBE_HOME}"
 | 
			
		||||
 | 
			
		||||
  # Put kube-system pods manifests in ${KUBE_HOME}/kube-manifests/.
 | 
			
		||||
  dst_dir="${KUBE_HOME}/kube-manifests"
 | 
			
		||||
  mkdir -p "${dst_dir}"
 | 
			
		||||
  local -r manifests_tar_urls=( $(split-commas "${KUBE_MANIFESTS_TAR_URL}") )
 | 
			
		||||
  local -r manifests_tar="${manifests_tar_urls[0]##*/}"
 | 
			
		||||
  if [ -n "${KUBE_MANIFESTS_TAR_HASH:-}" ]; then
 | 
			
		||||
    local -r manifests_tar_hash="${KUBE_MANIFESTS_TAR_HASH}"
 | 
			
		||||
  else
 | 
			
		||||
    echo "Downloading k8s manifests sha1 (not found in env)"
 | 
			
		||||
    download-or-bust "" "${manifests_tar_urls[@]/.tar.gz/.tar.gz.sha1}"
 | 
			
		||||
    local -r manifests_tar_hash=$(cat "${manifests_tar}.sha1")
 | 
			
		||||
  fi
 | 
			
		||||
  echo "Downloading k8s manifests tar"
 | 
			
		||||
  download-or-bust "${manifests_tar_hash}" "${manifests_tar_urls[@]}"
 | 
			
		||||
  tar xzf "${KUBE_HOME}/${manifests_tar}" -C "${dst_dir}" --overwrite
 | 
			
		||||
  local -r kube_addon_registry="${KUBE_ADDON_REGISTRY:-gcr.io/google_containers}"
 | 
			
		||||
  if [[ "${kube_addon_registry}" != "gcr.io/google_containers" ]]; then
 | 
			
		||||
    find "${dst_dir}" -name \*.yaml -or -name \*.yaml.in | \
 | 
			
		||||
      xargs sed -ri "s@(image:\s.*)gcr.io/google_containers@\1${kube_addon_registry}@"
 | 
			
		||||
    find "${dst_dir}" -name \*.manifest -or -name \*.json | \
 | 
			
		||||
      xargs sed -ri "s@(image\":\s+\")gcr.io/google_containers@\1${kube_addon_registry}@"
 | 
			
		||||
  fi
 | 
			
		||||
  cp "${dst_dir}/kubernetes/gci-trusty/container-linux-configure-helper.sh" "${KUBE_HOME}/bin/configure-helper.sh"
 | 
			
		||||
  chmod -R 755 "${kube_bin}"
 | 
			
		||||
 | 
			
		||||
  # Clean up.
 | 
			
		||||
  rm -rf "${KUBE_HOME}/kubernetes"
 | 
			
		||||
  rm -f "${KUBE_HOME}/${server_binary_tar}"
 | 
			
		||||
  rm -f "${KUBE_HOME}/${server_binary_tar}.sha1"
 | 
			
		||||
  rm -f "${KUBE_HOME}/${manifests_tar}"
 | 
			
		||||
  rm -f "${KUBE_HOME}/${manifests_tar}.sha1"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
######### Main Function ##########
 | 
			
		||||
echo "Start to install kubernetes files"
 | 
			
		||||
KUBE_HOME="/opt/kubernetes"
 | 
			
		||||
mkdir -p "${KUBE_HOME}"
 | 
			
		||||
download-kube-env
 | 
			
		||||
source "${KUBE_HOME}/kube-env"
 | 
			
		||||
install-kube-binary-config
 | 
			
		||||
echo "Done for installing kubernetes files"
 | 
			
		||||
 | 
			
		||||
# On Container Linux, the hosts is in /usr/share/baselayout/hosts
 | 
			
		||||
# So we need to manually populdate the hosts file here on gce.
 | 
			
		||||
echo "127.0.0.1 localhost" >> /etc/hosts
 | 
			
		||||
echo "::1 localhost" >> /etc/hosts
 | 
			
		||||
 | 
			
		||||
echo "Configuring hostname"
 | 
			
		||||
hostnamectl set-hostname $(hostname | cut -f1 -d.)
 | 
			
		||||
@@ -1,83 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
# Copyright 2016 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 for master and node instance health monitoring, which is
 | 
			
		||||
# packed in kube-manifest tarball. It is executed through a systemd service
 | 
			
		||||
# in cluster/gce/gci/<master/node>.yaml. The env variables come from an env
 | 
			
		||||
# file provided by the systemd service.
 | 
			
		||||
 | 
			
		||||
set -o nounset
 | 
			
		||||
set -o pipefail
 | 
			
		||||
 | 
			
		||||
# We simply kill the process when there is a failure. Another systemd service will
 | 
			
		||||
# automatically restart the process.
 | 
			
		||||
function docker_monitoring {
 | 
			
		||||
  while [ 1 ]; do
 | 
			
		||||
    if ! timeout 60 docker ps > /dev/null; then
 | 
			
		||||
      echo "Docker daemon failed!"
 | 
			
		||||
      pkill docker
 | 
			
		||||
      # Wait for a while, as we don't want to kill it again before it is really up.
 | 
			
		||||
      sleep 30
 | 
			
		||||
    else
 | 
			
		||||
      sleep "${SLEEP_SECONDS}"
 | 
			
		||||
    fi
 | 
			
		||||
  done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function kubelet_monitoring {
 | 
			
		||||
  echo "Wait for 2 minutes for kubelet to be fuctional"
 | 
			
		||||
  # TODO(andyzheng0831): replace it with a more reliable method if possible.
 | 
			
		||||
  sleep 120
 | 
			
		||||
  local -r max_seconds=10
 | 
			
		||||
  local output=""
 | 
			
		||||
  while [ 1 ]; do
 | 
			
		||||
    if ! output=$(curl --insecure -m "${max_seconds}" -f -s -S https://127.0.0.1:${KUBELET_PORT:-10250}/healthz 2>&1); then
 | 
			
		||||
      # Print the response and/or errors.
 | 
			
		||||
      echo $output
 | 
			
		||||
      echo "Kubelet is unhealthy!"
 | 
			
		||||
      pkill kubelet
 | 
			
		||||
      # Wait for a while, as we don't want to kill it again before it is really up.
 | 
			
		||||
      sleep 60
 | 
			
		||||
    else
 | 
			
		||||
      sleep "${SLEEP_SECONDS}"
 | 
			
		||||
    fi
 | 
			
		||||
  done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
############## Main Function ################
 | 
			
		||||
if [[ "$#" -ne 1 ]]; then
 | 
			
		||||
  echo "Usage: health-monitor.sh <docker/kubelet>"
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
KUBE_ENV="/home/kubernetes/kube-env"
 | 
			
		||||
if [[ ! -e "${KUBE_ENV}" ]]; then
 | 
			
		||||
  echo "The ${KUBE_ENV} file does not exist!! Terminate health monitoring"
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
SLEEP_SECONDS=10
 | 
			
		||||
component=$1
 | 
			
		||||
echo "Start kubernetes health monitoring for ${component}"
 | 
			
		||||
source "${KUBE_ENV}"
 | 
			
		||||
if [[ "${component}" == "docker" ]]; then
 | 
			
		||||
  docker_monitoring 
 | 
			
		||||
elif [[ "${component}" == "kubelet" ]]; then
 | 
			
		||||
  kubelet_monitoring
 | 
			
		||||
else
 | 
			
		||||
  echo "Health monitoring for component "${component}" is not supported!"
 | 
			
		||||
fi
 | 
			
		||||
@@ -1,19 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
# Copyright 2016 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.
 | 
			
		||||
 | 
			
		||||
# A library of helper functions and constants for the Container Linux distro.
 | 
			
		||||
 | 
			
		||||
# This file intentionally left blank
 | 
			
		||||
@@ -1,139 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
# Copyright 2016 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.
 | 
			
		||||
 | 
			
		||||
# A library of helper functions and constant for the Container Linux distro.
 | 
			
		||||
source "${KUBE_ROOT}/cluster/gce/container-linux/helper.sh"
 | 
			
		||||
 | 
			
		||||
# create-master-instance creates the master instance. If called with
 | 
			
		||||
# an argument, the argument is used as the name to a reserved IP
 | 
			
		||||
# address for the master. (In the case of upgrade/repair, we re-use
 | 
			
		||||
# the same IP.)
 | 
			
		||||
#
 | 
			
		||||
# It requires a whole slew of assumed variables, partially due to to
 | 
			
		||||
# the call to write-master-env. Listing them would be rather
 | 
			
		||||
# futile. Instead, we list the required calls to ensure any additional
 | 
			
		||||
#
 | 
			
		||||
# variables are set:
 | 
			
		||||
#   ensure-temp-dir
 | 
			
		||||
#   detect-project
 | 
			
		||||
#   get-bearer-token
 | 
			
		||||
function create-master-instance {
 | 
			
		||||
  local address=""
 | 
			
		||||
  [[ -n ${1:-} ]] && address="${1}"
 | 
			
		||||
 | 
			
		||||
  write-master-env
 | 
			
		||||
  create-master-instance-internal "${MASTER_NAME}" "${address}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function replicate-master-instance() {
 | 
			
		||||
  local existing_master_zone="${1}"
 | 
			
		||||
  local existing_master_name="${2}"
 | 
			
		||||
  local existing_master_replicas="${3}"
 | 
			
		||||
 | 
			
		||||
  local kube_env="$(get-metadata "${existing_master_zone}" "${existing_master_name}" kube-env)"
 | 
			
		||||
  # Substitute INITIAL_ETCD_CLUSTER to enable etcd clustering.
 | 
			
		||||
  kube_env="$(echo "${kube_env}" | grep -v "INITIAL_ETCD_CLUSTER")"
 | 
			
		||||
  kube_env="$(echo -e "${kube_env}\nINITIAL_ETCD_CLUSTER: '${existing_master_replicas},${REPLICA_NAME}'")"
 | 
			
		||||
  ETCD_CA_KEY="$(echo "${kube_env}" | grep "ETCD_CA_KEY" |  sed "s/^.*: '//" | sed "s/'$//")"
 | 
			
		||||
  ETCD_CA_CERT="$(echo "${kube_env}" | grep "ETCD_CA_CERT" |  sed "s/^.*: '//" | sed "s/'$//")"
 | 
			
		||||
 | 
			
		||||
  create-etcd-certs "${REPLICA_NAME}" "${ETCD_CA_CERT}" "${ETCD_CA_KEY}"
 | 
			
		||||
 | 
			
		||||
  kube_env="$(echo "${kube_env}" | grep -v "ETCD_PEER_KEY")"
 | 
			
		||||
  kube_env="$(echo -e "${kube_env}\nETCD_PEER_KEY: '${ETCD_PEER_KEY_BASE64}'")"
 | 
			
		||||
  kube_env="$(echo "${kube_env}" | grep -v "ETCD_PEER_CERT")"
 | 
			
		||||
  kube_env="$(echo -e "${kube_env}\nETCD_PEER_CERT: '${ETCD_PEER_CERT_BASE64}'")"
 | 
			
		||||
 | 
			
		||||
  echo "${kube_env}" > ${KUBE_TEMP}/master-kube-env.yaml
 | 
			
		||||
  get-metadata "${existing_master_zone}" "${existing_master_name}" cluster-name > "${KUBE_TEMP}/cluster-name.txt"
 | 
			
		||||
 | 
			
		||||
  create-master-instance-internal "${REPLICA_NAME}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function create-master-instance-internal() {
 | 
			
		||||
  local gcloud="gcloud"
 | 
			
		||||
  local retries=5
 | 
			
		||||
  if [[ "${ENABLE_IP_ALIASES:-}" == 'true' ]]; then
 | 
			
		||||
    gcloud="gcloud beta"
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  local -r master_name="${1}"
 | 
			
		||||
  local -r address="${2:-}"
 | 
			
		||||
 | 
			
		||||
  local preemptible_master=""
 | 
			
		||||
  if [[ "${PREEMPTIBLE_MASTER:-}" == "true" ]]; then
 | 
			
		||||
    preemptible_master="--preemptible --maintenance-policy TERMINATE"
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  local network=$(make-gcloud-network-argument \
 | 
			
		||||
    "${NETWORK_PROJECT}" "${REGION}" "${NETWORK}" "${SUBNETWORK:-}" \
 | 
			
		||||
    "${address:-}" "${ENABLE_IP_ALIASES:-}" "${IP_ALIAS_SIZE:-}")
 | 
			
		||||
 | 
			
		||||
  local metadata="kube-env=${KUBE_TEMP}/master-kube-env.yaml"
 | 
			
		||||
  metadata="${metadata},user-data=${KUBE_ROOT}/cluster/gce/container-linux/master.yaml"
 | 
			
		||||
  metadata="${metadata},configure-sh=${KUBE_ROOT}/cluster/gce/container-linux/configure.sh"
 | 
			
		||||
  metadata="${metadata},cluster-name=${KUBE_TEMP}/cluster-name.txt"
 | 
			
		||||
 | 
			
		||||
  local disk="name=${master_name}-pd"
 | 
			
		||||
  disk="${disk},device-name=master-pd"
 | 
			
		||||
  disk="${disk},mode=rw"
 | 
			
		||||
  disk="${disk},boot=no"
 | 
			
		||||
  disk="${disk},auto-delete=no"
 | 
			
		||||
 | 
			
		||||
  for attempt in $(seq 1 ${retries}); do
 | 
			
		||||
    if result=$(${gcloud} compute instances create "${master_name}" \
 | 
			
		||||
      --project "${PROJECT}" \
 | 
			
		||||
      --zone "${ZONE}" \
 | 
			
		||||
      --machine-type "${MASTER_SIZE}" \
 | 
			
		||||
      --image-project="${MASTER_IMAGE_PROJECT}" \
 | 
			
		||||
      --image "${MASTER_IMAGE}" \
 | 
			
		||||
      --tags "${MASTER_TAG}" \
 | 
			
		||||
      --scopes "storage-ro,compute-rw,monitoring,logging-write" \
 | 
			
		||||
      --metadata-from-file "${metadata}" \
 | 
			
		||||
      --disk "${disk}" \
 | 
			
		||||
      --boot-disk-size "${MASTER_ROOT_DISK_SIZE}" \
 | 
			
		||||
      ${MASTER_MIN_CPU_ARCHITECTURE:+"--min-cpu-platform=${MASTER_MIN_CPU_ARCHITECTURE}"} \
 | 
			
		||||
      ${preemptible_master} \
 | 
			
		||||
      ${network} 2>&1); then
 | 
			
		||||
      echo "${result}" >&2
 | 
			
		||||
      return 0
 | 
			
		||||
    else
 | 
			
		||||
      echo "${result}" >&2
 | 
			
		||||
      if [[ ! "${result}" =~ "try again later" ]]; then
 | 
			
		||||
        echo "Failed to create master instance due to non-retryable error" >&2
 | 
			
		||||
        return 1
 | 
			
		||||
      fi
 | 
			
		||||
      sleep 10
 | 
			
		||||
    fi
 | 
			
		||||
  done
 | 
			
		||||
 | 
			
		||||
  echo "Failed to create master instance despite ${retries} attempts" >&2
 | 
			
		||||
  return 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function get-metadata() {
 | 
			
		||||
  local zone="${1}"
 | 
			
		||||
  local name="${2}"
 | 
			
		||||
  local key="${3}"
 | 
			
		||||
 | 
			
		||||
  local metadata_url="http://metadata.google.internal/computeMetadata/v1/instance/attributes/${key}"
 | 
			
		||||
 | 
			
		||||
  gcloud compute ssh "${name}" \
 | 
			
		||||
    --project "${PROJECT}" \
 | 
			
		||||
    --zone "${zone}" \
 | 
			
		||||
    --command "curl '${metadata_url}' -H 'Metadata-Flavor: Google'" 2>/dev/null
 | 
			
		||||
}
 | 
			
		||||
@@ -1,57 +0,0 @@
 | 
			
		||||
#cloud-config
 | 
			
		||||
 | 
			
		||||
coreos:
 | 
			
		||||
  update:
 | 
			
		||||
    reboot-strategy: off
 | 
			
		||||
  units:
 | 
			
		||||
    - name: locksmithd.service
 | 
			
		||||
      mask: true
 | 
			
		||||
    - name: kube-master-installation.service
 | 
			
		||||
      command: start
 | 
			
		||||
      content: |
 | 
			
		||||
        [Unit]
 | 
			
		||||
        Description=Download and install k8s binaries and configurations
 | 
			
		||||
        After=network-online.target
 | 
			
		||||
 | 
			
		||||
        [Service]
 | 
			
		||||
        Type=oneshot
 | 
			
		||||
        RemainAfterExit=yes
 | 
			
		||||
        ExecStartPre=/bin/mkdir -p /opt/kubernetes/bin
 | 
			
		||||
        # Use --retry-connrefused opt only if it's supported by curl.
 | 
			
		||||
        ExecStartPre=/bin/bash -c 'OPT=""; if curl --help | grep -q -- "--retry-connrefused"; then OPT="--retry-connrefused"; fi; /usr/bin/curl --fail --retry 5 --retry-delay 3 $OPT --silent --show-error -H "X-Google-Metadata-Request: True" -o /opt/kubernetes/bin/configure.sh http://metadata.google.internal/computeMetadata/v1/instance/attributes/configure-sh'
 | 
			
		||||
        ExecStartPre=/bin/chmod 544 /opt/kubernetes/bin/configure.sh
 | 
			
		||||
        ExecStart=/opt/kubernetes/bin/configure.sh
 | 
			
		||||
 | 
			
		||||
        [Install]
 | 
			
		||||
        WantedBy=kubernetes.target
 | 
			
		||||
    - name: kube-master-configuration.service
 | 
			
		||||
      command: start
 | 
			
		||||
      content: |
 | 
			
		||||
        [Unit]
 | 
			
		||||
        Description=Configure kubernetes master
 | 
			
		||||
        After=kube-master-installation.service
 | 
			
		||||
 | 
			
		||||
        [Service]
 | 
			
		||||
        Type=oneshot
 | 
			
		||||
        RemainAfterExit=yes
 | 
			
		||||
        ExecStartPre=/bin/chmod 544 /opt/kubernetes/bin/configure-helper.sh
 | 
			
		||||
        ExecStart=/opt/kubernetes/bin/configure-helper.sh
 | 
			
		||||
 | 
			
		||||
        [Install]
 | 
			
		||||
        WantedBy=kubernetes.target
 | 
			
		||||
    - name: kubernetes.target
 | 
			
		||||
      enable: true
 | 
			
		||||
      command: start
 | 
			
		||||
      content: |
 | 
			
		||||
        [Unit]
 | 
			
		||||
        Description=Kubernetes
 | 
			
		||||
 | 
			
		||||
        [Install]
 | 
			
		||||
        WantedBy=multi-user.target
 | 
			
		||||
    - name: docker.service
 | 
			
		||||
      drop-ins:
 | 
			
		||||
        - name: "use-cgroupfs-driver.conf"
 | 
			
		||||
          # This is required for setting cgroup parent in the current ~1.4 per-pod cgroup impl
 | 
			
		||||
          content: |
 | 
			
		||||
            [Service]
 | 
			
		||||
            Environment="DOCKER_CGROUPS=--exec-opt native.cgroupdriver="
 | 
			
		||||
@@ -1,35 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
# Copyright 2016 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.
 | 
			
		||||
 | 
			
		||||
# A library of helper functions and constant for the Container Linux distro.
 | 
			
		||||
source "${KUBE_ROOT}/cluster/gce/container-linux/helper.sh"
 | 
			
		||||
 | 
			
		||||
function get-node-instance-metadata {
 | 
			
		||||
  local metadata=""
 | 
			
		||||
  metadata+="kube-env=${KUBE_TEMP}/node-kube-env.yaml,"
 | 
			
		||||
  metadata+="user-data=${KUBE_ROOT}/cluster/gce/container-linux/node.yaml,"
 | 
			
		||||
  metadata+="configure-sh=${KUBE_ROOT}/cluster/gce/container-linux/configure.sh,"
 | 
			
		||||
  metadata+="cluster-name=${KUBE_TEMP}/cluster-name.txt"
 | 
			
		||||
  echo "${metadata}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# $1: template name (required).
 | 
			
		||||
function create-node-instance-template {
 | 
			
		||||
  local template_name="$1"
 | 
			
		||||
 | 
			
		||||
  create-node-template "$template_name" "${scope_flags[*]}" "$(get-node-instance-metadata)"
 | 
			
		||||
  # TODO(euank): We should include update-strategy here. We should also switch to ignition
 | 
			
		||||
}
 | 
			
		||||
@@ -1,57 +0,0 @@
 | 
			
		||||
#cloud-config
 | 
			
		||||
 | 
			
		||||
coreos:
 | 
			
		||||
  update:
 | 
			
		||||
    reboot-strategy: off
 | 
			
		||||
  units:
 | 
			
		||||
    - name: locksmithd.service
 | 
			
		||||
      mask: true
 | 
			
		||||
    - name: kube-node-installation.service
 | 
			
		||||
      command: start
 | 
			
		||||
      content: |
 | 
			
		||||
        [Unit]
 | 
			
		||||
        Description=Download and install k8s binaries and configurations
 | 
			
		||||
        After=network-online.target
 | 
			
		||||
 | 
			
		||||
        [Service]
 | 
			
		||||
        Type=oneshot
 | 
			
		||||
        RemainAfterExit=yes
 | 
			
		||||
        ExecStartPre=/bin/mkdir -p /opt/kubernetes/bin
 | 
			
		||||
        # Use --retry-connrefused opt only if it's supported by curl.
 | 
			
		||||
        ExecStartPre=/bin/bash -c 'OPT=""; if curl --help | grep -q -- "--retry-connrefused"; then OPT="--retry-connrefused"; fi; /usr/bin/curl --fail --retry 5 --retry-delay 3 $OPT --silent --show-error -H "X-Google-Metadata-Request: True" -o /opt/kubernetes/bin/configure.sh http://metadata.google.internal/computeMetadata/v1/instance/attributes/configure-sh'
 | 
			
		||||
        ExecStartPre=/bin/chmod 544 /opt/kubernetes/bin/configure.sh
 | 
			
		||||
        ExecStart=/opt/kubernetes/bin/configure.sh
 | 
			
		||||
 | 
			
		||||
        [Install]
 | 
			
		||||
        WantedBy=kubernetes.target
 | 
			
		||||
    - name: kube-node-configuration.service
 | 
			
		||||
      command: start
 | 
			
		||||
      content: |
 | 
			
		||||
        [Unit]
 | 
			
		||||
        Description=Configure kubernetes master
 | 
			
		||||
        After=kube-node-installation.service
 | 
			
		||||
 | 
			
		||||
        [Service]
 | 
			
		||||
        Type=oneshot
 | 
			
		||||
        RemainAfterExit=yes
 | 
			
		||||
        ExecStartPre=/bin/chmod 544 /opt/kubernetes/bin/configure-helper.sh
 | 
			
		||||
        ExecStart=/opt/kubernetes/bin/configure-helper.sh
 | 
			
		||||
 | 
			
		||||
        [Install]
 | 
			
		||||
        WantedBy=kubernetes.target
 | 
			
		||||
    - name: kubernetes.target
 | 
			
		||||
      enable: true
 | 
			
		||||
      command: start
 | 
			
		||||
      content: |
 | 
			
		||||
        [Unit]
 | 
			
		||||
        Description=Kubernetes
 | 
			
		||||
 | 
			
		||||
        [Install]
 | 
			
		||||
        WantedBy=multi-user.target
 | 
			
		||||
    - name: docker.service
 | 
			
		||||
      drop-ins:
 | 
			
		||||
        - name: "use-cgroupfs-driver.conf"
 | 
			
		||||
          # This is required for setting cgroup parent in the current ~1.4 per-pod cgroup impl
 | 
			
		||||
          content: |
 | 
			
		||||
            [Service]
 | 
			
		||||
            Environment="DOCKER_CGROUPS=--exec-opt native.cgroupdriver="
 | 
			
		||||
@@ -25,14 +25,14 @@ source "${KUBE_ROOT}/cluster/gce/${KUBE_CONFIG_FILE-"config-default.sh"}"
 | 
			
		||||
source "${KUBE_ROOT}/cluster/common.sh"
 | 
			
		||||
source "${KUBE_ROOT}/hack/lib/util.sh"
 | 
			
		||||
 | 
			
		||||
if [[ "${NODE_OS_DISTRIBUTION}" == "debian" || "${NODE_OS_DISTRIBUTION}" == "container-linux" || "${NODE_OS_DISTRIBUTION}" == "trusty" || "${NODE_OS_DISTRIBUTION}" == "gci" || "${NODE_OS_DISTRIBUTION}" == "ubuntu" ]]; then
 | 
			
		||||
if [[ "${NODE_OS_DISTRIBUTION}" == "debian" || "${NODE_OS_DISTRIBUTION}" == "trusty" || "${NODE_OS_DISTRIBUTION}" == "gci" || "${NODE_OS_DISTRIBUTION}" == "ubuntu" ]]; then
 | 
			
		||||
  source "${KUBE_ROOT}/cluster/gce/${NODE_OS_DISTRIBUTION}/node-helper.sh"
 | 
			
		||||
else
 | 
			
		||||
  echo "Cannot operate on cluster using node os distro: ${NODE_OS_DISTRIBUTION}" >&2
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ "${MASTER_OS_DISTRIBUTION}" == "container-linux" || "${MASTER_OS_DISTRIBUTION}" == "trusty" || "${MASTER_OS_DISTRIBUTION}" == "gci" || "${MASTER_OS_DISTRIBUTION}" == "ubuntu" ]]; then
 | 
			
		||||
if [[ "${MASTER_OS_DISTRIBUTION}" == "trusty" || "${MASTER_OS_DISTRIBUTION}" == "gci" || "${MASTER_OS_DISTRIBUTION}" == "ubuntu" ]]; then
 | 
			
		||||
  source "${KUBE_ROOT}/cluster/gce/${MASTER_OS_DISTRIBUTION}/master-helper.sh"
 | 
			
		||||
else
 | 
			
		||||
  echo "Cannot operate on cluster using master os distro: ${MASTER_OS_DISTRIBUTION}" >&2
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user